From 3c791b9c9e303197eace211c3f69985585a52dac Mon Sep 17 00:00:00 2001 From: seapehim Date: Thu, 29 Feb 2024 16:45:04 +0200 Subject: [PATCH 1/3] Added Blocks 5 and 6 of TB Registration report --- Serialized_Object.sql | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Serialized_Object.sql b/Serialized_Object.sql index 73e2c66..3e9702e 100644 --- a/Serialized_Object.sql +++ b/Serialized_Object.sql @@ -47,7 +47,7 @@ CREATE TABLE `serialized_object` ( CONSTRAINT `serialized_object_changed_by` FOREIGN KEY (`changed_by`) REFERENCES `users` (`user_id`), CONSTRAINT `serialized_object_creator` FOREIGN KEY (`creator`) REFERENCES `users` (`user_id`), CONSTRAINT `serialized_object_retired_by` FOREIGN KEY (`retired_by`) REFERENCES `users` (`user_id`) -) ENGINE=InnoDB AUTO_INCREMENT=2600 DEFAULT CHARSET=utf8; +) ENGINE=InnoDB AUTO_INCREMENT=2721 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -67,11 +67,11 @@ INSERT INTO `serialized_object` VALUES (1157,'VL-24 Detectable VL test results', INSERT INTO `serialized_object` VALUES (1302,'PITC_HTS_Outreach Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_HTS_Outreach Data Set\n \n 2021-09-30 13:53:05 UTC\n \n 2021-09-30 14:40:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1302\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Finer_Age\n \n \n \n \n \n \n \n \n NNegF1-4\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 01-04yrs\n \n \n \n \n \n NNegF10-14\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 10-14yrs\n \n \n \n \n \n NNegF15-19\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 15-19yrs\n \n \n \n \n \n NNegF20-24\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 20-24yrs\n \n \n \n \n \n NNegF25-29\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 25-29yrs\n \n \n \n \n \n NNegF30-34\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 30-34yrs\n \n \n \n \n \n NNegF35-39\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 35-39yrs\n \n \n \n \n \n NNegF40-44\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 40-44yrs\n \n \n \n \n \n NNegF45-49\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 45-49yrs\n \n \n \n \n \n NNegF5-9\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 05-09yrs\n \n \n \n \n \n NNegF50Plu\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 50Plus\n \n \n \n \n \n NNegF<1\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n Under1yr\n \n \n \n \n \n NNegM1-4\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 01-04yrs\n \n \n \n \n \n NNegM10-14\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 10-14yrs\n \n \n \n \n \n NNegM15-19\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 15-19yrs\n \n \n \n \n \n NNegM20-24\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 20-24yrs\n \n \n \n \n \n NNegM25-29\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 25-29yrs\n \n \n \n \n \n NNegM30-34\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 30-34yrs\n \n \n \n \n \n NNegM35-39\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 35-39yrs\n \n \n \n \n \n NNegM40-44\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 40-44yrs\n \n \n \n \n \n NNegM45-49\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 45-49yrs\n \n \n \n \n \n NNegM5-9\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 05-09yrs\n \n \n \n \n \n NNegM50Plu\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 50Plus\n \n \n \n \n \n NNegM<1\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n Under1yr\n \n \n \n \n \n NPosF1-4\n \n \n \n \n \n \n \n \n \n NPosF10-14\n \n \n \n \n \n \n NPosF15-19\n \n \n \n \n \n \n NPosF20-24\n \n \n \n \n \n \n NPosF25-29\n \n \n \n \n \n \n NPosF30-34\n \n \n \n \n \n \n NPosF35-39\n \n \n \n \n \n \n NPosF40-44\n \n \n \n \n \n \n NPosF45-49\n \n \n \n \n \n \n NPosF5-9\n \n \n \n \n \n \n NPosF50Plu\n \n \n \n \n \n \n NPosF<1\n \n \n \n \n \n \n NPosM1-4\n \n \n \n \n \n \n NPosM10-14\n \n \n \n \n \n \n NPosM15-19\n \n \n \n \n \n \n NPosM20-24\n \n \n \n \n \n \n NPosM25-29\n \n \n \n \n \n \n NPosM30-34\n \n \n \n \n \n \n NPosM35-39\n \n \n \n \n \n \n NPosM40-44\n \n \n \n \n \n \n NPosM45-49\n \n \n \n \n \n \n NPosM5-9\n \n \n \n \n \n \n NPosM50Plu\n \n \n \n \n \n \n NPosM<1\n \n \n \n \n \n \n RNegF1-4\n \n \n \n \n \n \n \n \n \n RNegF10-14\n \n \n \n \n \n \n RNegF15-19\n \n \n \n \n \n \n RNegF20-24\n \n \n \n \n \n \n RNegF25-29\n \n \n \n \n \n \n RNegF30-34\n \n \n \n \n \n \n RNegF35-39\n \n \n \n \n \n \n RNegF40-44\n \n \n \n \n \n \n RNegF45-49\n \n \n \n \n \n \n RNegF5-9\n \n \n \n \n \n \n RNegF50Plu\n \n \n \n \n \n \n RNegF<1\n \n \n \n \n \n \n RNegM1-4\n \n \n \n \n \n \n RNegM10-14\n \n \n \n \n \n \n RNegM15-19\n \n \n \n \n \n \n RNegM20-24\n \n \n \n \n \n \n RNegM25-29\n \n \n \n \n \n \n RNegM30-34\n \n \n \n \n \n \n RNegM35-39\n \n \n \n \n \n \n RNegM40-44\n \n \n \n \n \n \n RNegM45-49\n \n \n \n \n \n \n RNegM5-9\n \n \n \n \n \n \n RNegM50Plu\n \n \n \n \n \n \n RNegM<1\n \n \n \n \n \n \n RPosF1-4\n \n \n \n \n \n \n \n \n \n RPosF10-14\n \n \n \n \n \n \n RPosF15-19\n \n \n \n \n \n \n RPosF20-24\n \n \n \n \n \n \n RPosF25-29\n \n \n \n \n \n \n RPosF30-34\n \n \n \n \n \n \n RPosF35-39\n \n \n \n \n \n \n RPosF40-44\n \n \n \n \n \n \n RPosF45-49\n \n \n \n \n \n \n RPosF5-9\n \n \n \n \n \n \n RPosF50Plu\n \n \n \n \n \n \n RPosF<1\n \n \n \n \n \n \n RPosM1-4\n \n \n \n \n \n \n RPosM10-14\n \n \n \n \n \n \n RPosM15-19\n \n \n \n \n \n \n RPosM20-24\n \n \n \n \n \n \n RPosM25-29\n \n \n \n \n \n \n RPosM30-34\n \n \n \n \n \n \n RPosM35-39\n \n \n \n \n \n \n RPosM40-44\n \n \n \n \n \n \n RPosM45\n \n \n \n \n \n \n RPosM5-9\n \n \n \n \n \n \n RPosM50Plu\n \n \n \n \n \n \n RPosM<1\n \n \n \n \n \n \n','2021-09-30 15:53:05',4,'2021-09-30 16:40:26',4,0,NULL,NULL,NULL,'617f0c89-e7d6-4e28-b9d0-77c22b59c8e8'),(1303,'CITC_New_Neg_Outreach','CITC_New_Neg_Outreach','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_New_Neg_Outreach\n CITC_New_Neg_Outreach\n \n 2021-09-30 19:52:49 UTC\n \n 2021-09-30 19:59:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1303\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-09-30 21:52:49',4,'2021-09-30 21:59:14',4,0,NULL,NULL,NULL,'d55affa6-233e-42b7-b781-2d35bcb11d20'),(1304,'CITC_New_Pos_Outreach','CITC_New_Pos_Outreach','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_New_Pos_Outreach\n CITC_New_Pos_Outreach\n \n 2021-09-30 19:53:13 UTC\n \n 2021-09-30 20:04:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1304\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-09-30 21:53:13',4,'2021-09-30 22:04:23',4,0,NULL,NULL,NULL,'70d48a98-c83c-4d92-83eb-ecbb22050996'),(1305,'CITC_Repeat_Neg_Outreach','CITC_Repeat_Neg_Outreach','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_Repeat_Neg_Outreach\n CITC_Repeat_Neg_Outreach\n \n 2021-09-30 19:54:25 UTC\n \n 2021-09-30 20:06:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1305\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-09-30 21:54:25',4,'2021-09-30 22:06:45',4,0,NULL,NULL,NULL,'dcd9c782-fff7-4481-9f61-958f8484b9a0'),(1306,'CITC_Repeat_Pos_Outreach','CITC_Repeat_Pos_Outreach','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_Repeat_Pos_Outreach\n CITC_Repeat_Pos_Outreach\n \n 2021-09-30 19:55:31 UTC\n \n 2021-09-30 20:06:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1306\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-09-30 21:55:31',4,'2021-09-30 22:06:31',4,0,NULL,NULL,NULL,'37c3dd42-9503-4957-a234-d18cdd62a67a'),(1307,'CITC_HTS_Outreach','CITC_HTS_Outreach','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_HTS_Outreach\n CITC_HTS_Outreach\n \n 2021-09-30 20:03:27 UTC\n \n 2021-09-30 20:04:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1307\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2021-09-30 22:03:27',4,'2021-09-30 22:04:04',4,0,NULL,NULL,NULL,'6e3130f4-4993-4e26-adce-598c242565e9'),(1308,'CITC_HTS_Outreach Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_HTS_Outreach Data Set\n \n 2021-09-30 20:04:04 UTC\n \n 2021-09-30 22:06:25 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1308\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Finer_Age\n \n \n \n \n \n \n \n \n NNegF1-4\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 01-04yrs\n \n \n \n \n \n NNegF10\n \n \n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 10-14yrs\n \n \n \n \n \n NNegF15-19\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 15-19yrs\n \n \n \n \n \n NNegF20-24\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 20-24yrs\n \n \n \n \n \n NNegF25-29\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 25-29yrs\n \n \n \n \n \n NNegF30-34\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 30-34yrs\n \n \n \n \n \n NNegF35-39\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 35-39yrs\n \n \n \n \n \n NNegF40-44\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 40-44yrs\n \n \n \n \n \n NNegF45-49\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 45-49yrs\n \n \n \n \n \n NNegF5-9\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 05-09yrs\n \n \n \n \n \n NNegF50Plu\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 50Plus\n \n \n \n \n \n NNegF<1\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n Under1yr\n \n \n \n \n \n NNegM1-4\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 01-04yrs\n \n \n \n \n \n NNegM10-14\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 10-14yrs\n \n \n \n \n \n NNegM15-19\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 15-19yrs\n \n \n \n \n \n NNegM20-24\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 20-24yrs\n \n \n \n \n \n NNegM25-29\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 25-29yrs\n \n \n \n \n \n NNegM30-34\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 30-34yrs\n \n \n \n \n \n NNegM35-39\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 35-39yrs\n \n \n \n \n \n NNegM40-44\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 40-44yrs\n \n \n \n \n \n NNegM45-49\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 45-49yrs\n \n \n \n \n \n NNegM5-9\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 05-09yrs\n \n \n \n \n \n NNegM50Plu\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 50Plus\n \n \n \n \n \n NNegM<1\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n Under1yr\n \n \n \n \n \n NPosF1-4\n \n \n \n \n \n \n NPosF10-14\n \n \n \n \n \n \n NPosF15-19\n \n \n \n \n \n \n NPosF20-24\n \n \n \n \n \n \n NPosF25-29\n \n \n \n \n \n \n NPosF30-34\n \n \n \n \n \n \n NPosF35-39\n \n \n \n \n \n \n NPosF40-44\n \n \n \n \n \n \n NPosF45-49\n \n \n \n \n \n \n NPosF5-9\n \n \n \n \n \n \n NPosF50Plu\n \n \n \n \n \n \n NPosF<1\n \n \n \n \n \n \n NPosM1-4\n \n \n \n \n \n \n NPosM10-14\n \n \n \n \n \n \n NPosM15-19\n \n \n \n \n \n \n NPosM20-24\n \n \n \n \n \n \n NPosM25-29\n \n \n \n \n \n \n NPosM30-34\n \n \n \n \n \n \n NPosM35-39\n \n \n \n \n \n \n NPosM40-44\n \n \n \n \n \n \n NPosM45-49\n \n \n \n \n \n \n NPosM5-9\n \n \n \n \n \n \n NPosM50Plu\n \n \n \n \n \n \n NPosM<1\n \n \n \n \n \n \n RNegF1-4\n \n \n \n \n \n \n \n \n \n RNegF10-14\n \n \n \n \n \n \n RNegF15-19\n \n \n \n \n \n \n RNegF20-24\n \n \n \n \n \n \n RNegF25-29\n \n \n \n \n \n \n RNegF30-34\n \n \n \n \n \n \n RNegF35-39\n \n \n \n \n \n \n RNegF40-44\n \n \n \n \n \n \n RNegF45-49\n \n \n \n \n \n \n RNegF5-9\n \n \n \n \n \n \n RNegF50Plu\n \n \n \n \n \n \n RNegF<1\n \n \n \n \n \n \n RNegM1-4\n \n \n \n \n \n \n RNegM10-14\n \n \n \n \n \n \n RNegM15-19\n \n \n \n \n \n \n RNegM20-24\n \n \n \n \n \n \n RNegM25-29\n \n \n \n \n \n \n RNegM30-34\n \n \n \n \n \n \n RNegM35-39\n \n \n \n \n \n \n RNegM40-44\n \n \n \n \n \n \n RNegM45-49\n \n \n \n \n \n \n RNegM5-9\n \n \n \n \n \n \n RNegM50Plu\n \n \n \n \n \n \n RNegM<1\n \n \n \n \n \n \n RPosF1-4\n \n \n \n \n \n \n \n \n \n RPosF10-14\n \n \n \n \n \n \n RPosF15-19\n \n \n \n \n \n \n RPosF20-24\n \n \n \n \n \n \n RPosF25-29\n \n \n \n \n \n \n RPosF30-34\n \n \n \n \n \n \n RPosF35-39\n \n \n \n \n \n \n RPosF40-44\n \n \n \n \n \n \n RPosF45-49\n \n \n \n \n \n \n RPosF5-9\n \n \n \n \n \n \n RPosF50Plu\n \n \n \n \n \n \n RPosF<1\n \n \n \n \n \n \n RPosM1-4\n \n \n \n \n \n \n RPosM10-14\n \n \n \n \n \n \n RPosM15-19\n \n \n \n \n \n \n RPosM20-24\n \n \n \n \n \n \n RPosM25-29\n \n \n \n \n \n \n RPosM30-34\n \n \n \n \n \n \n RPosM35-39\n \n \n \n \n \n \n RPosM40-44\n \n \n \n \n \n \n RPosM45-49\n \n \n \n \n \n \n RPosM5-9\n \n \n \n \n \n \n RPosM50Plu\n \n \n \n \n \n \n RPosM<1\n \n \n \n \n \n \n','2021-09-30 22:04:04',4,'2021-10-01 00:06:25',4,0,NULL,NULL,NULL,'ac8c58c1-770c-4770-8418-4597c8b55c15'),(1309,' PITC_New_Neg_Adolescent',' PITC_New_Neg_Adolescent','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_New_Neg_Adolescent\n PITC_New_Neg_Adolescent\n \n 2021-10-05 20:43:32 UTC\n \n 2021-10-05 20:48:56 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1309\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-05 22:43:32',4,'2021-10-05 22:48:56',4,0,NULL,NULL,NULL,'6aa142db-2786-4b21-beba-0ec77f22b523'),(1310,' PITC_New_Pos_Adolescent',' PITC_New_Pos_Adolescent','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_New_Pos_Adolescent\n PITC_New_Pos_Adolescent\n \n 2021-10-05 20:45:02 UTC\n \n 2021-10-05 20:49:16 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1310\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-05 22:45:02',4,'2021-10-05 22:49:16',4,0,NULL,NULL,NULL,'8da0c564-e37c-447a-bb9c-81f65a635eae'),(1311,' PITC_Repeat_Neg_Adolescent',' PITC_Repeat_Neg_Adolescent','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_Repeat_Neg_Adolescent\n PITC_Repeat_Neg_Adolescent\n \n 2021-10-05 20:46:27 UTC\n \n 2021-10-05 20:50:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1311\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-05 22:46:27',4,'2021-10-05 22:50:02',4,0,NULL,NULL,NULL,'80d3e806-5077-42e0-9e5d-a89bd8579e73'),(1312,' PITC_Repeat_Pos_Adolescent',' PITC_Repeat_Pos_Adolescent','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_Repeat_Pos_Adolescent\n PITC_Repeat_Pos_Adolescent\n \n 2021-10-05 20:47:22 UTC\n \n 2021-10-05 20:50:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1312\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-05 22:47:22',4,'2021-10-05 22:50:21',4,0,NULL,NULL,NULL,'7ed0ead3-64c7-4529-9b3e-c82025462bb6'),(1313,'PITC_HTS_Adolescent','HTS Report for Adolescent location','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_HTS_Adolescent\n HTS Report for Adolescent location\n \n 2021-10-05 20:54:10 UTC\n \n 2021-10-05 20:54:35 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1313\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2021-10-05 22:54:10',4,'2021-10-05 22:54:35',4,0,NULL,NULL,NULL,'7f017fec-79d5-4ea6-87ba-be936e919d6b'),(1314,'PITC_HTS_Adolescent Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_HTS_Adolescent Data Set\n \n 2021-10-05 20:54:35 UTC\n \n 2021-10-06 06:00:38 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1314\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Finer_Age\n \n \n \n \n \n \n \n \n NNegF1-4\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 01-04yrs\n \n \n \n \n \n NNegF10-14\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 10-14yrs\n \n \n \n \n \n NNegF15-19\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 15-19yrs\n \n \n \n \n \n NNegF20-24\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 20-24yrs\n \n \n \n \n \n NNegF25-29\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 25-29yrs\n \n \n \n \n \n NNegF30-34\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 30-34yrs\n \n \n \n \n \n NNegF35-39\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 35-39yrs\n \n \n \n \n \n NNegF40-44\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 40-44yrs\n \n \n \n \n \n NNegF45-49\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 45-49yrs\n \n \n \n \n \n NNegF5-9\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 05-09yrs\n \n \n \n \n \n NNegF50Plu\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 50Plus\n \n \n \n \n \n NNegF<1\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n Under1yr\n \n \n \n \n \n NNegM1-4\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 01-04yrs\n \n \n \n \n \n NNegM10-14\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 10-14yrs\n \n \n \n \n \n NNegM15-19\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 15-19yrs\n \n \n \n \n \n NNegM20-24\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 20-24yrs\n \n \n \n \n \n NNegM25-29\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 25-29yrs\n \n \n \n \n \n NNegM30-34\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 30-34yrs\n \n \n \n \n \n NNegM35-39\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 35-39yrs\n \n \n \n \n \n NNegM40-44\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 40-44yrs\n \n \n \n \n \n NNegM45-49\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 45-49yrs\n \n \n \n \n \n NNegM5-9\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 05-09yrs\n \n \n \n \n \n NNegM50Plu\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 50Plus\n \n \n \n \n \n NNegM<1\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n Under1yr\n \n \n \n \n \n NPosF1-4\n \n \n \n \n \n \n \n \n \n NPosF10-14\n \n \n \n \n \n \n NPosF15-19\n \n \n \n \n \n \n NPosF20-24\n \n \n \n \n \n \n NPosF25-29\n \n \n \n \n \n \n NPosF30-34\n \n \n \n \n \n \n NPosF35-39\n \n \n \n \n \n \n NPosF40-44\n \n \n \n \n \n \n NPosF45-49\n \n \n \n \n \n \n NPosF5-9\n \n \n \n \n \n \n NPosF50Plu\n \n \n \n \n \n \n NPosF<1\n \n \n \n \n \n \n NPosM1-4\n \n \n \n \n \n \n NPosM10-14\n \n \n \n \n \n \n NPosM15-19\n \n \n \n \n \n \n NPosM20-24\n \n \n \n \n \n \n NPosM25-29\n \n \n \n \n \n \n NPosM30-34\n \n \n \n \n \n \n NPosM35-39\n \n \n \n \n \n \n NPosM40-44\n \n \n \n \n \n \n NPosM45-49\n \n \n \n \n \n \n NPosM5-9\n \n \n \n \n \n \n NPosM50Plu\n \n \n \n \n \n \n NPosM<1\n \n \n \n \n \n \n RNegF1-4\n \n \n \n \n \n \n \n \n \n RNegF10-14\n \n \n \n \n \n \n RNegF15-19\n \n \n \n \n \n \n RNegF20-24\n \n \n \n \n \n \n RNegF25-29\n \n \n \n \n \n \n RNegF30-34\n \n \n \n \n \n \n RNegF35-39\n \n \n \n \n \n \n RNegF40-44\n \n \n \n \n \n \n RNegF45-49\n \n \n \n \n \n \n RNegF5-9\n \n \n \n \n \n \n RNegF50\n \n \n \n \n \n \n RNegF<1\n \n \n \n \n \n \n RNegM1-4\n \n \n \n \n \n \n RNegM10-14\n \n \n \n \n \n \n RNegM15-19\n \n \n \n \n \n \n RNegM20-24\n \n \n \n \n \n \n RNegM25-29\n \n \n \n \n \n \n RNegM30-34\n \n \n \n \n \n \n RNegM35-39\n \n \n \n \n \n \n RNegM40-44\n \n \n \n \n \n \n RNegM45-49\n \n \n \n \n \n \n RNegM5-9\n \n \n \n \n \n \n RNegM50Plu\n \n \n \n \n \n \n RNegM<1\n \n \n \n \n \n \n RPosF1-4\n \n \n \n \n \n \n \n \n \n RPosF10-14\n \n \n \n \n \n \n RPosF15-19\n \n \n \n \n \n \n RPosF20-24\n \n \n \n \n \n \n RPosF25-29\n \n \n \n \n \n \n RPosF30-34\n \n \n \n \n \n \n RPosF35-39\n \n \n \n \n \n \n RPosF40-44\n \n \n \n \n \n \n RPosF45-49\n \n \n \n \n \n \n RPosF5-9\n \n \n \n \n \n \n RPosF50Plu\n \n \n \n \n \n \n RPosF<1\n \n \n \n \n \n \n RPosM1-4\n \n \n \n \n \n \n RPosM10-14\n \n \n \n \n \n \n RPosM15-19\n \n \n \n \n \n \n RPosM20-24\n \n \n \n \n \n \n RPosM25-29\n \n \n \n \n \n \n RPosM30-34\n \n \n \n \n \n \n RPosM35-39\n \n \n \n \n \n \n RPosM40-44\n \n \n \n \n \n \n RPosM45-49\n \n \n \n \n \n \n RPosM5-9\n \n \n \n \n \n \n RPosM50Plu\n \n \n \n \n \n \n RPosM<1\n \n \n \n \n \n \n','2021-10-05 22:54:35',4,'2021-10-06 08:00:38',4,0,NULL,NULL,NULL,'3559e185-9b49-4159-a276-bee817744132'),(1315,'CITC_New_Neg_Adolescent','CITC_New_Neg_Adolescent','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_New_Neg_Adolescent\n CITC_New_Neg_Adolescent\n \n 2021-10-06 09:39:49 UTC\n \n 2021-10-06 09:44:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1315\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-06 11:39:49',4,'2021-10-06 11:44:29',4,0,NULL,NULL,NULL,'eb91b86e-c2db-4d3b-8a67-7dc511379d4a'),(1316,'CITC_New_Pos_Adolescent','CITC_New_Pos_Adolescent','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_New_Pos_Adolescent\n CITC_New_Pos_Adolescent\n \n 2021-10-06 09:40:53 UTC\n \n 2021-10-06 09:44:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1316\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-06 11:40:53',4,'2021-10-06 11:44:45',4,0,NULL,NULL,NULL,'53065d6f-4498-41e0-92f5-907e584e85fa'),(1317,'CITC_Repeat_Neg_Adolescent','CITC_Repeat_Neg_Adolescent','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_Repeat_Neg_Adolescent\n CITC_Repeat_Neg_Adolescent\n \n 2021-10-06 09:41:27 UTC\n \n 2021-10-06 09:45:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1317\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-06 11:41:27',4,'2021-10-06 11:45:02',4,0,NULL,NULL,NULL,'787ad098-ef27-4117-9acf-28781458e03e'),(1318,'CITC_Repeat_Pos_Adolescent','CITC_Repeat_Pos_Adolescent','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_Repeat_Pos_Adolescent\n CITC_Repeat_Pos_Adolescent\n \n 2021-10-06 09:41:52 UTC\n \n 2021-10-06 09:45:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1318\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-06 11:41:52',4,'2021-10-06 11:45:17',4,0,NULL,NULL,NULL,'67dbab08-8fee-479d-a0af-ff4ac7dc8648'),(1319,'CITC_HTS_Adolescent','CITC_HTS_Adolescent','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_HTS_Adolescent\n CITC_HTS_Adolescent\n \n 2021-10-06 09:46:57 UTC\n \n 2021-10-06 09:47:25 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1319\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2021-10-06 11:46:57',4,'2021-10-06 11:47:25',4,0,NULL,NULL,NULL,'6992581e-4161-4f22-b90a-36dc1965ccfd'),(1320,'CITC_HTS_Adolescent Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_HTS_Adolescent Data Set\n \n 2021-10-06 09:47:25 UTC\n \n 2021-10-06 15:27:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1320\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Finer_Age\n \n \n \n \n \n \n \n \n NNegF1-4\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 01-04yrs\n \n \n \n \n \n NNegF10-14\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 10-14yrs\n \n \n \n \n \n NNegF15-19\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 15-19yrs\n \n \n \n \n \n NNegF20-24\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 20-24yrs\n \n \n \n \n \n NNegF25-29\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 25-29yrs\n \n \n \n \n \n NNegF30-34\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 30-34yrs\n \n \n \n \n \n NNegF35-39\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 35-39yrs\n \n \n \n \n \n NNegF40-44\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 40-44yrs\n \n \n \n \n \n NNegF45-49\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 45-49yrs\n \n \n \n \n \n NNegF5-9\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 05-09yrs\n \n \n \n \n \n NNegF50Plu\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 50Plus\n \n \n \n \n \n NNegF<1\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n Under1yr\n \n \n \n \n \n NNegM1-4\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 01-04yrs\n \n \n \n \n \n NNegM10-14\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 10-14yrs\n \n \n \n \n \n NNegM15-19\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 15-19yrs\n \n \n \n \n \n NNegM20-24\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 20-24yrs\n \n \n \n \n \n NNegM25-29\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 25-29yrs\n \n \n \n \n \n NNegM30-34\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 30-34yrs\n \n \n \n \n \n NNegM35-39\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 35-39yrs\n \n \n \n \n \n NNegM40-44\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 40-44yrs\n \n \n \n \n \n NNegM45-49\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 45-49yrs\n \n \n \n \n \n NNegM5-9\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 05-09yrs\n \n \n \n \n \n NNegM50Plu\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 50Plus\n \n \n \n \n \n NNegM<1\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n Under1yr\n \n \n \n \n \n NPosF1-4\n \n \n \n \n \n \n \n \n \n NPosF10-14\n \n \n \n \n \n \n NPosF15-19\n \n \n \n \n \n \n NPosF20-24\n \n \n \n \n \n \n NPosF25-29\n \n \n \n \n \n \n NPosF30-34\n \n \n \n \n \n \n NPosF35-39\n \n \n \n \n \n \n NPosF40-44\n \n \n \n \n \n \n NPosF45-49\n \n \n \n \n \n \n NPosF5-9\n \n \n \n \n \n \n NPosF50Plu\n \n \n \n \n \n \n NPosF<1\n \n \n \n \n \n \n NPosM1-4\n \n \n \n \n \n \n NPosM10-14\n \n \n \n \n \n \n NPosM15-19\n \n \n \n \n \n \n NPosM20-24\n \n \n \n \n \n \n NPosM25-29\n \n \n \n \n \n \n NPosM30-34\n \n \n \n \n \n \n NPosM35-39\n \n \n \n \n \n \n NPosM40-44\n \n \n \n \n \n \n NPosM45-49\n \n \n \n \n \n \n NPosM5-9\n \n \n \n \n \n \n NPosM50Plu\n \n \n \n \n \n \n NPosM<1\n \n \n \n \n \n \n RNegF1-4\n \n \n \n \n \n \n \n \n \n RNegF10-14\n \n \n \n \n \n \n RNegF15-19\n \n \n \n \n \n \n RNegF20-24\n \n \n \n \n \n \n RNegF25-29\n \n \n \n \n \n \n RNegF30-34\n \n \n \n \n \n \n RNegF35-39\n \n \n \n \n \n \n RNegF40-44\n \n \n \n \n \n \n RNegF45-49\n \n \n \n \n \n \n RNegF5-9\n \n \n \n \n \n \n RNegF50Plu\n \n \n \n \n \n \n RNegF<1\n \n \n \n \n \n \n RNegM1-4\n \n \n \n \n \n \n RNegM10-14\n \n \n \n \n \n \n RNegM15-19\n \n \n \n \n \n \n RNegM20-24\n \n \n \n \n \n \n RNegM25-29\n \n \n \n \n \n \n RNegM30-34\n \n \n \n \n \n \n RNegM35-39\n \n \n \n \n \n \n RNegM40-44\n \n \n \n \n \n \n RNegM45-49\n \n \n \n \n \n \n RNegM5-9\n \n \n \n \n \n \n RNegM50Plu\n \n \n \n \n \n \n RNegM<1\n \n \n \n \n \n \n RPosF1-4\n \n \n \n \n \n \n \n \n \n RPosF10-14\n \n \n \n \n \n \n RPosF15-19\n \n \n \n \n \n \n RPosF20-24\n \n \n \n \n \n \n RPosF25-29\n \n \n \n \n \n \n RPosF30-34\n \n \n \n \n \n \n RPosF35-39\n \n \n \n \n \n \n RPosF40-44\n \n \n \n \n \n \n RPosF45-49\n \n \n \n \n \n \n RPosF5-9\n \n \n \n \n \n \n RPosF50Plu\n \n \n \n \n \n \n RPosF<1\n \n \n \n \n \n \n RPosM1-4\n \n \n \n \n \n \n RPosM10-14\n \n \n \n \n \n \n RPosM15-19\n \n \n \n \n \n \n RPosM20-24\n \n \n \n \n \n \n RPosM25-29\n \n \n \n \n \n \n RPosM30-34\n \n \n \n \n \n \n RPosM35-39\n \n \n \n \n \n \n RPosM40-44\n \n \n \n \n \n \n RPosM45-49\n \n \n \n \n \n \n RPosM5-9\n \n \n \n \n \n \n RPosM50Plu\n \n \n \n \n \n \n RPosM<1\n \n \n \n \n \n \n','2021-10-06 11:47:25',4,'2021-10-06 17:27:43',4,0,NULL,NULL,NULL,'4a64819c-e83a-4486-bc35-3b94e45e6285'),(1321,' PITC_New_Neg_MCH',' PITC_New_Neg_MCH','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_New_Neg_MCH\n PITC_New_Neg_MCH\n \n 2021-10-06 15:32:10 UTC\n \n 2021-10-06 15:35:35 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1321\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-06 17:32:10',4,'2021-10-06 17:35:35',4,0,NULL,NULL,NULL,'da4ee526-eb6c-475d-925c-ab56da241de3'),(1322,' PITC_New_Pos_MCH',' PITC_New_Pos_MCH','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_New_Pos_MCH\n PITC_New_Pos_MCH\n \n 2021-10-06 15:32:39 UTC\n \n 2021-10-06 15:35:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1322\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-06 17:32:39',4,'2021-10-06 17:35:50',4,0,NULL,NULL,NULL,'b3e9452d-7a33-4d06-ae8c-5e730923eb7b'),(1323,' PITC_Repeat_Neg_MCH',' PITC_Repeat_Neg_MCH','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_Repeat_Neg_MCH\n PITC_Repeat_Neg_MCH\n \n 2021-10-06 15:33:14 UTC\n \n 2021-10-06 15:36:49 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1323\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-06 17:33:14',4,'2021-10-06 17:36:49',4,0,NULL,NULL,NULL,'168f838a-8ac0-43f1-a178-bb24cff130f1'),(1324,' PITC_Repeat_Pos_MCH',' PITC_Repeat_Pos_MCH','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_Repeat_Pos_MCH\n PITC_Repeat_Pos_MCH\n \n 2021-10-06 15:33:43 UTC\n \n 2021-10-06 15:37:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1324\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-06 17:33:43',4,'2021-10-06 17:37:03',4,0,NULL,NULL,NULL,'49998468-941c-4817-b3e7-ada1ea8862cc'),(1325,'PITC_HTS_MCH','HTS Report for MCH location','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_HTS_MCH\n HTS Report for MCH location\n \n 2021-10-06 15:39:51 UTC\n \n 2021-10-07 04:34:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1325\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2021-10-06 17:39:51',4,'2021-10-07 06:34:03',4,0,NULL,NULL,NULL,'d946548e-a7f9-4115-bcd3-f78afdab092d'),(1326,'PITC_HTS_MCH Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_HTS_MCH Data Set\n \n 2021-10-06 15:40:13 UTC\n \n 2021-10-06 21:25:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1326\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Finer_Age\n \n \n \n \n \n \n \n \n NNegF1-4\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 01-04yrs\n \n \n \n \n \n NNegF10-14\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 10-14yrs\n \n \n \n \n \n NNegF15-19\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 15-19yrs\n \n \n \n \n \n NNegF20-24\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 20-24yrs\n \n \n \n \n \n NNegF25-29\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 25-29yrs\n \n \n \n \n \n NNegF30-34\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 30-34yrs\n \n \n \n \n \n NNegF35-39\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 35-39yrs\n \n \n \n \n \n NNegF40-44\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 40-44yrs\n \n \n \n \n \n NNegF45-49\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 45-49yrs\n \n \n \n \n \n NNegF5-9\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 05-09yrs\n \n \n \n \n \n NNegF50Plu\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 50Plus\n \n \n \n \n \n NNegF<1\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n Under1yr\n \n \n \n \n \n NNegM1-4\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 01-04yrs\n \n \n \n \n \n NNegM10-14\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 10-14yrs\n \n \n \n \n \n NNegM15-19\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 15-19yrs\n \n \n \n \n \n NNegM20-24\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 20-24yrs\n \n \n \n \n \n NNegM25-29\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 25-29yrs\n \n \n \n \n \n NNegM30-34\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 30-34yrs\n \n \n \n \n \n NNegM35-39\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 35-39yrs\n \n \n \n \n \n NNegM40-44\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 40-44yrs\n \n \n \n \n \n NNegM45-49\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 45-49yrs\n \n \n \n \n \n NNegM5-9\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 05-09yrs\n \n \n \n \n \n NNegM50Plu\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 50Plus\n \n \n \n \n \n NNegM<1\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n Under1yr\n \n \n \n \n \n NPosF1-4\n \n \n \n \n \n \n \n \n \n NPosF10-14\n \n \n \n \n \n \n NPosF15-19\n \n \n \n \n \n \n NPosF20-24\n \n \n \n \n \n \n NPosF25-29\n \n \n \n \n \n \n NPosF30-34\n \n \n \n \n \n \n NPosF35-39\n \n \n \n \n \n \n NPosF40-44\n \n \n \n \n \n \n NPosF45-49\n \n \n \n \n \n \n NPosF5-9\n \n \n \n \n \n \n NPosF50Plu\n \n \n \n \n \n \n NPosF<1\n \n \n \n \n \n \n NPosM1-4\n \n \n \n \n \n \n NPosM10-14\n \n \n \n \n \n \n NPosM15-19\n \n \n \n \n \n \n NPosM20-24\n \n \n \n \n \n \n NPosM25-29\n \n \n \n \n \n \n NPosM30-34\n \n \n \n \n \n \n NPosM35-39\n \n \n \n \n \n \n NPosM40-44\n \n \n \n \n \n \n NPosM45-49\n \n \n \n \n \n \n NPosM5-9\n \n \n \n \n \n \n NPosM50Plu\n \n \n \n \n \n \n NPosM<1\n \n \n \n \n \n \n RNegF1-4\n \n \n \n \n \n \n \n \n \n RNegF10-14\n \n \n \n \n \n \n RNegF15-19\n \n \n \n \n \n \n RNegF20-24\n \n \n \n \n \n \n RNegF25-29\n \n \n \n \n \n \n RNegF30-34\n \n \n \n \n \n \n RNegF35-39\n \n \n \n \n \n \n RNegF40-44\n \n \n \n \n \n \n RNegF45-49\n \n \n \n \n \n \n RNegF5-9\n \n \n \n \n \n \n RNegF50Plu\n \n \n \n \n \n \n RNegF<1\n \n \n \n \n \n \n RNegM1-4\n \n \n \n \n \n \n RNegM10-14\n \n \n \n \n \n \n RNegM15-19\n \n \n \n \n \n \n RNegM20-24\n \n \n \n \n \n \n RNegM25-29\n \n \n \n \n \n \n RNegM30-34\n \n \n \n \n \n \n RNegM35-39\n \n \n \n \n \n \n RNegM40-44\n \n \n \n \n \n \n RNegM45-49\n \n \n \n \n \n \n RNegM5-9\n \n \n \n \n \n \n RNegM50Plu\n \n \n \n \n \n \n RNegM<1\n \n \n \n \n \n \n RPosF1-4\n \n \n \n \n \n \n \n \n \n RPosF10-14\n \n \n \n \n \n \n RPosF15-19\n \n \n \n \n \n \n RPosF20-24\n \n \n \n \n \n \n RPosF25-29\n \n \n \n \n \n \n RPosF30-34\n \n \n \n \n \n \n RPosF35-39\n \n \n \n \n \n \n RPosF40-44\n \n \n \n \n \n \n RPosF45-49\n \n \n \n \n \n \n RPosF5-9\n \n \n \n \n \n \n RPosF50Plu\n \n \n \n \n \n \n RPosF<1\n \n \n \n \n \n \n RPosM1-4\n \n \n \n \n \n \n RPosM10-14\n \n \n \n \n \n \n RPosM15-19\n \n \n \n \n \n \n RPosM20-24\n \n \n \n \n \n \n RPosM25-29\n \n \n \n \n \n \n RPosM30-34\n \n \n \n \n \n \n RPosM35-39\n \n \n \n \n \n \n RPosM40-44\n \n \n \n \n \n \n RPosM45-49\n \n \n \n \n \n \n RPosM5-9\n \n \n \n \n \n \n RPosM50Plu\n \n \n \n \n \n \n RPosM<1\n \n \n \n \n \n \n','2021-10-06 17:40:13',4,'2021-10-06 23:25:14',4,0,NULL,NULL,NULL,'e7bbe762-47b2-4ca9-adcb-64e8b0cd50e1'),(1327,'CITC_New_Pos_MCH','CITC_New_Pos_MCH','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_New_Pos_MCH\n CITC_New_Pos_MCH\n \n 2021-10-06 21:29:56 UTC\n \n 2021-10-06 21:33:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1327\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-06 23:29:56',4,'2021-10-06 23:33:10',4,0,NULL,NULL,NULL,'ca78fdaa-e5f6-498e-9781-9cf1f8366220'),(1328,'CITC_New_Neg_MCH','CITC_New_Neg_MCH','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_New_Neg_MCH\n CITC_New_Neg_MCH\n \n 2021-10-06 21:30:12 UTC\n \n 2021-10-06 21:32:49 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1328\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-06 23:30:12',4,'2021-10-06 23:32:49',4,0,NULL,NULL,NULL,'32c4681d-fbde-4aa3-b10c-bf6393b39a4b'),(1329,'CITC_Repeat_Neg_MCH','CITC_Repeat_Neg_MCH','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_Repeat_Neg_MCH\n CITC_Repeat_Neg_MCH\n \n 2021-10-06 21:30:32 UTC\n \n 2021-10-06 21:33:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1329\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-06 23:30:32',4,'2021-10-06 23:33:53',4,0,NULL,NULL,NULL,'51f2438c-b8a5-47c2-8703-c04885de774e'),(1330,'CITC_Repeat_Pos_MCH','CITC_Repeat_Pos_MCH','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_Repeat_Pos_MCH\n CITC_Repeat_Pos_MCH\n \n 2021-10-06 21:30:46 UTC\n \n 2021-10-06 21:34:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1330\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-06 23:30:46',4,'2021-10-06 23:34:06',4,0,NULL,NULL,NULL,'50a98d1c-3cc7-43e9-824b-dde34f55e120'),(1331,'CITC_HTS_MCH','CITC_HTS_MCH','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_HTS_MCH\n CITC_HTS_MCH\n \n 2021-10-06 21:36:13 UTC\n \n 2021-10-06 21:36:35 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1331\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2021-10-06 23:36:13',4,'2021-10-06 23:36:35',4,0,NULL,NULL,NULL,'65873a4c-f706-4491-afc1-1a6ee9f18a35'),(1332,'CITC_HTS_MCH Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_HTS_MCH Data Set\n \n 2021-10-06 21:36:35 UTC\n \n 2021-10-06 23:12:16 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1332\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Finer_Age\n \n \n \n \n \n \n \n \n NNegF1-4\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 01-04yrs\n \n \n \n \n \n NNegF10-14\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 10-14yrs\n \n \n \n \n \n NNegF15-19\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 15-19yrs\n \n \n \n \n \n NNegF20-24\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 20-24yrs\n \n \n \n \n \n NNegF25-29\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 25-29yrs\n \n \n \n \n \n NNegF30-34\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 30-34yrs\n \n \n \n \n \n NNegF35-39\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 35-39yrs\n \n \n \n \n \n NNegF40-44\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 40-44yrs\n \n \n \n \n \n NNegF45-49\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 45-49yrs\n \n \n \n \n \n NNegF5-9\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 05-09yrs\n \n \n \n \n \n NNegF50Plu\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 50Plus\n \n \n \n \n \n NNegF<1\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n Under1yr\n \n \n \n \n \n NNegM1-4\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 01-04yrs\n \n \n \n \n \n NNegM10-14\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 10-14yrs\n \n \n \n \n \n NNegM15-19\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 15-19yrs\n \n \n \n \n \n NNegM20-24\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 20-24yrs\n \n \n \n \n \n NNegM25-29\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 25-29yrs\n \n \n \n \n \n NNegM30-34\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 30-34yrs\n \n \n \n \n \n NNegM35-39\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 35-39yrs\n \n \n \n \n \n NNegM40-44\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 40-44yrs\n \n \n \n \n \n NNegM45-49\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 45-49yrs\n \n \n \n \n \n NNegM5-9\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 05-09yrs\n \n \n \n \n \n NNegM50Plu\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 50Plus\n \n \n \n \n \n NNegM<1\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n Under1yr\n \n \n \n \n \n NPosF1-4\n \n \n \n \n \n \n \n \n \n NPosF10-14\n \n \n \n \n \n \n NPosF15-19\n \n \n \n \n \n \n NPosF20-24\n \n \n \n \n \n \n NPosF25-29\n \n \n \n \n \n \n NPosF30-34\n \n \n \n \n \n \n NPosF35-39\n \n \n \n \n \n \n NPosF40-44\n \n \n \n \n \n \n NPosF45-49\n \n \n \n \n \n \n NPosF5-9\n \n \n \n \n \n \n NPosF50Plu\n \n \n \n \n \n \n NPosF<1\n \n \n \n \n \n \n NPosM1-4\n \n \n \n \n \n \n NPosM10-14\n \n \n \n \n \n \n NPosM15-19\n \n \n \n \n \n \n NPosM20-24\n \n \n \n \n \n \n NPosM25-29\n \n \n \n \n \n \n NPosM30-34\n \n \n \n \n \n \n NPosM35-39\n \n \n \n \n \n \n NPosM40-44\n \n \n \n \n \n \n NPosM45-49\n \n \n \n \n \n \n NPosM5-9\n \n \n \n \n \n \n NPosM50Plu\n \n \n \n \n \n \n NPosM<1\n \n \n \n \n \n \n RNegF1-4\n \n \n \n \n \n \n \n \n \n RNegF10-14\n \n \n \n \n \n \n RNegF15-19\n \n \n \n \n \n \n RNegF20-24\n \n \n \n \n \n \n RNegF25-29\n \n \n \n \n \n \n RNegF30-34\n \n \n \n \n \n \n RNegF35-39\n \n \n \n \n \n \n RNegF40-44\n \n \n \n \n \n \n RNegF45-49\n \n \n \n \n \n \n RNegF5-9\n \n \n \n \n \n \n RNegF50Plu\n \n \n \n \n \n \n RNegF<1\n \n \n \n \n \n \n RNegM1-4\n \n \n \n \n \n \n RNegM10-14\n \n \n \n \n \n \n RNegM15-19\n \n \n \n \n \n \n RNegM20-24\n \n \n \n \n \n \n RNegM25-29\n \n \n \n \n \n \n RNegM30-34\n \n \n \n \n \n \n RNegM35-39\n \n \n \n \n \n \n RNegM40\n \n \n \n \n \n \n RNegM45-49\n \n \n \n \n \n \n RNegM5-9\n \n \n \n \n \n \n RNegM50Plu\n \n \n \n \n \n \n RNegM<1\n \n \n \n \n \n \n RPosF1-4\n \n \n \n \n \n \n \n \n \n RPosF10-14\n \n \n \n \n \n \n RPosF15-19\n \n \n \n \n \n \n RPosF20-24\n \n \n \n \n \n \n RPosF25-29\n \n \n \n \n \n \n RPosF30-34\n \n \n \n \n \n \n RPosF35-39\n \n \n \n \n \n \n RPosF40-44\n \n \n \n \n \n \n RPosF45-49\n \n \n \n \n \n \n RPosF5-9\n \n \n \n \n \n \n RPosF50Plu\n \n \n \n \n \n \n RPosF<1\n \n \n \n \n \n \n RPosM1-4\n \n \n \n \n \n \n RPosM10-14\n \n \n \n \n \n \n RPosM15-19\n \n \n \n \n \n \n RPosM20-24\n \n \n \n \n \n \n RPosM25-29\n \n \n \n \n \n \n RPosM30-34\n \n \n \n \n \n \n RPosM35-39\n \n \n \n \n \n \n RPosM40-44\n \n \n \n \n \n \n RPosM45-49\n \n \n \n \n \n \n RPosM5-9\n \n \n \n \n \n \n RPosM50Plu\n \n \n \n \n \n \n RPosM<1\n \n \n \n \n \n \n','2021-10-06 23:36:35',4,'2021-10-07 01:12:16',4,0,NULL,NULL,NULL,'545ac344-383c-40fb-b248-f42915e427f5'),(1333,'PITC_New_Neg_Index','PITC_New_Neg_Index','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_New_Neg_Index\n PITC_New_Neg_Index\n \n 2021-10-07 04:25:39 UTC\n \n 2021-10-07 04:29:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1333\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-07 06:25:39',4,'2021-10-07 06:29:23',4,0,NULL,NULL,NULL,'4c7fd830-a0c3-4e72-950c-05b972769d55'),(1334,'PITC_New_Pos_Index','PITC_New_Pos_Index','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_New_Pos_Index\n PITC_New_Pos_Index\n \n 2021-10-07 04:25:56 UTC\n \n 2021-10-07 04:29:46 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1334\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-07 06:25:56',4,'2021-10-07 06:29:46',4,0,NULL,NULL,NULL,'a4977c25-a493-47af-a8c9-7add78c9adf9'),(1335,'PITC_Repeat_Neg_Index','PITC_Repeat_Neg_Index','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_Repeat_Neg_Index\n PITC_Repeat_Neg_Index\n \n 2021-10-07 04:26:41 UTC\n \n 2021-10-07 04:30:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1335\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-07 06:26:41',4,'2021-10-07 06:30:04',4,0,NULL,NULL,NULL,'e3e5f2be-eb19-4c33-8b0c-72d67e791ab4'),(1336,'PITC_Repeat_Pos_Index','PITC_Repeat_Pos_Index','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_Repeat_Pos_Index\n PITC_Repeat_Pos_Index\n \n 2021-10-07 04:26:54 UTC\n \n 2021-10-07 04:30:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1336\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-07 06:26:54',4,'2021-10-07 06:30:41',4,0,NULL,NULL,NULL,'dbb343c4-6946-4a13-b6dc-e2a2e77dfaed'),(1337,'PITC_HTS_Index','HTS Report for Index Clients','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_HTS_Index\n HTS Report for Index Clients\n \n 2021-10-07 04:33:41 UTC\n \n 2021-10-07 04:34:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1337\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2021-10-07 06:33:41',4,'2021-10-07 06:34:05',4,0,NULL,NULL,NULL,'ce0ad8fd-bde8-4fce-be69-23e238f249bb'),(1338,'PITC_HTS_Index Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_HTS_Index Data Set\n \n 2021-10-07 04:34:04 UTC\n \n 2021-10-07 06:43:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1338\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Finer_Age\n \n \n \n \n \n \n \n \n NNegF1-4\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 01-04yrs\n \n \n \n \n \n NNegF10-14\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 10-14yrs\n \n \n \n \n \n NNegF15-19\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 15-19yrs\n \n \n \n \n \n NNegF20-24\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 20-24yrs\n \n \n \n \n \n NNegF25-29\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 25-29yrs\n \n \n \n \n \n NNegF30-34\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 30-34yrs\n \n \n \n \n \n NNegF35-39\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 35-39yrs\n \n \n \n \n \n NNegF40-44\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 40-44yrs\n \n \n \n \n \n NNegF45-49\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 45-49yrs\n \n \n \n \n \n NNegF5-9\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 05-09yrs\n \n \n \n \n \n NNegF50Plu\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 50Plus\n \n \n \n \n \n NNegF<1\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n Under1yr\n \n \n \n \n \n NNegM1-4\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 01-04yrs\n \n \n \n \n \n NNegM10-14\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 10-14yrs\n \n \n \n \n \n NNegM15-19\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 15-19yrs\n \n \n \n \n \n NNegM20-24\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 20-24yrs\n \n \n \n \n \n NNegM25-29\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 25-29yrs\n \n \n \n \n \n NNegM30-34\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 30-34yrs\n \n \n \n \n \n NNegM35-39\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 35-39yrs\n \n \n \n \n \n NNegM40-44\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 40-44yrs\n \n \n \n \n \n NNegM45-49\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 45-49yrs\n \n \n \n \n \n NNegM5-9\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 05-09yrs\n \n \n \n \n \n NNegM50Plu\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 50Plus\n \n \n \n \n \n NNegM<1\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n Under1yr\n \n \n \n \n \n NPosF1-4\n \n \n \n \n \n \n \n \n \n NPosF10-14\n \n \n \n \n \n \n NPosF15-19\n \n \n \n \n \n \n NPosF20-24\n \n \n \n \n \n \n NPosF25-29\n \n \n \n \n \n \n NPosF30-34\n \n \n \n \n \n \n NPosF35-39\n \n \n \n \n \n \n NPosF40-44\n \n \n \n \n \n \n NPosF45-49\n \n \n \n \n \n \n NPosF5-9\n \n \n \n \n \n \n NPosF50Plu\n \n \n \n \n \n \n NPosF<1\n \n \n \n \n \n \n NPosM1-4\n \n \n \n \n \n \n NPosM10-14\n \n \n \n \n \n \n NPosM15-19\n \n \n \n \n \n \n NPosM20-24\n \n \n \n \n \n \n NPosM25-29\n \n \n \n \n \n \n NPosM30-34\n \n \n \n \n \n \n NPosM35-39\n \n \n \n \n \n \n NPosM40-44\n \n \n \n \n \n \n NPosM45-49\n \n \n \n \n \n \n NPosM5-9\n \n \n \n \n \n \n NPosM50Plu\n \n \n \n \n \n \n NPosM<1\n \n \n \n \n \n \n RNegF1-4\n \n \n \n \n \n \n \n \n \n RNegF10-14\n \n \n \n \n \n \n RNegF15-19\n \n \n \n \n \n \n RNegF20-24\n \n \n \n \n \n \n RNegF25-29\n \n \n \n \n \n \n RNegF30-34\n \n \n \n \n \n \n RNegF35-39\n \n \n \n \n \n \n RNegF40-44\n \n \n \n \n \n \n RNegF45-49\n \n \n \n \n \n \n RNegF5-9\n \n \n \n \n \n \n RNegF50Plu\n \n \n \n \n \n \n RNegF<1\n \n \n \n \n \n \n RNegM1-4\n \n \n \n \n \n \n RNegM10-14\n \n \n \n \n \n \n RNegM15-19\n \n \n \n \n \n \n RNegM20-24\n \n \n \n \n \n \n RNegM25-29\n \n \n \n \n \n \n RNegM30-34\n \n \n \n \n \n \n RNegM35-39\n \n \n \n \n \n \n RNegM40-44\n \n \n \n \n \n \n RNegM45-49\n \n \n \n \n \n \n RNegM5-9\n \n \n \n \n \n \n RNegM50Plu\n \n \n \n \n \n \n RNegM<1\n \n \n \n \n \n \n RPosF1-4\n \n \n \n \n \n \n \n \n \n RPosF10-14\n \n \n \n \n \n \n RPosF15-19\n \n \n \n \n \n \n RPosF20-24\n \n \n \n \n \n \n RPosF25-29\n \n \n \n \n \n \n RPosF30-34\n \n \n \n \n \n \n RPosF35\n \n \n \n \n \n \n RPosF40-44\n \n \n \n \n \n \n RPosF45-49\n \n \n \n \n \n \n RPosF5-9\n \n \n \n \n \n \n RPosF50Plu\n \n \n \n \n \n \n RPosF<1\n \n \n \n \n \n \n RPosM1-4\n \n \n \n \n \n \n RPosM10-14\n \n \n \n \n \n \n RPosM15-19\n \n \n \n \n \n \n RPosM20-24\n \n \n \n \n \n \n RPosM25-29\n \n \n \n \n \n \n RPosM30\n \n \n \n \n \n \n RPosM35-39\n \n \n \n \n \n \n RPosM40-44\n \n \n \n \n \n \n RPosM45-49\n \n \n \n \n \n \n RPosM5-9\n \n \n \n \n \n \n RPosM50Plu\n \n \n \n \n \n \n RPosM<1\n \n \n \n \n \n \n','2021-10-07 06:34:04',4,'2021-10-07 08:43:10',4,0,NULL,NULL,NULL,'6425e4dd-681d-43a9-912b-3b0b6367a969'),(1339,'CITC_New_Neg_Index','CITC_New_Neg_Index','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_New_Neg_Index\n CITC_New_Neg_Index\n \n 2021-10-07 07:25:59 UTC\n \n 2021-10-07 07:31:52 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1339\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-07 09:25:59',4,'2021-10-07 09:31:52',4,0,NULL,NULL,NULL,'976b5e87-e40a-4e5f-822b-2b41ae0f7ecc'),(1340,'CITC_New_Pos_Index','CITC_New_Pos_Index','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_New_Pos_Index\n CITC_New_Pos_Index\n \n 2021-10-07 07:26:54 UTC\n \n 2021-10-07 07:30:52 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1340\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-07 09:26:54',4,'2021-10-07 09:30:52',4,0,NULL,NULL,NULL,'5286eeaa-dfe4-4d69-ba48-8931a03a1a8d'),(1341,'CITC_Repeat_Neg_Index','CITC_Repeat_Neg_Index','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_Repeat_Neg_Index\n CITC_Repeat_Neg_Index\n \n 2021-10-07 07:27:26 UTC\n \n 2021-10-07 07:31:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1341\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-07 09:27:26',4,'2021-10-07 09:31:17',4,0,NULL,NULL,NULL,'ad69563a-424d-4772-8869-d366a9d92307'),(1342,'CITC_Repeat_Pos_Index','CITC_Repeat_Pos_Index','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_Repeat_Pos_Index\n CITC_Repeat_Pos_Index\n \n 2021-10-07 07:28:27 UTC\n \n 2021-10-07 07:31:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1342\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-07 09:28:27',4,'2021-10-07 09:31:36',4,0,NULL,NULL,NULL,'e1cc0a62-96a8-4f4c-9d05-49e3ccd97fed'),(1343,'CITC_HTS_Index','CITC_HTS_Index','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_HTS_Index\n CITC_HTS_Index\n \n 2021-10-07 07:33:43 UTC\n \n 2021-10-07 07:34:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1343\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2021-10-07 09:33:43',4,'2021-10-07 09:34:04',4,0,NULL,NULL,NULL,'dce22475-86fa-436c-9e0c-d1af120f9cf2'),(1344,'CITC_HTS_Index Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_HTS_Index Data Set\n \n 2021-10-07 07:34:04 UTC\n \n 2021-10-07 09:01:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1344\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Finer_Age\n \n \n \n \n \n \n \n \n NNegF1-4\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 01-04yrs\n \n \n \n \n \n NNegF10-14\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 10-14yrs\n \n \n \n \n \n NNegF15-19\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 15-19yrs\n \n \n \n \n \n NNegF20-24\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 20-24yrs\n \n \n \n \n \n NNegF25-29\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 25-29yrs\n \n \n \n \n \n NNegF30-34\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 30-34yrs\n \n \n \n \n \n NNegF35-39\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 35-39yrs\n \n \n \n \n \n NNegF40-44\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 40-44yrs\n \n \n \n \n \n NNegF45-49\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 45-49yrs\n \n \n \n \n \n NNegF5-9\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 05-09yrs\n \n \n \n \n \n NNegF50Plu\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 50Plus\n \n \n \n \n \n NNegF<1\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n Under1yr\n \n \n \n \n \n NNegM1-4\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 01-04yrs\n \n \n \n \n \n NNegM10-14\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 10-14yrs\n \n \n \n \n \n NNegM15-19\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 15-19yrs\n \n \n \n \n \n NNegM20-24\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 20-24yrs\n \n \n \n \n \n NNegM25-29\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 25-29yrs\n \n \n \n \n \n NNegM30-34\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 30-34yrs\n \n \n \n \n \n NNegM35-39\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 35-39yrs\n \n \n \n \n \n NNegM40-44\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 40-44yrs\n \n \n \n \n \n NNegM45-49\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 45-49yrs\n \n \n \n \n \n NNegM5-9\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 05-09yrs\n \n \n \n \n \n NNegM50Plu\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 50Plus\n \n \n \n \n \n NNegM<1\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n Under1yr\n \n \n \n \n \n NPosF1-4\n \n \n \n \n \n \n \n \n \n NPosF10-14\n \n \n \n \n \n \n NPosF15-19\n \n \n \n \n \n \n NPosF20-24\n \n \n \n \n \n \n NPosF25-29\n \n \n \n \n \n \n NPosF30-34\n \n \n \n \n \n \n NPosF35-39\n \n \n \n \n \n \n NPosF40-44\n \n \n \n \n \n \n NPosF45-49\n \n \n \n \n \n \n NPosF5-9\n \n \n \n \n \n \n NPosF50Plu\n \n \n \n \n \n \n NPosF<1\n \n \n \n \n \n \n NPosM1-4\n \n \n \n \n \n \n NPosM10-14\n \n \n \n \n \n \n NPosM15-19\n \n \n \n \n \n \n NPosM20-24\n \n \n \n \n \n \n NPosM25-29\n \n \n \n \n \n \n NPosM30-34\n \n \n \n \n \n \n NPosM35-39\n \n \n \n \n \n \n NPosM40-44\n \n \n \n \n \n \n NPosM45-49\n \n \n \n \n \n \n NPosM5-9\n \n \n \n \n \n \n NPosM50Plu\n \n \n \n \n \n \n NPosM<1\n \n \n \n \n \n \n RNegF1-4\n \n \n \n \n \n \n \n \n \n RNegF10-14\n \n \n \n \n \n \n RNegF15-19\n \n \n \n \n \n \n RNegF20-24\n \n \n \n \n \n \n RNegF25-29\n \n \n \n \n \n \n RNegF30-34\n \n \n \n \n \n \n RNegF35-39\n \n \n \n \n \n \n RNegF40-44\n \n \n \n \n \n \n RNegF45-49\n \n \n \n \n \n \n RNegF5-9\n \n \n \n \n \n \n RNegF50Plu\n \n \n \n \n \n \n RNegF<1\n \n \n \n \n \n \n RNegM1-4\n \n \n \n \n \n \n RNegM10-14\n \n \n \n \n \n \n RNegM15-19\n \n \n \n \n \n \n RNegM20-24\n \n \n \n \n \n \n RNegM25-29\n \n \n \n \n \n \n RNegM30-34\n \n \n \n \n \n \n RNegM35-39\n \n \n \n \n \n \n RNegM40-44\n \n \n \n \n \n \n RNegM45-49\n \n \n \n \n \n \n RNegM5-9\n \n \n \n \n \n \n RNegM50Plu\n \n \n \n \n \n \n RNegM<1\n \n \n \n \n \n \n RPosF1-4\n \n \n \n \n \n \n \n \n \n RPosF10-14\n \n \n \n \n \n \n RPosF15-19\n \n \n \n \n \n \n RPosF20-24\n \n \n \n \n \n \n RPosF25-29\n \n \n \n \n \n \n RPosF30-34\n \n \n \n \n \n \n RPosF35-39\n \n \n \n \n \n \n RPosF40-44\n \n \n \n \n \n \n RPosF45-49\n \n \n \n \n \n \n RPosF5-9\n \n \n \n \n \n \n RPosF50Plu\n \n \n \n \n \n \n RPosF<1\n \n \n \n \n \n \n RPosM1-4\n \n \n \n \n \n \n RPosM10-14\n \n \n \n \n \n \n RPosM15-19\n \n \n \n \n \n \n RPosM20-24\n \n \n \n \n \n \n RPosM25-29\n \n \n \n \n \n \n RPosM30-34\n \n \n \n \n \n \n RPosM35-39\n \n \n \n \n \n \n RPosM40-44\n \n \n \n \n \n \n RPosM45-49\n \n \n \n \n \n \n RPosM5-9\n \n \n \n \n \n \n RPosM50Plu\n \n \n \n \n \n \n RPosM<1\n \n \n \n \n \n \n','2021-10-07 09:34:04',4,'2021-10-07 11:01:32',4,0,NULL,NULL,NULL,'5618efc3-69e9-4c64-adaa-741ed768cbd3'),(1345,'PITC_New_Neg_ART','PITC_New_Neg_ART','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_New_Neg_ART\n PITC_New_Neg_ART\n \n 2021-10-07 10:13:58 UTC\n \n 2021-10-07 10:16:09 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1345\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-07 12:13:58',4,'2021-10-07 12:16:09',4,0,NULL,NULL,NULL,'6d5bf688-5a2f-4616-82e2-c01a54f14722'),(1346,'PITC_New_Pos_ART','PITC_New_Pos_ART','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_New_Pos_ART\n PITC_New_Pos_ART\n \n 2021-10-07 10:14:22 UTC\n \n 2021-10-07 10:16:24 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1346\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-07 12:14:22',4,'2021-10-07 12:16:24',4,0,NULL,NULL,NULL,'ea06ed88-160a-467d-9417-76fdb0d46941'),(1347,'PITC_Repeat_Neg_ART','PITC_Repeat_Neg_ART','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_Repeat_Neg_ART\n PITC_Repeat_Neg_ART\n \n 2021-10-07 10:14:49 UTC\n \n 2021-10-07 10:17:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1347\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-07 12:14:49',4,'2021-10-07 12:17:02',4,0,NULL,NULL,NULL,'44e7f485-5997-4262-8fad-c7e92dc4fba5'),(1348,'PITC_Repeat_Pos_ART','PITC_Repeat_Pos_ART','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_Repeat_Pos_ART\n PITC_Repeat_Pos_ART\n \n 2021-10-07 10:15:14 UTC\n \n 2021-10-07 10:17:16 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1348\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-07 12:15:14',4,'2021-10-07 12:17:16',4,0,NULL,NULL,NULL,'7b43f84d-eb38-48ea-a8c4-7600c51472bf'),(1349,'PITC_HTS_ART','HTS Report for ART Location Clients','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_HTS_ART\n HTS Report for ART Location Clients\n \n 2021-10-07 10:26:07 UTC\n \n 2021-10-07 10:26:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1349\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2021-10-07 12:26:07',4,'2021-10-07 12:26:32',4,0,NULL,NULL,NULL,'f75d35bb-2331-4d53-9b78-4caa525d469d'),(1350,'PITC_HTS_ART Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_HTS_ART Data Set\n \n 2021-10-07 10:26:32 UTC\n \n 2021-10-07 11:44:24 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1350\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Finer_Age\n \n \n \n \n \n \n \n \n NNegF1-4\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 01-04yrs\n \n \n \n \n \n NNegF10-14\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 10-14yrs\n \n \n \n \n \n NNegF15-19\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 15-19yrs\n \n \n \n \n \n NNegF20-24\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 20-24yrs\n \n \n \n \n \n NNegF25-29\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 25-29yrs\n \n \n \n \n \n NNegF30-34\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 30-34yrs\n \n \n \n \n \n NNegF35-39\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 35-39yrs\n \n \n \n \n \n NNegF40-44\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 40-44yrs\n \n \n \n \n \n NNegF45-49\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 45-49yrs\n \n \n \n \n \n NNegF5-9\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 05-09yrs\n \n \n \n \n \n NNegF50Plu\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 50Plus\n \n \n \n \n \n NNegF<1\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n Under1yr\n \n \n \n \n \n NNegM1-4\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 01-04yrs\n \n \n \n \n \n NNegM10-14\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 10-14yrs\n \n \n \n \n \n NNegM15-19\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 15-19yrs\n \n \n \n \n \n NNegM20-24\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 20-24yrs\n \n \n \n \n \n NNegM25-29\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 25-29yrs\n \n \n \n \n \n NNegM30-34\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 30-34yrs\n \n \n \n \n \n NNegM35-39\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 35-39yrs\n \n \n \n \n \n NNegM40-44\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 40-44yrs\n \n \n \n \n \n NNegM45-49\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 45-49yrs\n \n \n \n \n \n NNegM5-9\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 05-09yrs\n \n \n \n \n \n NNegM50Plu\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 50Plus\n \n \n \n \n \n NNegM<1\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n Under1yr\n \n \n \n \n \n NPosF1-4\n \n \n \n \n \n \n \n \n \n NPosF10-14\n \n \n \n \n \n \n NPosF15-19\n \n \n \n \n \n \n NPosF20-24\n \n \n \n \n \n \n NPosF25-29\n \n \n \n \n \n \n NPosF30-34\n \n \n \n \n \n \n NPosF35-39\n \n \n \n \n \n \n NPosF40-44\n \n \n \n \n \n \n NPosF45-49\n \n \n \n \n \n \n NPosF5-9\n \n \n \n \n \n \n NPosF50Plu\n \n \n \n \n \n \n NPosF<1\n \n \n \n \n \n \n NPosM1-4\n \n \n \n \n \n \n NPosM10-14\n \n \n \n \n \n \n NPosM15-19\n \n \n \n \n \n \n NPosM20-24\n \n \n \n \n \n \n NPosM25-29\n \n \n \n \n \n \n NPosM30-34\n \n \n \n \n \n \n NPosM35-39\n \n \n \n \n \n \n NPosM40-44\n \n \n \n \n \n \n NPosM45-49\n \n \n \n \n \n \n NPosM5-9\n \n \n \n \n \n \n NPosM50Plu\n \n \n \n \n \n \n NPosM<1\n \n \n \n \n \n \n RNegF1-4\n \n \n \n \n \n \n \n \n \n RNegF10-14\n \n \n \n \n \n \n RNegF15-19\n \n \n \n \n \n \n RNegF20-24\n \n \n \n \n \n \n RNegF25-29\n \n \n \n \n \n \n RNegF30-34\n \n \n \n \n \n \n RNegF35-39\n \n \n \n \n \n \n RNegF40-44\n \n \n \n \n \n \n RNegF45-49\n \n \n \n \n \n \n RNegF5-9\n \n \n \n \n \n \n RNegF50Plu\n \n \n \n \n \n \n RNegF<1\n \n \n \n \n \n \n RNegM1-4\n \n \n \n \n \n \n RNegM10-14\n \n \n \n \n \n \n RNegM15-19\n \n \n \n \n \n \n RNegM20-24\n \n \n \n \n \n \n RNegM25-29\n \n \n \n \n \n \n RNegM30-34\n \n \n \n \n \n \n RNegM35-39\n \n \n \n \n \n \n RNegM40-44\n \n \n \n \n \n \n RNegM45-49\n \n \n \n \n \n \n RNegM5-9\n \n \n \n \n \n \n RNegM50Plu\n \n \n \n \n \n \n RNegM<1\n \n \n \n \n \n \n RPosF1-4\n \n \n \n \n \n \n \n \n \n RPosF10-14\n \n \n \n \n \n \n RPosF15-19\n \n \n \n \n \n \n RPosF20-24\n \n \n \n \n \n \n RPosF25-29\n \n \n \n \n \n \n RPosF30-34\n \n \n \n \n \n \n RPosF35-39\n \n \n \n \n \n \n RPosF40-44\n \n \n \n \n \n \n RPosF45-49\n \n \n \n \n \n \n RPosF5-9\n \n \n \n \n \n \n RPosF50Plu\n \n \n \n \n \n \n RPosF<1\n \n \n \n \n \n \n RPosM1-4\n \n \n \n \n \n \n RPosM10-14\n \n \n \n \n \n \n RPosM15-19\n \n \n \n \n \n \n RPosM20-24\n \n \n \n \n \n \n RPosM25-29\n \n \n \n \n \n \n RPosM30-34\n \n \n \n \n \n \n RPosM35-39\n \n \n \n \n \n \n RPosM40-44\n \n \n \n \n \n \n RPosM45-49\n \n \n \n \n \n \n RPosM5-9\n \n \n \n \n \n \n RPosM50Plu\n \n \n \n \n \n \n RPosM<1\n \n \n \n \n \n \n','2021-10-07 12:26:32',4,'2021-10-07 13:44:24',4,0,NULL,NULL,NULL,'48195b40-79bc-4e0e-8157-9001e4389381'),(1351,'CITC_HTS_ART','CITC_HTS_ART','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_HTS_ART\n CITC_HTS_ART\n \n 2021-10-07 13:58:15 UTC\n \n 2021-10-07 13:58:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1351\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2021-10-07 15:58:15',4,'2021-10-07 15:58:32',4,0,NULL,NULL,NULL,'9ee564ea-f127-40f9-89f3-e6d25a9382a2'),(1352,'CITC_HTS_ART Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_HTS_ART Data Set\n \n 2021-10-07 13:58:32 UTC\n \n 2021-10-07 20:54:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1352\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Finer_Age\n \n \n \n \n \n \n \n \n NNegF1-4\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 01-04yrs\n \n \n \n \n \n NNegF10-14\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 10-14yrs\n \n \n \n \n \n NNegF15-19\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 15-19yrs\n \n \n \n \n \n NNegF20-24\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 20-24yrs\n \n \n \n \n \n NNegF25-29\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 25-29yrs\n \n \n \n \n \n NNegF30-34\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 30-34yrs\n \n \n \n \n \n NNegF35-39\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 35-39yrs\n \n \n \n \n \n NNegF40-44\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 40-44yrs\n \n \n \n \n \n NNegF45-49\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 45-49yrs\n \n \n \n \n \n NNegF5-9\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 05-09yrs\n \n \n \n \n \n NNegF50Plu\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 50Plus\n \n \n \n \n \n NNegF<1\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n Under1yr\n \n \n \n \n \n NNegM1-4\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 01-04yrs\n \n \n \n \n \n NNegM10-14\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 10-14yrs\n \n \n \n \n \n NNegM15-19\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 15-19yrs\n \n \n \n \n \n NNegM20-24\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 20-24yrs\n \n \n \n \n \n NNegM25-29\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 25-29yrs\n \n \n \n \n \n NNegM30-34\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 30-34yrs\n \n \n \n \n \n NNegM35-39\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 35-39yrs\n \n \n \n \n \n NNegM40-44\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 40-44yrs\n \n \n \n \n \n NNegM45-49\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 45-49yrs\n \n \n \n \n \n NNegM5-9\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 05-09yrs\n \n \n \n \n \n NNegM50Plu\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 50Plus\n \n \n \n \n \n NNegM<1\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n Under1yr\n \n \n \n \n \n NPosF1-4\n \n \n \n \n \n \n \n \n \n NPosF10-14\n \n \n \n \n \n \n NPosF15-19\n \n \n \n \n \n \n NPosF20-24\n \n \n \n \n \n \n NPosF25-29\n \n \n \n \n \n \n NPosF30-34\n \n \n \n \n \n \n NPosF35-39\n \n \n \n \n \n \n NPosF40-44\n \n \n \n \n \n \n NPosF45-49\n \n \n \n \n \n \n NPosF5-9\n \n \n \n \n \n \n NPosF50Plu\n \n \n \n \n \n \n NPosF<1\n \n \n \n \n \n \n NPosM1-4\n \n \n \n \n \n \n NPosM10-14\n \n \n \n \n \n \n NPosM15-19\n \n \n \n \n \n \n NPosM20-24\n \n \n \n \n \n \n NPosM25-29\n \n \n \n \n \n \n NPosM30-34\n \n \n \n \n \n \n NPosM35-39\n \n \n \n \n \n \n NPosM40-44\n \n \n \n \n \n \n NPosM45-49\n \n \n \n \n \n \n NPosM5-9\n \n \n \n \n \n \n NPosM50Plu\n \n \n \n \n \n \n NPosM<1\n \n \n \n \n \n \n RNegF1-4\n \n \n \n \n \n \n \n \n \n RNegF10-14\n \n \n \n \n \n \n RNegF15-19\n \n \n \n \n \n \n RNegF20-24\n \n \n \n \n \n \n RNegF25-29\n \n \n \n \n \n \n RNegF30-34\n \n \n \n \n \n \n RNegF35-39\n \n \n \n \n \n \n RNegF40-44\n \n \n \n \n \n \n RNegF45-49\n \n \n \n \n \n \n RNegF5-9\n \n \n \n \n \n \n RNegF50Plu\n \n \n \n \n \n \n RNegF<1\n \n \n \n \n \n \n \n \n \n RNegM1-4\n \n \n \n \n \n \n RNegM10-14\n \n \n \n \n \n \n RNegM15-19\n \n \n \n \n \n \n RNegM20-24\n \n \n \n \n \n \n RNegM25-29\n \n \n \n \n \n \n RNegM30-34\n \n \n \n \n \n \n RNegM35-39\n \n \n \n \n \n \n RNegM40-44\n \n \n \n \n \n \n RNegM45-49\n \n \n \n \n \n \n RNegM5-9\n \n \n \n \n \n \n RNegM50Plu\n \n \n \n \n \n \n RNegM<1\n \n \n \n \n \n \n RPosF1-4\n \n \n \n \n \n \n RPosF10-14\n \n \n \n \n \n \n RPosF15-19\n \n \n \n \n \n \n RPosF20-24\n \n \n \n \n \n \n RPosF25-29\n \n \n \n \n \n \n RPosF30-34\n \n \n \n \n \n \n RPosF35-39\n \n \n \n \n \n \n RPosF40-44\n \n \n \n \n \n \n RPosF45-49\n \n \n \n \n \n \n RPosF5-9\n \n \n \n \n \n \n RPosF50Plu\n \n \n \n \n \n \n RPosF<1\n \n \n \n \n \n \n RPosM1-4\n \n \n \n \n \n \n RPosM10-14\n \n \n \n \n \n \n RPosM15-19\n \n \n \n \n \n \n RPosM20-24\n \n \n \n \n \n \n RPosM25-29\n \n \n \n \n \n \n RPosM30-34\n \n \n \n \n \n \n RPosM35-39\n \n \n \n \n \n \n RPosM40-44\n \n \n \n \n \n \n RPosM45-49\n \n \n \n \n \n \n RPosM5-9\n \n \n \n \n \n \n RPosM50Plu\n \n \n \n \n \n \n RPosM<1\n \n \n \n \n \n \n','2021-10-07 15:58:32',4,'2021-10-07 22:54:11',4,0,NULL,NULL,NULL,'068e94f1-8873-42de-a660-d8f239c4858c'),(1353,'CITC_New_Neg_ART','CITC_New_Neg_ART','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_New_Neg_ART\n CITC_New_Neg_ART\n \n 2021-10-07 13:59:29 UTC\n \n 2021-10-07 14:02:13 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1353\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-07 15:59:29',4,'2021-10-07 16:02:13',4,0,NULL,NULL,NULL,'8d97fedb-8b2e-4a68-8adb-82f0f4a9add9'),(1354,'CITC_New_Pos_ART','CITC_New_Pos_ART','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_New_Pos_ART\n CITC_New_Pos_ART\n \n 2021-10-07 13:59:52 UTC\n \n 2021-10-07 14:02:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1354\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-07 15:59:52',4,'2021-10-07 16:02:30',4,0,NULL,NULL,NULL,'dacc0b51-b2c6-42c8-a9d8-22751d857b0f'),(1355,'CITC_Repeat_Pos_ART','CITC_Repeat_Pos_ART','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_Repeat_Pos_ART\n CITC_Repeat_Pos_ART\n \n 2021-10-07 14:00:29 UTC\n \n 2021-10-07 14:03:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1355\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-07 16:00:29',4,'2021-10-07 16:03:06',4,0,NULL,NULL,NULL,'0e5f59f7-089a-4da2-9592-fd5d7b2e3160'),(1356,'CITC_Repeat_Neg_ART','CITC_Repeat_Neg_ART','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_Repeat_Neg_ART\n CITC_Repeat_Neg_ART\n \n 2021-10-07 14:01:00 UTC\n \n 2021-10-07 14:02:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1356\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-07 16:01:00',4,'2021-10-07 16:02:53',4,0,NULL,NULL,NULL,'df3ebc14-329c-41a7-b8d7-e2be98f7ce77'),(1357,'PITC_New_Neg_SelfTest','PITC_New_Neg_SelfTest','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_New_Neg_SelfTest\n PITC_New_Neg_SelfTest\n \n 2021-10-07 20:57:55 UTC\n \n 2021-10-07 21:01:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1357\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-07 22:57:55',4,'2021-10-07 23:01:55',4,0,NULL,NULL,NULL,'69df4bb7-ba58-44b6-ba62-5a4f7890b8f1'),(1358,'PITC_New_Pos_SelfTest','PITC_New_Pos_SelfTest','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_New_Pos_SelfTest\n PITC_New_Pos_SelfTest\n \n 2021-10-07 20:58:22 UTC\n \n 2021-10-07 21:02:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1358\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-07 22:58:22',4,'2021-10-07 23:02:12',4,0,NULL,NULL,NULL,'e826a2b0-18e7-4996-8f74-1db38549a861'),(1359,'PITC_Repeat_Neg_SelfTest','PITC_Repeat_Neg_SelfTest','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_Repeat_Neg_SelfTest\n PITC_Repeat_Neg_SelfTest\n \n 2021-10-07 20:59:27 UTC\n \n 2021-10-07 21:02:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1359\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-07 22:59:27',4,'2021-10-07 23:02:31',4,0,NULL,NULL,NULL,'0db20958-582a-4b50-ba86-49b9ef0f64e7'),(1360,'PITC_Repeat_Pos_SelfTest','PITC_Repeat_Pos_SelfTest','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_Repeat_Pos_SelfTest\n PITC_Repeat_Pos_SelfTest\n \n 2021-10-07 20:59:42 UTC\n \n 2021-10-07 21:02:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1360\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-07 22:59:42',4,'2021-10-07 23:02:45',4,0,NULL,NULL,NULL,'3708255a-1b1a-421d-a0f1-838a320fa6f4'),(1361,'PITC_HTS_SelfTest','HTS Report for Self Test Clients','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_HTS_SelfTest\n HTS Report for Self Test Clients\n \n 2021-10-07 21:05:37 UTC\n \n 2021-10-07 21:05:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1361\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2021-10-07 23:05:37',4,'2021-10-07 23:05:45',4,0,NULL,NULL,NULL,'b61f2060-1d4b-4bd7-af32-67db98d50032'),(1362,'PITC_HTS_SelfTest Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_HTS_SelfTest Data Set\n \n 2021-10-07 21:05:45 UTC\n \n 2021-10-11 20:55:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1362\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Finer_Age\n \n \n \n \n \n \n \n \n NNegF1-4\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 01-04yrs\n \n \n \n \n \n NNegF10-14\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 10-14yrs\n \n \n \n \n \n NNegF15-19\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 15-19yrs\n \n \n \n \n \n NNegF20-24\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 20-24yrs\n \n \n \n \n \n NNegF25-29\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 25-29yrs\n \n \n \n \n \n NNegF30-34\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 30-34yrs\n \n \n \n \n \n NNegF35-39\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 35-39yrs\n \n \n \n \n \n NNegF40-44\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 40-44yrs\n \n \n \n \n \n NNegF45-49\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 45-49yrs\n \n \n \n \n \n NNegF5-9\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 05-09yrs\n \n \n \n \n \n NNegF50Plu\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 50Plus\n \n \n \n \n \n NNegF<1\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n Under1yr\n \n \n \n \n \n NNegM1-4\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 01-04yrs\n \n \n \n \n \n NNegM10-14\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 10-14yrs\n \n \n \n \n \n NNegM15-19\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 15-19yrs\n \n \n \n \n \n NNegM20-24\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 20-24yrs\n \n \n \n \n \n NNegM25-29\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 25-29yrs\n \n \n \n \n \n NNegM30-34\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 30-34yrs\n \n \n \n \n \n NNegM35-39\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 35-39yrs\n \n \n \n \n \n NNegM40-44\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 40-44yrs\n \n \n \n \n \n NNegM45-49\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 45-49yrs\n \n \n \n \n \n NNegM5-9\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 05-09yrs\n \n \n \n \n \n NNegM50Plu\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 50Plus\n \n \n \n \n \n NNegM<1\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n Under1yr\n \n \n \n \n \n NPosF1-4\n \n \n \n \n \n \n \n \n \n NPosF10-14\n \n \n \n \n \n \n NPosF15-19\n \n \n \n \n \n \n NPosF20-24\n \n \n \n \n \n \n NPosF25-29\n \n \n \n \n \n \n NPosF30-34\n \n \n \n \n \n \n NPosF35-39\n \n \n \n \n \n \n NPosF40-44\n \n \n \n \n \n \n NPosF45-49\n \n \n \n \n \n \n NPosF5-9\n \n \n \n \n \n \n NPosF50Plu\n \n \n \n \n \n \n NPosF<1\n \n \n \n \n \n \n NPosM1-4\n \n \n \n \n \n \n NPosM10-14\n \n \n \n \n \n \n NPosM15-19\n \n \n \n \n \n \n NPosM20-24\n \n \n \n \n \n \n NPosM25-29\n \n \n \n \n \n \n NPosM30-34\n \n \n \n \n \n \n NPosM35-39\n \n \n \n \n \n \n NPosM40-44\n \n \n \n \n \n \n NPosM45-49\n \n \n \n \n \n \n NPosM5-9\n \n \n \n \n \n \n NPosM50Plu\n \n \n \n \n \n \n NPosM<1\n \n \n \n \n \n \n RNegF1-4\n \n \n \n \n \n \n \n \n \n RNegF10-14\n \n \n \n \n \n \n RNegF15-19\n \n \n \n \n \n \n RNegF20-24\n \n \n \n \n \n \n RNegF25-29\n \n \n \n \n \n \n RNegF30-34\n \n \n \n \n \n \n RNegF35-39\n \n \n \n \n \n \n RNegF40-44\n \n \n \n \n \n \n RNegF45-49\n \n \n \n \n \n \n RNegF5-9\n \n \n \n \n \n \n RNegF50Plu\n \n \n \n \n \n \n RNegF<1\n \n \n \n \n \n \n RNegM1-4\n \n \n \n \n \n \n RNegM10-14\n \n \n \n \n \n \n RNegM15-19\n \n \n \n \n \n \n RNegM20-24\n \n \n \n \n \n \n RNegM25-29\n \n \n \n \n \n \n RNegM30-34\n \n \n \n \n \n \n RNegM35-39\n \n \n \n \n \n \n RNegM40-44\n \n \n \n \n \n \n RNegM45-49\n \n \n \n \n \n \n RNegM5-9\n \n \n \n \n \n \n RNegM50Plu\n \n \n \n \n \n \n RNegM<1\n \n \n \n \n \n \n RPosF1-4\n \n \n \n \n \n \n \n \n \n RPosF10-14\n \n \n \n \n \n \n RPosF15-19\n \n \n \n \n \n \n RPosF20-24\n \n \n \n \n \n \n RPosF25-29\n \n \n \n \n \n \n RPosF30-34\n \n \n \n \n \n \n RPosF35-39\n \n \n \n \n \n \n RPosF40-44\n \n \n \n \n \n \n RPosF45-49\n \n \n \n \n \n \n RPosF5-9\n \n \n \n \n \n \n RPosF50Plu\n \n \n \n \n \n \n RPosF<1\n \n \n \n \n \n \n RPosM1-4\n \n \n \n \n \n \n RPosM10-14\n \n \n \n \n \n \n RPosM15-19\n \n \n \n \n \n \n RPosM20-24\n \n \n \n \n \n \n RPosM25-29\n \n \n \n \n \n \n RPosM30-34\n \n \n \n \n \n \n RPosM35-39\n \n \n \n \n \n \n RPosM40-44\n \n \n \n \n \n \n RPosM45-49\n \n \n \n \n \n \n RPosM5-9\n \n \n \n \n \n \n RPosM50Plu\n \n \n \n \n \n \n RPosM<1\n \n \n \n \n \n \n','2021-10-07 23:05:45',4,'2021-10-11 22:55:42',4,0,NULL,NULL,NULL,'8e37cf0b-426f-41d1-b2f6-c2a2fc4ca11b'),(1363,' CITC_New_Neg_SelfTest',' CITC_New_Neg_SelfTest','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_New_Neg_SelfTest\n CITC_New_Neg_SelfTest\n \n 2021-10-07 21:50:17 UTC\n \n 2021-10-07 21:53:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1363\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-07 23:50:17',4,'2021-10-07 23:53:11',4,0,NULL,NULL,NULL,'4f421a8f-f47c-4c7c-b9ee-645c7598c190'),(1364,' CITC_New_Pos_SelfTest',' CITC_New_Pos_SelfTest','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_New_Pos_SelfTest\n CITC_New_Pos_SelfTest\n \n 2021-10-07 21:50:51 UTC\n \n 2021-10-07 21:53:24 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1364\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-07 23:50:51',4,'2021-10-07 23:53:24',4,0,NULL,NULL,NULL,'b0c652de-795a-49ea-8174-ad6f6876657d'),(1365,' CITC_Repeat_Neg_SelfTest',' CITC_Repeat_Neg_SelfTest','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_Repeat_Neg_SelfTest\n CITC_Repeat_Neg_SelfTest\n \n 2021-10-07 21:51:38 UTC\n \n 2021-10-07 21:53:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1365\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-07 23:51:38',4,'2021-10-07 23:53:44',4,0,NULL,NULL,NULL,'e2d26faf-850c-47a9-929d-2d083f7e8493'),(1366,' CITC_Repeat_Pos_SelfTest',' CITC_Repeat_Pos_SelfTest','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_Repeat_Pos_SelfTest\n CITC_Repeat_Pos_SelfTest\n \n 2021-10-07 21:51:56 UTC\n \n 2021-10-07 21:56:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1366\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-07 23:51:56',4,'2021-10-07 23:56:36',4,0,NULL,NULL,NULL,'8a73a6fd-b0fe-47f7-b291-63dd42af9ada'),(1367,'CITC_HTS_SelfTest','CITC_HTS_SelfTest','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_HTS_SelfTest\n CITC_HTS_SelfTest\n \n 2021-10-07 21:57:35 UTC\n \n 2021-10-07 21:57:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1367\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2021-10-07 23:57:35',4,'2021-10-07 23:57:43',4,0,NULL,NULL,NULL,'bebe6363-836b-48d2-9803-c0e626cb50aa'),(1368,'CITC_HTS_SelfTest Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_HTS_SelfTest Data Set\n \n 2021-10-07 21:57:43 UTC\n \n 2021-10-08 12:58:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1368\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Finer_Age\n \n \n \n \n \n \n \n \n NNegF1-4\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 01-04yrs\n \n \n \n \n \n NNegF10-14\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 10-14yrs\n \n \n \n \n \n NNegF15-19\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 15-19yrs\n \n \n \n \n \n NNegF20-24\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 20-24yrs\n \n \n \n \n \n NNegF25-29\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 25-29yrs\n \n \n \n \n \n NNegF30-34\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 30-34yrs\n \n \n \n \n \n NNegF35-39\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 35-39yrs\n \n \n \n \n \n NNegF40-44\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 40-44yrs\n \n \n \n \n \n NNegF45-49\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 45-49yrs\n \n \n \n \n \n NNegF5-9\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 05-09yrs\n \n \n \n \n \n NNegF50Plu\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 50Plus\n \n \n \n \n \n NNegF<1\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n Under1yr\n \n \n \n \n \n NNegM1-4\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 01-04yrs\n \n \n \n \n \n NNegM10-14\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 10-14yrs\n \n \n \n \n \n NNegM15-19\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 15-19yrs\n \n \n \n \n \n NNegM20-24\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 20-24yrs\n \n \n \n \n \n NNegM25-29\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 25-29yrs\n \n \n \n \n \n NNegM30-34\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 30-34yrs\n \n \n \n \n \n NNegM35-39\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 35-39yrs\n \n \n \n \n \n NNegM40-44\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 40-44yrs\n \n \n \n \n \n NNegM45-49\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 45-49yrs\n \n \n \n \n \n NNegM5-9\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 05-09yrs\n \n \n \n \n \n NNegM50Plu\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 50Plus\n \n \n \n \n \n NNegM<1\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n Under1yr\n \n \n \n \n \n NPosF1-4\n \n \n \n \n \n \n \n \n \n NPosF10-14\n \n \n \n \n \n \n NPosF15-19\n \n \n \n \n \n \n NPosF20-24\n \n \n \n \n \n \n NPosF25-29\n \n \n \n \n \n \n NPosF30-34\n \n \n \n \n \n \n NPosF35-39\n \n \n \n \n \n \n NPosF40-44\n \n \n \n \n \n \n NPosF45-49\n \n \n \n \n \n \n NPosF5-9\n \n \n \n \n \n \n NPosF50Plu\n \n \n \n \n \n \n NPosF<1\n \n \n \n \n \n \n NPosM1-4\n \n \n \n \n \n \n NPosM10-14\n \n \n \n \n \n \n NPosM15-19\n \n \n \n \n \n \n NPosM20-24\n \n \n \n \n \n \n NPosM25-29\n \n \n \n \n \n \n NPosM30-34\n \n \n \n \n \n \n NPosM35-39\n \n \n \n \n \n \n NPosM40-44\n \n \n \n \n \n \n NPosM45-49\n \n \n \n \n \n \n NPosM5-9\n \n \n \n \n \n \n NPosM50Plu\n \n \n \n \n \n \n NPosM<1\n \n \n \n \n \n \n RNegF1-4\n \n \n \n \n \n \n \n \n \n RNegF10-14\n \n \n \n \n \n \n RNegF15-19\n \n \n \n \n \n \n RNegF20\n \n \n \n \n \n \n RNegF25-29\n \n \n \n \n \n \n RNegF30-34\n \n \n \n \n \n \n RNegF35-39\n \n \n \n \n \n \n RNegF40-44\n \n \n \n \n \n \n RNegF45-49\n \n \n \n \n \n \n RNegF5-9\n \n \n \n \n \n \n RNegF50Plu\n \n \n \n \n \n \n RNegF<1\n \n \n \n \n \n \n RNegM1-4\n \n \n \n \n \n \n RNegM10-14\n \n \n \n \n \n \n RNegM15-19\n \n \n \n \n \n \n RNegM20-24\n \n \n \n \n \n \n RNegM25-29\n \n \n \n \n \n \n RNegM30-34\n \n \n \n \n \n \n RNegM35-39\n \n \n \n \n \n \n RNegM40-44\n \n \n \n \n \n \n RNegM45-49\n \n \n \n \n \n \n RNegM5-9\n \n \n \n \n \n \n RNegM50Plu\n \n \n \n \n \n \n RNegM<1\n \n \n \n \n \n \n RPosF1-4\n \n \n \n \n \n \n \n \n \n RPosF10-14\n \n \n \n \n \n \n RPosF15-19\n \n \n \n \n \n \n RPosF20-24\n \n \n \n \n \n \n RPosF25-29\n \n \n \n \n \n \n RPosF30-34\n \n \n \n \n \n \n RPosF35-39\n \n \n \n \n \n \n RPosF40-44\n \n \n \n \n \n \n RPosF45-49\n \n \n \n \n \n \n RPosF5-9\n \n \n \n \n \n \n RPosF50Plu\n \n \n \n \n \n \n RPosF<1\n \n \n \n \n \n \n RPosM1-4\n \n \n \n \n \n \n RPosM10-14\n \n \n \n \n \n \n RPosM15-19\n \n \n \n \n \n \n RPosM20-24\n \n \n \n \n \n \n RPosM25-29\n \n \n \n \n \n \n RPosM30-34\n \n \n \n \n \n \n RPosM35-39\n \n \n \n \n \n \n RPosM40-44\n \n \n \n \n \n \n RPosM45-49\n \n \n \n \n \n \n RPosM5-9\n \n \n \n \n \n \n RPosM50Plu\n \n \n \n \n \n \n RPosM<1\n \n \n \n \n \n \n','2021-10-07 23:57:43',4,'2021-10-08 14:58:31',4,0,NULL,NULL,NULL,'a4a5bca8-1758-4080-a156-a84df7a62c29'),(1369,'PITC_New_Neg_VMMC','PITC_New_Neg_VMMC','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_New_Neg_VMMC\n PITC_New_Neg_VMMC\n \n 2021-10-08 13:02:52 UTC\n \n 2021-10-08 13:05:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1369\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-08 15:02:52',4,'2021-10-08 15:05:39',4,0,NULL,NULL,NULL,'d7fc1236-45c7-43d2-9333-bf39b31047a6'),(1370,'PITC_New_Pos_VMMC','PITC_New_Pos_VMMC','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_New_Pos_VMMC\n PITC_New_Pos_VMMC\n \n 2021-10-08 13:03:05 UTC\n \n 2021-10-08 13:06:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1370\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-08 15:03:05',4,'2021-10-08 15:06:03',4,0,NULL,NULL,NULL,'82030723-8eb6-48ab-aaaf-0b747daaff1c'),(1371,'PITC_Repeat_Pos_VMMC','PITC_Repeat_Pos_VMMC','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_Repeat_Pos_VMMC\n PITC_Repeat_Pos_VMMC\n \n 2021-10-08 13:03:43 UTC\n \n 2021-10-08 13:06:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1371\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-08 15:03:43',4,'2021-10-08 15:06:32',4,0,NULL,NULL,NULL,'ab25dc35-65f6-444d-82a0-71167a014c3b'),(1372,'PITC_Repeat_Neg_VMMC','PITC_Repeat_Neg_VMMC','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_Repeat_Neg_VMMC\n PITC_Repeat_Neg_VMMC\n \n 2021-10-08 13:04:03 UTC\n \n 2021-10-08 13:06:22 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1372\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-08 15:04:03',4,'2021-10-08 15:06:22',4,0,NULL,NULL,NULL,'236df974-039e-411b-9ce8-09e74f743950'),(1373,'PITC_HTS_VMMC','PITC_HTS_VMMC','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_HTS_VMMC\n PITC_HTS_VMMC\n \n 2021-10-08 13:07:49 UTC\n \n 2021-10-08 13:08:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1373\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2021-10-08 15:07:49',4,'2021-10-08 15:08:14',4,0,NULL,NULL,NULL,'a58c74c3-1edc-4d4b-8ac2-0ce3e4839c7d'),(1374,'PITC_HTS_VMMC Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_HTS_VMMC Data Set\n \n 2021-10-08 13:08:14 UTC\n \n 2021-10-09 23:08:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1374\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Finer_Age\n \n \n \n \n \n \n \n \n NNegF1-4\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 01-04yrs\n \n \n \n \n \n NNegF10-14\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 10-14yrs\n \n \n \n \n \n NNegF15-19\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 15-19yrs\n \n \n \n \n \n NNegF20-24\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 20-24yrs\n \n \n \n \n \n NNegF25-29\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 25-29yrs\n \n \n \n \n \n NNegF30-34\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 30-34yrs\n \n \n \n \n \n NNegF35-39\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 35-39yrs\n \n \n \n \n \n NNegF40-44\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 40-44yrs\n \n \n \n \n \n NNegF45-49\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 45-49yrs\n \n \n \n \n \n NNegF5-9\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 05-09yrs\n \n \n \n \n \n NNegF50Plu\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 50Plus\n \n \n \n \n \n NNegF<1\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n Under1yr\n \n \n \n \n \n NNegM1-4\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 01-04yrs\n \n \n \n \n \n NNegM10-14\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 10-14yrs\n \n \n \n \n \n NNegM15-19\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 15-19yrs\n \n \n \n \n \n NNegM20-24\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 20-24yrs\n \n \n \n \n \n NNegM25-29\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 25-29yrs\n \n \n \n \n \n NNegM30-34\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 30-34yrs\n \n \n \n \n \n NNegM35-39\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 35-39yrs\n \n \n \n \n \n NNegM40-44\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 40-44yrs\n \n \n \n \n \n NNegM45-49\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 45-49yrs\n \n \n \n \n \n NNegM5-9\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 05-09yrs\n \n \n \n \n \n NNegM50Plu\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 50Plus\n \n \n \n \n \n NNegM<1\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n Under1yr\n \n \n \n \n \n NPosF1-4\n \n \n \n \n \n \n \n \n \n NPosF10-14\n \n \n \n \n \n \n NPosF15-19\n \n \n \n \n \n \n NPosF20-24\n \n \n \n \n \n \n NPosF25-29\n \n \n \n \n \n \n NPosF30-34\n \n \n \n \n \n \n NPosF35-39\n \n \n \n \n \n \n NPosF40-44\n \n \n \n \n \n \n NPosF45-49\n \n \n \n \n \n \n NPosF5-9\n \n \n \n \n \n \n NPosF50Plu\n \n \n \n \n \n \n NPosF<1\n \n \n \n \n \n \n NPosM1-4\n \n \n \n \n \n \n NPosM10-14\n \n \n \n \n \n \n NPosM15-19\n \n \n \n \n \n \n NPosM20-24\n \n \n \n \n \n \n NPosM25-29\n \n \n \n \n \n \n NPosM30-34\n \n \n \n \n \n \n NPosM35-39\n \n \n \n \n \n \n NPosM40-44\n \n \n \n \n \n \n NPosM45-49\n \n \n \n \n \n \n NPosM5-9\n \n \n \n \n \n \n NPosM50Plu\n \n \n \n \n \n \n NPosM<1\n \n \n \n \n \n \n RNegF1-4\n \n \n \n \n \n \n \n \n \n RNegF10-14\n \n \n \n \n \n \n RNegF15-19\n \n \n \n \n \n \n RNegF20-24\n \n \n \n \n \n \n RNegF25-29\n \n \n \n \n \n \n RNegF30-34\n \n \n \n \n \n \n RNegF35-39\n \n \n \n \n \n \n RNegF40-44\n \n \n \n \n \n \n RNegF45-49\n \n \n \n \n \n \n RNegF5-9\n \n \n \n \n \n \n RNegF50Plu\n \n \n \n \n \n \n RNegF<1\n \n \n \n \n \n \n RNegM1-4\n \n \n \n \n \n \n RNegM10-14\n \n \n \n \n \n \n RNegM15-19\n \n \n \n \n \n \n RNegM20-24\n \n \n \n \n \n \n RNegM25-29\n \n \n \n \n \n \n RNegM30-34\n \n \n \n \n \n \n RNegM35-39\n \n \n \n \n \n \n RNegM40-44\n \n \n \n \n \n \n RNegM45-49\n \n \n \n \n \n \n RNegM5-9\n \n \n \n \n \n \n RNegM50Plu\n \n \n \n \n \n \n RNegM<1\n \n \n \n \n \n \n RPosF1-4\n \n \n \n \n \n \n \n \n \n RPosF10-14\n \n \n \n \n \n \n RPosF15-19\n \n \n \n \n \n \n RPosF20-24\n \n \n \n \n \n \n RPosF25-29\n \n \n \n \n \n \n RPosF30-34\n \n \n \n \n \n \n RPosF35-39\n \n \n \n \n \n \n RPosF40-44\n \n \n \n \n \n \n RPosF45-49\n \n \n \n \n \n \n RPosF5-9\n \n \n \n \n \n \n RPosF50Plu\n \n \n \n \n \n \n RPosF<1\n \n \n \n \n \n \n RPosM1-4\n \n \n \n \n \n \n RPosM10-14\n \n \n \n \n \n \n RPosM15-19\n \n \n \n \n \n \n RPosM20-24\n \n \n \n \n \n \n RPosM25-29\n \n \n \n \n \n \n RPosM30-34\n \n \n \n \n \n \n RPosM35-39\n \n \n \n \n \n \n RPosM40-44\n \n \n \n \n \n \n RPosM45-49\n \n \n \n \n \n \n RPosM5-9\n \n \n \n \n \n \n RPosM50Plu\n \n \n \n \n \n \n RPosM<1\n \n \n \n \n \n \n','2021-10-08 15:08:14',4,'2021-10-10 01:08:00',4,0,NULL,NULL,NULL,'43f1ef2d-1b0d-46cf-96d3-f357f2d893ab'),(1375,'CITC_New_Neg_VMMC','CITC_New_Neg_VMMC','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_New_Neg_VMMC\n CITC_New_Neg_VMMC\n \n 2021-10-09 22:54:44 UTC\n \n 2021-10-09 22:59:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1375\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-10 00:54:44',4,'2021-10-10 00:59:55',4,0,NULL,NULL,NULL,'e735dc8b-4e55-46b0-98be-9d35609cdcd1'),(1376,'CITC_New_Pos_VMMC','CITC_New_Pos_VMMC','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_New_Pos_VMMC\n CITC_New_Pos_VMMC\n \n 2021-10-09 22:54:57 UTC\n \n 2021-10-09 23:00:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1376\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-10 00:54:57',4,'2021-10-10 01:00:23',4,0,NULL,NULL,NULL,'33e10e5c-b210-4364-bb0a-834ef9fef156'),(1377,'CITC_Repeat_Neg_VMMC','CITC_Repeat_Neg_VMMC','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_Repeat_Neg_VMMC\n CITC_Repeat_Neg_VMMC\n \n 2021-10-09 22:55:46 UTC\n \n 2021-10-09 23:00:47 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1377\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-10 00:55:46',4,'2021-10-10 01:00:47',4,0,NULL,NULL,NULL,'787c96e2-053c-4c5a-bac9-e6b2cdc11b3b'),(1378,'CITC_Repeat_Pos_VMMC','CITC_Repeat_Pos_VMMC','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_Repeat_Pos_VMMC\n CITC_Repeat_Pos_VMMC\n \n 2021-10-09 22:56:57 UTC\n \n 2021-10-09 23:02:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1378\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-10 00:56:57',4,'2021-10-10 01:02:21',4,0,NULL,NULL,NULL,'abbf2da2-d3f1-4ec4-bcf6-bc4f172771c2'),(1379,'CITC_HTS_VMMC','CITC_HTS_VMMC','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_HTS_VMMC\n CITC_HTS_VMMC\n \n 2021-10-09 23:06:10 UTC\n \n 2021-10-09 23:06:57 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1379\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2021-10-10 01:06:10',4,'2021-10-10 01:06:57',4,0,NULL,NULL,NULL,'893154ae-6213-4759-aaad-6662e595eabe'),(1380,'CITC_HTS_VMMC Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_HTS_VMMC Data Set\n \n 2021-10-09 23:06:57 UTC\n \n 2021-10-10 22:32:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1380\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Finer_Age\n \n \n \n \n \n \n \n \n NNegF1-4\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 01-04yrs\n \n \n \n \n \n NNegF10-14\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 10-14yrs\n \n \n \n \n \n NNegF15-19\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 15-19yrs\n \n \n \n \n \n NNegF20-24\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 20-24yrs\n \n \n \n \n \n NNegF25-29\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 25-29yrs\n \n \n \n \n \n NNegF30-34\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 30-34yrs\n \n \n \n \n \n NNegF35-39\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 35-39yrs\n \n \n \n \n \n NNegF40-44\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 40-44yrs\n \n \n \n \n \n NNegF45-49\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 45-49yrs\n \n \n \n \n \n NNegF5-9\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 05-09yrs\n \n \n \n \n \n NNegF50Plu\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 50Plus\n \n \n \n \n \n NNegF<1\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n Under1yr\n \n \n \n \n \n NNegM1-4\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 01-04yrs\n \n \n \n \n \n NNegM10-14\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 10-14yrs\n \n \n \n \n \n NNegM15-19\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 15-19yrs\n \n \n \n \n \n NNegM20-24\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 20-24yrs\n \n \n \n \n \n NNegM25-29\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 25-29yrs\n \n \n \n \n \n NNegM30-34\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 30-34yrs\n \n \n \n \n \n NNegM35-39\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 35-39yrs\n \n \n \n \n \n NNegM40-44\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 40-44yrs\n \n \n \n \n \n NNegM45-49\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 45-49yrs\n \n \n \n \n \n NNegM5-9\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 05-09yrs\n \n \n \n \n \n NNegM50Plu\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 50Plus\n \n \n \n \n \n NNegM<1\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n Under1yr\n \n \n \n \n \n NPosF1-4\n \n \n \n \n \n \n \n \n \n NPosF10-14\n \n \n \n \n \n \n NPosF15-19\n \n \n \n \n \n \n NPosF20-24\n \n \n \n \n \n \n NPosF25-29\n \n \n \n \n \n \n NPosF30-34\n \n \n \n \n \n \n NPosF35-39\n \n \n \n \n \n \n NPosF40-44\n \n \n \n \n \n \n NPosF45-49\n \n \n \n \n \n \n NPosF5-9\n \n \n \n \n \n \n NPosF50Plu\n \n \n \n \n \n \n NPosF<1\n \n \n \n \n \n \n NPosM1-4\n \n \n \n \n \n \n NPosM10-14\n \n \n \n \n \n \n NPosM15-19\n \n \n \n \n \n \n NPosM20-24\n \n \n \n \n \n \n NPosM25-29\n \n \n \n \n \n \n NPosM30-34\n \n \n \n \n \n \n NPosM35-39\n \n \n \n \n \n \n NPosM40-44\n \n \n \n \n \n \n NPosM45-49\n \n \n \n \n \n \n NPosM5-9\n \n \n \n \n \n \n NPosM50Plu\n \n \n \n \n \n \n NPosM<1\n \n \n \n \n \n \n RNegF1-4\n \n \n \n \n \n \n \n \n \n RNegF10-14\n \n \n \n \n \n \n RNegF15-19\n \n \n \n \n \n \n RNegF20-24\n \n \n \n \n \n \n RNegF25-29\n \n \n \n \n \n \n RNegF30-34\n \n \n \n \n \n \n RNegF35-39\n \n \n \n \n \n \n RNegF40-44\n \n \n \n \n \n \n RNegF45-49\n \n \n \n \n \n \n RNegF5-9\n \n \n \n \n \n \n RNegF50Plu\n \n \n \n \n \n \n RNegF<1\n \n \n \n \n \n \n RNegM1-4\n \n \n \n \n \n \n RNegM10-14\n \n \n \n \n \n \n RNegM15-19\n \n \n \n \n \n \n RNegM20-24\n \n \n \n \n \n \n RNegM25-29\n \n \n \n \n \n \n RNegM30-34\n \n \n \n \n \n \n RNegM35-39\n \n \n \n \n \n \n RNegM40-44\n \n \n \n \n \n \n RNegM45-49\n \n \n \n \n \n \n RNegM5-9\n \n \n \n \n \n \n RNegM50Plu\n \n \n \n \n \n \n RNegM<1\n \n \n \n \n \n \n RPosF1-4\n \n \n \n \n \n \n \n \n \n RPosF10-14\n \n \n \n \n \n \n RPosF15-19\n \n \n \n \n \n \n RPosF20-24\n \n \n \n \n \n \n RPosF25-29\n \n \n \n \n \n \n RPosF30-34\n \n \n \n \n \n \n RPosF35-39\n \n \n \n \n \n \n RPosF40-44\n \n \n \n \n \n \n RPosF45-49\n \n \n \n \n \n \n RPosF5-9\n \n \n \n \n \n \n RPosF50Plu\n \n \n \n \n \n \n RPosF<1\n \n \n \n \n \n \n RPosM1-4\n \n \n \n \n \n \n RPosM10-14\n \n \n \n \n \n \n RPosM15-19\n \n \n \n \n \n \n RPosM20-24\n \n \n \n \n \n \n RPosM25-29\n \n \n \n \n \n \n RPosM30-34\n \n \n \n \n \n \n RPosM35-39\n \n \n \n \n \n \n RPosM40-44\n \n \n \n \n \n \n RPosM45-49\n \n \n \n \n \n \n RPosM5-9\n \n \n \n \n \n \n RPosM50Plu\n \n \n \n \n \n \n RPosM<1\n \n \n \n \n \n \n','2021-10-10 01:06:57',4,'2021-10-11 00:32:14',4,0,NULL,NULL,NULL,'03501008-0bd0-444d-9563-ccbc878fa540'),(1381,'Missed Appointments Under 28 Days Quarterly','Missed Appointments Under 28 Days for quarterly reporting','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Missed Appointments Under 28 Days Quarterly\n Missed Appointments Under 28 Days for quarterly reporting\n \n 2021-11-24 11:15:40 UTC\n \n 2021-11-24 12:16:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1381\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2021-11-24 13:15:40',4,'2021-11-24 14:16:41',4,0,NULL,NULL,NULL,'a8c08a78-5ad7-47d0-a164-32023f01d8c3'),(1382,'Missed Under 28 Days Quarterly Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Missed Under 28 Days Quarterly Data Set\n \n 2021-11-24 11:15:50 UTC\n \n 2021-11-24 11:36:46 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1382\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Finer_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n MissedF1-4\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 01-04yrs\n \n \n \n \n \n MissedF10-\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 10-14yrs\n \n \n \n \n \n MissedF15-\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 15-19yrs\n \n \n \n \n \n MissedF20-\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 20-24yrs\n \n \n \n \n \n MissedF25-\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 25-29yrs\n \n \n \n \n \n MissedF30-\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 30-34yrs\n \n \n \n \n \n MissedF35-\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 35-39yrs\n \n \n \n \n \n MissedF40-\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 40-44yrs\n \n \n \n \n \n MissedF45-\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 45-49yrs\n \n \n \n \n \n MissedF5-9\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 05-09yrs\n \n \n \n \n \n MissedF50P\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 50Plus\n \n \n \n \n \n MissedF<1\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n Under1yr\n \n \n \n \n \n MissedM1-4\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 01-04yrs\n \n \n \n \n \n MissedM10-\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 10-14yrs\n \n \n \n \n \n MissedM15-\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 15-19yrs\n \n \n \n \n \n MissedM20-\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 20-24yrs\n \n \n \n \n \n MissedM25-\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 25-29yrs\n \n \n \n \n \n MissedM30-\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 30-34yrs\n \n \n \n \n \n MissedM35-\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 35-39yrs\n \n \n \n \n \n MissedM40-\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 40-44yrs\n \n \n \n \n \n MissedM45-\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 45-49yrs\n \n \n \n \n \n MissedM5-9\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 05-09yrs\n \n \n \n \n \n MissedM50P\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 50Plus\n \n \n \n \n \n MissedM<1\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n Under1yr\n \n \n \n \n \n','2021-11-24 13:15:50',4,'2021-11-24 13:36:46',4,0,NULL,NULL,NULL,'d465ee4d-712a-468a-afbb-69a049e009c5'),(1383,'Test - Intakes Percentage','Test - Intakes Percentage','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Test - Intakes Percentage\n Test - Intakes Percentage\n \n 2021-12-08 11:44:27 UTC\n \n 2021-12-08 11:45:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1383\n','2021-12-08 13:44:27',4,'2021-12-08 13:45:08',4,0,NULL,NULL,NULL,'25bec7c7-30cd-49dd-9995-73b72f766ab7'),(1384,'TPT Started eRegister Process Report Weekly','TPT Started for eRegister Process Report','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TPT Started eRegister Process Report Weekly\n TPT Started for eRegister Process Report\n \n 2021-12-08 14:52:04 UTC\n \n 2021-12-08 16:16:37 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1384\n Select Id \nfrom \n(select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier \n from obs o \n -- CLIENTS SEEN FOR ART \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND (o.concept_id = 3843 AND o.value_coded = 3841 OR o.value_coded = 3842) \n AND MONTH(o.obs_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(o.obs_datetime) = YEAR(CAST(:endDate AS DATE)) \n AND patient.voided = 0 AND o.voided = 0 \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n )as A \n \n where Id in ( \n select distinct patient.patient_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n where concept_id = 2227 and value_coded = 2146 \n AND o.obs_datetime >=:startDate and o.obs_datetime <=:endDate \n \n )\n','2021-12-08 16:52:04',4,'2021-12-08 18:16:37',4,0,NULL,NULL,NULL,'90367439-c46f-4021-9858-29280bb738c7'),(1385,'TPT Started this Month','TPT Started this Month','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TPT Started this Month\n TPT Started this Month\n \n 2021-12-08 16:20:18 UTC\n \n 2021-12-08 16:20:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1385\n Select Id \nfrom \n(select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier \n from obs o \n -- CLIENTS SEEN FOR ART \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND (o.concept_id = 3843 AND o.value_coded = 3841 OR o.value_coded = 3842) \n AND MONTH(o.obs_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(o.obs_datetime) = YEAR(CAST(:endDate AS DATE)) \n AND patient.voided = 0 AND o.voided = 0 \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n )as A \n \n where Id in ( \n select distinct patient.patient_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n where concept_id = 2227 and value_coded = 2146 \n AND MONTH(o.obs_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(o.obs_datetime) = YEAR(CAST(:endDate AS DATE)) \n \n )\n','2021-12-08 18:20:18',4,'2021-12-08 18:20:42',4,0,NULL,NULL,NULL,'62e8947b-9360-430f-9708-f61d0adb8cf8'),(1386,'TPT Completed this Month','TPT Completed this Month','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TPT Completed this Month\n TPT Completed this Month\n \n 2021-12-13 12:12:58 UTC\n \n 2021-12-13 12:13:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1386\n Select Id \nfrom \n(select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier \n from obs o \n -- CLIENTS SEEN FOR ART \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND (o.concept_id = 3843 AND o.value_coded = 3841 OR o.value_coded = 3842) \n AND MONTH(o.obs_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(o.obs_datetime) = YEAR(CAST(:endDate AS DATE)) \n AND patient.voided = 0 AND o.voided = 0 \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n )as A \n \n where Id in ( \n select distinct os.person_id \n from obs os \n where concept_id = 4821 \n AND MONTH(os.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n \n )\n','2021-12-13 14:12:58',4,'2021-12-13 14:13:15',4,0,NULL,NULL,NULL,'05b50fa0-aa34-4c91-b02e-cd4e159533f1'),(1387,'TPT Completed eRegister Process Report Weekly','TPT Completed eRegister Process Report Weekly','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TPT Completed eRegister Process Report Weekly\n TPT Completed eRegister Process Report Weekly\n \n 2021-12-13 12:22:47 UTC\n \n 2021-12-13 12:23:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1387\n Select Id \nfrom \n(select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier \n from obs o \n -- CLIENTS SEEN FOR ART \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND (o.concept_id = 3843 AND o.value_coded = 3841 OR o.value_coded = 3842) \n AND MONTH(o.obs_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(o.obs_datetime) = YEAR(CAST(:endDate AS DATE)) \n AND patient.voided = 0 AND o.voided = 0 \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n )as A \n \n where Id in ( \n select distinct patient.patient_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n where concept_id = 4821 \n AND o.obs_datetime >=:startDate and o.obs_datetime <=:endDate \n \n )\n','2021-12-13 14:22:47',4,'2021-12-13 14:23:06',4,0,NULL,NULL,NULL,'3bc4a33c-71d7-483f-8c8e-db247e44e2bc'),(1388,'VL-04 VL tests performed_recent_3months','VL-04 VL tests performed in the recent 3 months','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n VL-04 VL tests performed_recent_3months\n VL-04 VL tests performed in the recent 3 months\n \n 2021-12-15 13:35:47 UTC\n \n 2021-12-16 09:05:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1388\n Select person_id \nFROM \n(select oss.person_id, MAX(oss.obs_datetime) as max_observation,CAST(Max(oss.value_datetime) as DATE) as Blood_Drawn_Date \n from obs oss \n where oss.concept_id = 4267 and oss.voided=0 \n and oss.value_datetime BETWEEN DATE(DATE_ADD(CAST(:endDate AS DATE), INTERVAL -3 MONTH)) AND date_add(cast(:endDate as datetime), interval 1 day) \n group by oss.person_id) as vl_tests_preformed\n','2021-12-15 15:35:47',4,'2021-12-16 11:05:21',4,0,NULL,NULL,NULL,'04eb3953-22d9-4733-aa50-4a8ed4742edf'),(1389,'TPT Continued eRegister Process Report Weekly','Clients Currently on TPT - eRegister Process Report Weekly','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TPT Continued eRegister Process Report Weekly\n Clients Currently on TPT - eRegister Process Report Weekly\n \n 2021-12-16 10:37:22 UTC\n \n 2021-12-16 10:51:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1389\n Select Id \nfrom \n(select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier \n from obs o \n -- CLIENTS SEEN FOR ART \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND (o.concept_id = 3843 AND o.value_coded = 3841 OR o.value_coded = 3842) \n AND MONTH(o.obs_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(o.obs_datetime) = YEAR(CAST(:endDate AS DATE)) \n AND patient.voided = 0 AND o.voided = 0 \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n )as A \n \n where Id in ( \n select distinct patient.patient_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n where concept_id = 2227 -- and value_coded = 2146 \n AND o.obs_datetime >=:startDate and o.obs_datetime <=:endDate \n \n )\n','2021-12-16 12:37:22',4,'2021-12-16 12:51:15',4,0,NULL,NULL,NULL,'2a45ccbb-5d49-46a5-9c14-86a68c658c0f'),(1390,'TPT Continuing this Month','Clients Continuing TPT this month','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TPT Continuing this Month\n Clients Continuing TPT this month\n \n 2021-12-16 10:50:30 UTC\n \n 2021-12-16 10:52:57 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1390\n Select Id \nfrom \n(select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier \n from obs o \n -- CLIENTS SEEN FOR ART \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND (o.concept_id = 3843 AND o.value_coded = 3841 OR o.value_coded = 3842) \n AND MONTH(o.obs_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(o.obs_datetime) = YEAR(CAST(:endDate AS DATE)) \n AND patient.voided = 0 AND o.voided = 0 \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n )as A \n \n where Id in ( \n select distinct os.person_id \n from obs os \n where concept_id = 4821 \n AND MONTH(os.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n \n )\n','2021-12-16 12:50:30',4,'2021-12-16 12:52:57',4,0,NULL,NULL,NULL,'8b56b3a8-d45a-413e-81d9-b47db2336814'),(1391,'CI54:TPT Started_Weekly','CI54:TPT Started','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CI54:TPT Started_Weekly\n CI54:TPT Started\n \n 2021-12-16 11:02:11 UTC\n \n 2021-12-16 11:04:49 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1391\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-12-16 13:02:11',4,'2021-12-16 13:04:49',4,0,NULL,NULL,NULL,'d12bddcf-0bfa-4c0b-96d4-fed20d3251d4'),(1392,'CI55:TPT Continued Weekly','CI55:TPT Continued Weekly','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CI55:TPT Continued Weekly\n CI55:TPT Continued Weekly\n \n 2021-12-16 11:06:12 UTC\n \n 2021-12-16 11:07:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1392\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-12-16 13:06:12',4,'2021-12-16 13:07:06',4,0,NULL,NULL,NULL,'6444a6c5-e484-4a40-911e-98ed6c43112d'),(1393,'CI56:TPT Completed Weekly','CI56:TPT Completed Weekly','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CI56:TPT Completed Weekly\n CI56:TPT Completed Weekly\n \n 2021-12-16 11:08:33 UTC\n \n 2021-12-16 11:17:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1393\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-12-16 13:08:33',4,'2021-12-16 13:17:21',4,0,NULL,NULL,NULL,'b78d514c-0203-44a4-8bc2-e04e521d3eff'),(1394,'CI57:VL Blood Draws in recent 3 months','CI57:VL Blood Draws recent 3 months','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CI57:VL Blood Draws in recent 3 months\n CI57:VL Blood Draws recent 3 months\n \n 2021-12-16 11:20:31 UTC\n \n 2021-12-16 11:22:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1394\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-12-16 13:20:31',4,'2021-12-16 13:22:32',4,0,NULL,NULL,NULL,'db80bf53-873d-4c0c-8847-726847b0c417'),(1395,'CI58:VL Results received within 3 months','CI58:VL Results received within 3 months','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CI58:VL Results received within 3 months\n CI58:VL Results received within 3 months\n \n 2021-12-16 11:24:28 UTC\n \n 2021-12-16 11:25:37 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1395\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-12-16 13:24:28',4,'2021-12-16 13:25:37',4,0,NULL,NULL,NULL,'5b8fbea7-884a-4e64-ae29-48732ba65c3a'),(1396,'CI59:VL Results received this month','CI59:VL Results received this month','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CI59:VL Results received this month\n CI59:VL Results received this month\n \n 2021-12-16 11:28:21 UTC\n \n 2021-12-16 11:29:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1396\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-12-16 13:28:21',4,'2021-12-16 13:29:17',4,0,NULL,NULL,NULL,'019b40c1-d072-414e-9ffd-a6f00f6eab86'),(1397,'CI60:Pending Results within 3 months','CI60:Pending Results within 3 months','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CI60:Pending Results within 3 months\n CI60:Pending Results within 3 months\n \n 2021-12-16 12:02:36 UTC\n \n 2021-12-16 12:03:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1397\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-12-16 14:02:36',4,'2021-12-16 14:03:44',4,0,NULL,NULL,NULL,'3f59f3a6-d116-4fce-ac20-e739c9cfefa6'),(1398,'CI61:Pending Results within 2 months','CI61:Pending Results within 2 months','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CI61:Pending Results within 2 months\n CI61:Pending Results within 2 months\n \n 2021-12-16 12:05:54 UTC\n \n 2021-12-16 12:06:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1398\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-12-16 14:05:54',4,'2021-12-16 14:06:36',4,0,NULL,NULL,NULL,'a8dcaa40-a96f-4714-a161-c9493a75ba91'),(1399,'CI62:Pending Results within 1 month','CI62:Pending Results within 1 month','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CI62:Pending Results within 1 month\n CI62:Pending Results within 1 month\n \n 2021-12-16 12:07:27 UTC\n \n 2021-12-16 12:08:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1399\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-12-16 14:07:27',4,'2021-12-16 14:08:04',4,0,NULL,NULL,NULL,'cb06df8b-0d0f-415c-ad52-322786e3e3fc'),(1401,'Discordant Couple','Couple discordant results','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Discordant Couple\n Couple discordant results\n \n 2022-02-16 18:59:38 UTC\n \n 2022-02-17 18:55:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1401\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in \n (select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND \n patient_identifier.identifier_type IN (3,5) AND patient_identifier.preferred=1 \n \n AND o.voided=0 \n AND MONTH(o.obs_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(o.obs_datetime) = YEAR(CAST(:endDate AS DATE)) \n \n where concept_id in (4225) and value_coded in (2146) \n Group by o.person_id \n)\n','2022-02-17 00:29:38',4,'2022-02-18 00:25:55',4,0,NULL,NULL,NULL,'09606416-9fdb-404a-a23f-2670030a98c2'),(1402,'Indeterminate results','indeterminate and inconclusive test results','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Indeterminate results\n indeterminate and inconclusive test results\n \n 2022-02-17 03:45:12 UTC\n \n 2022-02-17 03:57:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1402\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in \n (select o.person_id as Id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND \n patient_identifier.identifier_type IN (3,5) AND patient_identifier.preferred=1 \n \n AND o.voided=0 \n AND MONTH(o.obs_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(o.obs_datetime) = YEAR(CAST(:endDate AS DATE)) \n \n where concept_id in (4223) and value_coded in (4220) \n Group by o.person_id)\n','2022-02-17 09:15:12',4,'2022-02-17 09:27:02',4,0,NULL,NULL,NULL,'91361707-3e26-4592-b606-0d5b76fed7f5'),(1403,'Couples Only','HTS Clients Tested as Couple','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Couples Only\n HTS Clients Tested as Couple\n \n 2022-02-17 03:58:23 UTC\n \n 2022-02-24 07:00:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1403\n select distinct o.person_id \n from obs o inner join location l on o.location_id = l.location_id \n where (o.location_id =:location or parent_location =:location) \n and o.person_id in \n (select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND \n patient_identifier.identifier_type IN (3,5) AND patient_identifier.preferred=1 \n \n AND o.voided=0 \n AND MONTH(o.obs_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(o.obs_datetime) = YEAR(CAST(:endDate AS DATE)) \n \n where concept_id in (2166) and value_coded in (2146) \n Group by o.person_id)\n','2022-02-17 09:28:23',4,'2022-02-24 12:30:31',4,0,NULL,NULL,NULL,'7a60cfbe-7e8b-49bb-8f69-bf04e37c37e9'),(1404,'HTS Clients Screened ','Number of HTS Clients Screened for TB','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HTS Clients Screened \n Number of HTS Clients Screened for TB\n \n 2022-02-17 04:07:32 UTC\n \n 2022-03-17 10:26:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1404\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in \n (select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND \n patient_identifier.identifier_type IN (3) AND patient_identifier.preferred=1 \n \n AND o.voided=0 \n AND MONTH(o.obs_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(o.obs_datetime) = YEAR(CAST(:endDate AS DATE)) \n \n where concept_id in (2294) and value_coded in (2146) \n Group by o.person_id)\n','2022-02-17 04:07:32',4,'2022-03-17 10:26:05',4,0,NULL,NULL,NULL,'5a029d5e-f4ba-4e2c-8dc6-ba01d0ca45af'),(1405,'Confirmed Negative','HTS Confirmed Negative Clients','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Confirmed Negative\n HTS Confirmed Negative Clients\n \n 2022-02-17 12:05:47 UTC\n \n 2022-02-17 12:14:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1405\n select distinct o.person_id \n from obs o inner join location l on o.location_id = l.location_id \n where (o.location_id =:location or parent_location =:location) \n and o.person_id in \n (select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND \n patient_identifier.identifier_type IN (3,5) AND patient_identifier.preferred=1 \n \n AND o.voided=0 \n AND MONTH(o.obs_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(o.obs_datetime) = YEAR(CAST(:endDate AS DATE)) \n \n where concept_id in (2165) and value_coded in (1016) \n Group by o.person_id)\n','2022-02-17 17:35:47',4,'2022-02-17 17:44:51',4,0,NULL,NULL,NULL,'c9c50904-153c-4517-b462-5df83b4fd9b9'),(1406,'Confirmed Positives','HTS Confirmed Positive Clients','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Confirmed Positives\n HTS Confirmed Positive Clients\n \n 2022-02-17 12:17:04 UTC\n \n 2022-02-17 12:19:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1406\n select distinct o.person_id \n from obs o inner join location l on o.location_id = l.location_id \n where (o.location_id =:location or parent_location =:location) \n and o.person_id in \n (select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND \n patient_identifier.identifier_type IN (3,5) AND patient_identifier.preferred=1 \n \n AND o.voided=0 \n AND MONTH(o.obs_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(o.obs_datetime) = YEAR(CAST(:endDate AS DATE)) \n \n where concept_id in (2165) and value_coded in (1738) \n Group by o.person_id)\n','2022-02-17 17:47:04',4,'2022-02-17 17:49:20',4,0,NULL,NULL,NULL,'44a79d1e-c5ea-44ab-b6df-0c21abaa9a38'),(1407,'Indeterminate results','Total Indeterminate results','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.SqlIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Indeterminate results\n Total Indeterminate results\n \n 2022-02-17 17:40:50 UTC\n \n','2022-02-17 23:10:50',4,NULL,NULL,0,NULL,NULL,NULL,'13337249-1e1c-42a4-9f3e-edacbb906e5d'),(1408,'Indeterminate results','Total Indeterminate results','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Indeterminate results\n Total Indeterminate results\n \n 2022-02-17 17:42:25 UTC\n \n 2022-02-17 17:46:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1408\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-02-17 23:12:25',4,'2022-02-17 23:16:50',4,0,NULL,NULL,NULL,'e4e5a5d1-5d70-4a2e-83fb-902c382967d5'),(1409,'HTS Screened','Number of HTS Clients screened for TB','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HTS Screened\n Number of HTS Clients screened for TB\n \n 2022-02-17 17:49:05 UTC\n \n 2022-02-17 17:55:54 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1409\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-02-17 23:19:05',4,'2022-02-17 23:25:54',4,0,NULL,NULL,NULL,'5abf9b9c-5225-4470-a455-bcc7ca6addca'),(1411,'HTS Clients Screened for TB Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HTS Clients Screened for TB Data Set\n \n 2022-02-17 17:59:08 UTC\n \n 2022-02-17 18:30:56 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1411\n \n \n DM_Sex\n \n \n \n \n \n \n \n \n HTS_Female\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n \n \n \n HTS_Males\n \n \n \n \n DM_Sex\n Males\n \n \n \n \n \n','2022-02-17 23:29:08',4,'2022-02-18 00:00:56',4,0,NULL,NULL,NULL,'86204394-0168-468b-b3d8-0de0beb04bc2'),(1412,'Couples Only','HTS Clients tested as couples','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Couples Only\n HTS Clients tested as couples\n \n 2022-02-17 18:39:17 UTC\n \n 2022-02-17 18:41:37 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1412\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-02-18 00:09:17',4,'2022-02-18 00:11:37',4,0,NULL,NULL,NULL,'fa71acc6-bc29-4927-bbc4-d49906763b94'),(1413,'Discordant Results','Discordant Test Resultes','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Discordant Results\n Discordant Test Resultes\n \n 2022-02-17 18:53:30 UTC\n \n 2022-02-17 18:57:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1413\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-02-18 00:23:30',4,'2022-02-18 00:27:04',4,0,NULL,NULL,NULL,'73ea8489-1fa9-46ab-a2ce-6b6b2d73a33e'),(1414,'Confirmed Negatives','Number of Confirmed Negative Results','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Confirmed Negatives\n Number of Confirmed Negative Results\n \n 2022-02-17 18:59:07 UTC\n \n 2022-02-17 19:05:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1414\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-02-18 00:29:07',4,'2022-02-18 00:35:44',4,0,NULL,NULL,NULL,'e78ac003-c014-430b-806c-8f71e0b33164'),(1415,'Confirmed Positives','Number of confirmed positive results','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Confirmed Positives\n Number of confirmed positive results\n \n 2022-02-17 19:07:25 UTC\n \n 2022-02-17 19:08:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1415\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-02-18 00:37:25',4,'2022-02-18 00:38:40',4,0,NULL,NULL,NULL,'c43780c6-a70b-4cca-9821-af8fac2e5b75'),(1417,'Total Indeterminate Results Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Total Indeterminate Results Data Set\n \n 2022-02-17 19:12:45 UTC\n \n 2022-02-17 19:19:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1417\n \n \n \n \n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n \n \n','2022-02-18 00:42:45',4,'2022-02-18 00:49:17',4,0,NULL,NULL,NULL,'d8134c4d-7b2d-4421-93b5-986cf5263b17'),(1419,'Couples Only Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Couples Only Data Set\n \n 2022-02-17 19:22:38 UTC\n \n 2022-02-17 19:23:37 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1419\n \n \n \n \n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n \n \n','2022-02-18 00:52:38',4,'2022-02-18 00:53:37',4,0,NULL,NULL,NULL,'5f221d24-9b0f-4b56-8659-2262fa6383ca'),(1421,'Discordant Test Results Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Discordant Test Results Data Set\n \n 2022-02-17 19:25:59 UTC\n \n 2022-02-17 19:26:57 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1421\n \n \n \n \n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n \n \n','2022-02-18 00:55:59',4,'2022-02-18 00:56:57',4,0,NULL,NULL,NULL,'fe57a3d6-6ea3-4878-ab19-d3b2bc676b18'),(1422,'HTS_Post_Test_Counseling','HTS_Post_Test_Counseling','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HTS_Post_Test_Counseling\n HTS_Post_Test_Counseling\n \n 2022-02-17 19:30:06 UTC\n \n 2022-02-17 19:54:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1422\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2022-02-18 01:00:06',4,'2022-02-18 01:24:15',4,0,NULL,NULL,NULL,'a37e3f91-87d6-4126-b164-4888fa187f93'),(1423,'Number of Confirmatory Test Results Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Number of Confirmatory Test Results Data Set\n \n 2022-02-17 19:30:22 UTC\n \n 2022-02-24 18:31:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1423\n \n \n DM_Sex\n \n \n \n \n \n \n \n \n Couples\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n \n \n Distri_Kit\n \n \n \n \n \n \n \n \n \n HTS_Female\n \n \n \n \n \n \n \n DM_Sex\n Females\n \n \n \n \n \n HTS_Males\n \n \n \n \n DM_Sex\n Males\n \n \n \n \n \n Ind_Res\n \n \n \n \n \n \n \n \n \n Retur_Kits\n \n \n \n \n \n \n \n \n \n con_neg\n \n \n \n \n \n \n \n \n \n con_pos\n \n \n \n \n \n \n \n \n \n disc_res\n \n \n \n \n \n \n \n \n \n','2022-02-18 01:00:22',4,'2022-02-25 00:01:20',4,0,NULL,NULL,NULL,'e3eaeee4-8afa-4090-a2c5-72662d743f68'),(1425,'Distributed Self test Kits','Total HTS Self Test Distributed Kits','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Distributed Self test Kits\n Total HTS Self Test Distributed Kits\n \n 2022-02-24 13:03:04 UTC\n \n 2024-01-31 15:47:34 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1425\n select distinct o.obs_id \n from obs o \n where o.obs_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND \n patient_identifier.identifier_type IN (3,5) AND patient_identifier.preferred=1 \n INNER JOIN location l on o.location_id = l.location_id and l.retired=0 \n AND o.voided=0 \n AND MONTH(o.obs_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(o.obs_datetime) = YEAR(CAST(:endDate AS DATE)) \n where concept_id in (4968) \n and (o.location_id = :location or parent_location = :location) \n Union All \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND \n patient_identifier.identifier_type IN (3,5) AND patient_identifier.preferred=1 \n INNER JOIN location l on o.location_id = l.location_id and l.retired=0 \n AND o.voided=0 \n AND MONTH(o.obs_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(o.obs_datetime) = YEAR(CAST(:endDate AS DATE)) \n where concept_id in (4845) and value_coded in (4822) \n and (o.location_id = :location or parent_location = :location) \n )\n','2022-02-24 18:33:04',4,'2024-01-31 21:17:34',4,0,NULL,NULL,NULL,'7fb1f754-6cb8-4d98-bbeb-49a931f97994'); INSERT INTO `serialized_object` VALUES (1426,'Distributed Self Test Kits','Total Distributed Self Test Kits','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Distributed Self Test Kits\n Total Distributed Self Test Kits\n \n 2022-02-24 13:33:06 UTC\n \n 2022-02-24 18:11:54 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1426\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-02-24 19:03:06',4,'2022-02-24 23:41:54',4,0,NULL,NULL,NULL,'45e24163-6e6a-44a8-a168-1960f92e6664'),(1427,'HTS Self Test Kits Returned','Total HTS Self Test Kits Returned','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HTS Self Test Kits Returned\n Total HTS Self Test Kits Returned\n \n 2022-02-24 18:14:58 UTC\n \n 2022-02-24 18:25:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1427\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-02-24 23:44:58',4,'2022-02-24 23:55:27',4,0,NULL,NULL,NULL,'e448334c-d0c9-46cd-8041-45a9492aecb7'),(1428,'Returned Self Test Kits','Total Returned Self Test Kits','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Returned Self Test Kits\n Total Returned Self Test Kits\n \n 2022-02-24 18:19:33 UTC\n \n 2024-01-31 15:51:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1428\n select distinct o.obs_id \n from obs o \n where o.obs_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND \n patient_identifier.identifier_type IN (3,5) AND patient_identifier.preferred=1 \n INNER JOIN location l on o.location_id = l.location_id and l.retired=0 \n AND o.voided=0 \n AND MONTH(o.obs_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(o.obs_datetime) = YEAR(CAST(:endDate AS DATE)) \n \n where concept_id in (4844) and value_coded not in (2148) \n and (o.location_id = :location or parent_location = :location) \n Group by o.person_id \n )\n','2022-02-24 23:49:33',4,'2024-01-31 21:21:23',4,0,NULL,NULL,NULL,'fbebdef1-7e03-4061-b525-95f86632ab49'),(1429,'ART Clients Stopped','ART Clients who stopped treatment in that month','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n ART Clients Stopped\n ART Clients who stopped treatment in that month\n \n 2022-04-28 08:52:48 UTC\n \n 2022-04-28 08:54:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1429\n select os.person_id \n from obs os \n inner join location l on os.location_id = l.location_id \n where os.concept_id = 3701 and os.voided = 0 \n and MONTH(os.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n AND os.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3767 and o.value_coded = 2297 \n and o.voided = 0 \n \n )\n','2022-04-28 08:52:48',4,'2022-04-28 08:54:53',4,0,NULL,NULL,NULL,'2ea61d1f-e032-452e-bc0c-5ffb80c1a256'),(1430,'Clients given 4L weighing 0-3.9kg','Clients given 4L weighing 0-3.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L weighing 0-3.9kg\n Clients given 4L weighing 0-3.9kg\n \n 2022-06-30 09:34:15 UTC\n \n 2023-08-03 10:37:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1430\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4L \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4688)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight <=3.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 11:34:15',4,'2023-08-03 12:37:31',4,0,NULL,NULL,NULL,'1cbd9712-0dde-45fa-977c-98e3fd65681b'),(1431,'Clients given 4C weighing 0-3.9kg','Clients given 4C weighing 0-3.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C weighing 0-3.9kg\n Clients given 4C weighing 0-3.9kg\n \n 2022-06-30 09:37:12 UTC\n \n 2023-07-27 10:09:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1431\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2202)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight <=3.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 11:37:12',4,'2023-07-27 12:09:00',4,0,NULL,NULL,NULL,'9cd0146e-b566-4e02-9d37-da46810c833e'),(1432,'Clients given 4L weighing 4-5.9kg','Clients given 4L weighing 4-5.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L weighing 4-5.9kg\n Clients given 4L weighing 4-5.9kg\n \n 2022-06-30 09:37:43 UTC\n \n 2023-08-03 10:43:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1432\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4L \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4688)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=4 and _weight <=5.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 11:37:43',4,'2023-08-03 12:43:41',4,0,NULL,NULL,NULL,'aecca82d-d3c2-429d-acb2-56e1657ce6db'),(1433,'Clients given 4L weighing 6-9.9kg','Clients given 4L weighing 6-9.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L weighing 6-9.9kg\n Clients given 4L weighing 6-9.9kg\n \n 2022-06-30 09:39:53 UTC\n \n 2023-08-03 10:44:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1433\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4L \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4688)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=6 and _weight <=9.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 11:39:53',4,'2023-08-03 12:44:44',4,0,NULL,NULL,NULL,'1758b50a-2a2c-4b2c-b795-355255878304'),(1434,'Clients given 4L weighing 10-13.9kg','Clients given 4L weighing 10-13.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L weighing 10-13.9kg\n Clients given 4L weighing 10-13.9kg\n \n 2022-06-30 09:42:34 UTC\n \n 2023-08-03 10:40:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1434\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4L \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4688)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=10 and _weight <=13.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 11:42:34',4,'2023-08-03 12:40:14',4,0,NULL,NULL,NULL,'2c470abf-a5dc-4c5e-a1f0-dc85cc66b111'),(1435,'Clients given 4C weighing 4-5.9kg','Clients given 4C weighing 4-5.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C weighing 4-5.9kg\n Clients given 4C weighing 4-5.9kg\n \n 2022-06-30 09:43:58 UTC\n \n 2023-07-27 10:06:25 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1435\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2202)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=4 and _weight <=5.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 11:43:58',4,'2023-07-27 12:06:25',4,0,NULL,NULL,NULL,'ae72a1f2-5b35-4736-8a3d-d09eeaafaaf1'),(1436,'Clients given 4L weighing 14-19.9kg','Clients given 4L weighing 14-19.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L weighing 14-19.9kg\n Clients given 4L weighing 14-19.9kg\n \n 2022-06-30 09:44:49 UTC\n \n 2023-08-03 10:41:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1436\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4L \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4688)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=14 and _weight <=19.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 11:44:49',4,'2023-08-03 12:41:10',4,0,NULL,NULL,NULL,'c0c8885b-814c-4cb2-8c23-c10871a2b76d'),(1437,'Clients given 4L weighing 20-24.9kg','Clients given 4L weighing 20-24.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L weighing 20-24.9kg\n Clients given 4L weighing 20-24.9kg\n \n 2022-06-30 09:45:58 UTC\n \n 2023-08-03 10:41:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1437\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4L \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4688)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=20 and _weight <=24.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 11:45:58',4,'2023-08-03 12:41:51',4,0,NULL,NULL,NULL,'889cb817-6500-4ae1-9f84-e1ec42b46c00'),(1438,'Clients given 4L weighing 25-34.9kg','Clients given 4L weighing 25-34.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L weighing 25-34.9kg\n Clients given 4L weighing 25-34.9kg\n \n 2022-06-30 09:47:36 UTC\n \n 2023-08-03 10:42:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1438\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4L \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4688)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=25 and _weight <=34.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 11:47:36',4,'2023-08-03 12:42:36',4,0,NULL,NULL,NULL,'51076831-4759-4f7d-8d57-47fb8862e61c'),(1439,'Clients given 4L weighing >=35','Clients given 4L weighing >=35','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L weighing >=35\n Clients given 4L weighing >=35\n \n 2022-06-30 09:48:54 UTC\n \n 2023-08-03 10:36:25 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1439\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4L \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4688)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=35)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 11:48:54',4,'2023-08-03 12:36:25',4,0,NULL,NULL,NULL,'3ba57d29-931d-454e-916c-9e0c0e90d805'),(1440,'Clients given 4C weighing 6-9.9kg','Clients given 4C weighing 6-9.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C weighing 6-9.9kg\n Clients given 4C weighing 6-9.9kg\n \n 2022-06-30 09:49:04 UTC\n \n 2023-07-27 10:06:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1440\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2202)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=6 and _weight <=9.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 11:49:04',4,'2023-07-27 12:06:55',4,0,NULL,NULL,NULL,'d3d16a07-4319-4d63-82a2-4f47f7928a00'),(1441,'Clients given 4C weighing 10-13.9kg','Clients given 4C weighing 10-13.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C weighing 10-13.9kg\n Clients given 4C weighing 10-13.9kg\n \n 2022-06-30 09:50:51 UTC\n \n 2023-07-27 10:01:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1441\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2202)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=10 and _weight <=13.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 11:50:51',4,'2023-07-27 12:01:01',4,0,NULL,NULL,NULL,'09622f4b-49d5-4214-9eb4-7de4cae57a9d'),(1442,'Clients given 4K weighing 0-3.9kg','Clients given 4K weighing 0-3.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K weighing 0-3.9kg\n Clients given 4K weighing 0-3.9kg\n \n 2022-06-30 09:52:14 UTC\n \n 2023-07-27 12:56:47 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1442\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4K \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight <=3.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 11:52:14',4,'2023-07-27 14:56:47',4,0,NULL,NULL,NULL,'0f76ed94-e4f8-4f94-9bc4-4adbba1c66c1'),(1443,'Clients given 4C weighing 14-19.9kg','Clients given 4C weighing 14-19.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C weighing 14-19.9kg\n Clients given 4C weighing 14-19.9kg\n \n 2022-06-30 09:53:51 UTC\n \n 2023-08-15 13:35:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1443\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2202)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=14 and _weight <=19.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 11:53:51',4,'2023-08-15 15:35:14',4,0,NULL,NULL,NULL,'034244be-ee9b-4c5f-9c05-b69eefad3051'),(1444,'Clients given 4K weighing 4-5.9kg','Clients given 4K weighing 4-5.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K weighing 4-5.9kg\n Clients given 4K weighing 4-5.9kg\n \n 2022-06-30 09:53:56 UTC\n \n 2023-07-27 12:58:37 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1444\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4K \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=4 and _weight <=5.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 11:53:56',4,'2023-07-27 14:58:37',4,0,NULL,NULL,NULL,'fe700a2f-6c6b-4ab5-8692-4171cb0dc27c'),(1445,'Clients given 4K weighing 6-9.9kg','Clients given 4K weighing 6-9.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K weighing 6-9.9kg\n Clients given 4K weighing 6-9.9kg\n \n 2022-06-30 09:55:49 UTC\n \n 2023-07-27 12:59:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1445\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4K \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=6 and _weight <=9.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 11:55:49',4,'2023-07-27 14:59:00',4,0,NULL,NULL,NULL,'db5d6766-3a33-43c4-9732-a4d83ce9b1ea'),(1446,'Clients given 4K weighing 10-13.9kg','Clients given 4K weighing 10-13.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K weighing 10-13.9kg\n Clients given 4K weighing 10-13.9kg\n \n 2022-06-30 09:56:49 UTC\n \n 2023-07-27 12:57:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1446\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4K \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=10 and _weight <=13.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 11:56:49',4,'2023-07-27 14:57:10',4,0,NULL,NULL,NULL,'494aa500-1c2d-45b2-b6ba-aa987b52622a'),(1447,'Clients given 4K weighing 14-19.9kg','Clients given 4K weighing 14-19.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K weighing 14-19.9kg\n Clients given 4K weighing 14-19.9kg\n \n 2022-06-30 09:58:26 UTC\n \n 2023-07-27 12:57:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1447\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4K \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=14 and _weight <=19.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 11:58:26',4,'2023-07-27 14:57:30',4,0,NULL,NULL,NULL,'480ac769-5b88-4485-8885-03322fa49fc8'),(1448,'Clients given 4K weighing 20-24.9kg','Clients given 4K weighing 20-24.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K weighing 20-24.9kg\n Clients given 4K weighing 20-24.9kg\n \n 2022-06-30 09:59:23 UTC\n \n 2023-07-27 12:57:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1448\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4K \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=20 and _weight <=24.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 11:59:23',4,'2023-07-27 14:57:51',4,0,NULL,NULL,NULL,'3bd2b9e5-01e8-43ac-a17a-3912a89d7ff1'),(1449,'Clients given 4K weighing 25-34.9kg','Clients given 4K weighing 25-34.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K weighing 25-34.9kg\n Clients given 4K weighing 25-34.9kg\n \n 2022-06-30 10:01:21 UTC\n \n 2023-07-27 12:58:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1449\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4K \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=25 and _weight <=34.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:01:21',4,'2023-07-27 14:58:15',4,0,NULL,NULL,NULL,'921f9499-c27b-4b41-95e0-b85292fa2f92'),(1450,'Clients given 4K weighing >=35kg','Clients given 4K weighing >=35kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K weighing >=35kg\n Clients given 4K weighing >=35kg\n \n 2022-06-30 10:02:42 UTC\n \n 2023-07-27 12:56:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1450\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4K \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=35)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:02:42',4,'2023-07-27 14:56:23',4,0,NULL,NULL,NULL,'3229cff2-e047-4073-90c1-e06e867b402b'),(1451,'Clients given 4C weighing 20-24.9kg','Clients given 4C weighing 20-24.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C weighing 20-24.9kg\n Clients given 4C weighing 20-24.9kg\n \n 2022-06-30 10:02:57 UTC\n \n 2023-07-27 10:03:19 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1451\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2202)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=20 and _weight <=24.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:02:57',4,'2023-07-27 12:03:19',4,0,NULL,NULL,NULL,'9e67fab4-3382-49c7-bc4a-8e6f95ecd7ff'),(1452,'Clients given 4C weighing 25-34.9kg','Clients given 4C weighing 25-34.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C weighing 25-34.9kg\n Clients given 4C weighing 25-34.9kg\n \n 2022-06-30 10:04:55 UTC\n \n 2023-07-27 10:05:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1452\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2202)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=25 and _weight <=34.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:04:55',4,'2023-07-27 12:05:26',4,0,NULL,NULL,NULL,'1e41db8d-aca6-471d-af67-bddf792eb12e'),(1453,'Clients given 4C weighing >=35kg','Clients given 4C weighing >=35kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C weighing >=35kg\n Clients given 4C weighing >=35kg\n \n 2022-06-30 10:06:32 UTC\n \n 2023-07-27 10:08:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1453\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2202)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=35)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:06:32',4,'2023-07-27 12:08:27',4,0,NULL,NULL,NULL,'9bb26987-59cb-48b8-8235-502a3d2f52b4'),(1454,'Clients given 4J weighing 0-3.9kg','Clients given 4J weighing 0-3.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J weighing 0-3.9kg\n Clients given 4J weighing 0-3.9kg\n \n 2022-06-30 10:07:54 UTC\n \n 2023-07-27 10:59:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1454\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4J \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight <=3.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:07:54',4,'2023-07-27 12:59:20',4,0,NULL,NULL,NULL,'b4265cc6-ac60-4aeb-ba91-ef213a6d949e'),(1455,'Clients given 4D weighing 0-3.9kg','Clients given 4D weighing 0-3.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D weighing 0-3.9kg\n Clients given 4D weighing 0-3.9kg\n \n 2022-06-30 10:08:47 UTC\n \n 2023-07-27 09:27:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n 1455\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4d \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2204)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight > 0 and _weight <=3.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:08:47',4,'2023-07-27 11:27:03',4,0,NULL,NULL,NULL,'d998e2f6-840d-473b-b176-e0550de42412'),(1456,'Clients given 4D weighing 4-5.9kg','Clients given 4D weighing 4-5.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D weighing 4-5.9kg\n Clients given 4D weighing 4-5.9kg\n \n 2022-06-30 10:13:16 UTC\n \n 2023-07-27 09:38:34 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1456\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4d \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2204)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 4 and _weight <=5.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:13:16',4,'2023-07-27 11:38:34',4,0,NULL,NULL,NULL,'6a8a13fc-28a2-4778-840f-e45fb90009b6'),(1457,'Clients given 4D weighing 6-9.9kg','Clients given 4D weighing 6-9.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D weighing 6-9.9kg\n Clients given 4D weighing 6-9.9kg\n \n 2022-06-30 10:15:03 UTC\n \n 2023-07-27 09:39:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1457\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4d \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2204)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 6 and _weight <=9.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:15:03',4,'2023-07-27 11:39:10',4,0,NULL,NULL,NULL,'5d76364b-1150-4bd7-b456-7844b2f28312'),(1458,'Clients given 4J weighing 4-5.9kg','Clients given 4J weighing 4-5.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J weighing 4-5.9kg\n Clients given 4J weighing 4-5.9kg\n \n 2022-06-30 10:15:44 UTC\n \n 2023-07-27 11:01:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1458\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4J \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=4 and _weight <=5.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:15:44',4,'2023-07-27 13:01:23',4,0,NULL,NULL,NULL,'8a4200ea-3da7-406f-9961-272c3898fe6c'),(1459,'Clients given 4D weighing 10-13.9kg','Clients given 4D weighing 10-13.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D weighing 10-13.9kg\n Clients given 4D weighing 10-13.9kg\n \n 2022-06-30 10:18:04 UTC\n \n 2023-07-27 09:28:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1459\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4d \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2204)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 10 and _weight <=13.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:18:04',4,'2023-07-27 11:28:41',4,0,NULL,NULL,NULL,'8a6e7ee5-2a61-4944-bfb4-bb47a5698f6c'),(1460,'Clients given 4D weighing 14-19.9kg','Clients given 4D weighing 14-19.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D weighing 14-19.9kg\n Clients given 4D weighing 14-19.9kg\n \n 2022-06-30 10:19:54 UTC\n \n 2023-07-27 09:36:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1460\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4d \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2204)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 14 and _weight <=19.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:19:54',4,'2023-07-27 11:36:07',4,0,NULL,NULL,NULL,'45092d9a-31f7-4734-bad7-6afa4af47c8c'),(1461,'Clients given 4J weighing 6-9.9kg','Clients given 4J weighing 6-9.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J weighing 6-9.9kg\n Clients given 4J weighing 6-9.9kg\n \n 2022-06-30 10:21:51 UTC\n \n 2023-07-27 11:01:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1461\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4J \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=6 and _weight <=9.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:21:51',4,'2023-07-27 13:01:41',4,0,NULL,NULL,NULL,'5f5b772e-63e5-4b96-b211-629491f33c0d'),(1462,'Clients given 4D weighing 20-24.9kg','Clients given 4D weighing 20-24.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D weighing 20-24.9kg\n Clients given 4D weighing 20-24.9kg\n \n 2022-06-30 10:22:05 UTC\n \n 2023-07-27 09:36:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1462\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4d \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2204)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 20 and _weight <=24.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:22:05',4,'2023-07-27 11:36:30',4,0,NULL,NULL,NULL,'a0d8e3b8-722d-491c-bd0f-fa90956f51db'),(1463,'Clients given 4J weighing 10-13.9kg','Clients given 4J weighing 10-13.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J weighing 10-13.9kg\n Clients given 4J weighing 10-13.9kg\n \n 2022-06-30 10:22:53 UTC\n \n 2023-07-27 10:59:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1463\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4J \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=10 and _weight <=13.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:22:53',4,'2023-07-27 12:59:41',4,0,NULL,NULL,NULL,'790715b6-630c-4294-8577-6f4815e44797'),(1464,'Clients given 4J weighing 14-19.9kg','Clients given 4J weighing 14-19.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J weighing 14-19.9kg\n Clients given 4J weighing 14-19.9kg\n \n 2022-06-30 10:24:03 UTC\n \n 2023-07-27 10:59:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1464\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4J \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=14 and _weight <=19.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:24:03',4,'2023-07-27 12:59:55',4,0,NULL,NULL,NULL,'08528ef7-fb50-42e0-b520-afb3ecedbad2'),(1465,'Clients given 4D weighing 25-34.9kg','Clients given 4D weighing 25-34.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D weighing 25-34.9kg\n Clients given 4D weighing 25-34.9kg\n \n 2022-06-30 10:24:49 UTC\n \n 2023-07-27 09:37:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1465\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4d \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2204)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 25 and _weight <=34.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:24:49',4,'2023-07-27 11:37:45',4,0,NULL,NULL,NULL,'527ab6b7-03a7-4ad5-86ae-2c494b0b3cb0'),(1466,'Clients given 4J weighing 20-24.9kg','Clients given 4J weighing 20-24.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J weighing 20-24.9kg\n Clients given 4J weighing 20-24.9kg\n \n 2022-06-30 10:24:52 UTC\n \n 2023-07-27 11:00:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1466\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4J \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=20 and _weight <=24.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:24:52',4,'2023-07-27 13:00:42',4,0,NULL,NULL,NULL,'65757623-b703-423a-a092-06e04ed87180'),(1467,'Clients given 4D weighing >= 35kg','Clients given 4D weighing >= 35kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D weighing >= 35kg\n Clients given 4D weighing >= 35kg\n \n 2022-06-30 10:27:51 UTC\n \n 2023-07-27 09:40:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1467\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4d \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2204)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 35)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:27:51',4,'2023-07-27 11:40:28',4,0,NULL,NULL,NULL,'242cded5-b463-489d-a941-901a590d1d47'),(1468,'Clients given 4J weighing 25-34.9kg','Clients given 4J weighing 25-34.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J weighing 25-34.9kg\n Clients given 4J weighing 25-34.9kg\n \n 2022-06-30 10:28:09 UTC\n \n 2023-07-27 11:01:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1468\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4J \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=25 and _weight <=34.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:28:09',4,'2023-07-27 13:01:04',4,0,NULL,NULL,NULL,'83bc989a-e2b7-4bed-a628-fc59a59c1ba6'),(1469,'Clients given 4J weighing >=35kg','Clients given 4J weighing >=35kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J weighing >=35kg\n Clients given 4J weighing >=35kg\n \n 2022-06-30 10:28:53 UTC\n \n 2023-07-27 10:58:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1469\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4J \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=35)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:28:53',4,'2023-07-27 12:58:41',4,0,NULL,NULL,NULL,'72f98838-eb15-4cb6-a914-0852726e5647'),(1470,'Clients given 4E weighing 0-3.9kg','Clients given 4E weighing 0-3.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E weighing 0-3.9kg\n Clients given 4E weighing 0-3.9kg\n \n 2022-06-30 10:29:43 UTC\n \n 2023-07-27 10:22:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1470\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3679)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight <=3.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:29:43',4,'2023-07-27 12:22:02',4,0,NULL,NULL,NULL,'0ab11624-0249-40a0-971b-e3e8bb23ea70'),(1471,'Clients given 4E weighing 4-5.9kg','Clients given 4E weighing 4-5.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E weighing 4-5.9kg\n Clients given 4E weighing 4-5.9kg\n \n 2022-06-30 10:33:36 UTC\n \n 2023-07-27 10:26:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1471\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3679)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=4 and _weight <=5.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:33:36',4,'2023-07-27 12:26:59',4,0,NULL,NULL,NULL,'8519fd1c-bd73-43d6-8c51-e76191131ca3'),(1472,'Clients given 4E weighing 6-9.9kg','Clients given 4E weighing 6-9.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E weighing 6-9.9kg\n Clients given 4E weighing 6-9.9kg\n \n 2022-06-30 10:35:26 UTC\n \n 2023-07-27 10:27:56 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1472\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3679)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=6 and _weight <=9.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:35:26',4,'2023-07-27 12:27:56',4,0,NULL,NULL,NULL,'c165720f-b024-49dc-8775-49de3830ea6f'),(1473,'Clients given 4E weighing 10-13.9kg','Clients given 4E weighing 10-13.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E weighing 10-13.9kg\n Clients given 4E weighing 10-13.9kg\n \n 2022-06-30 10:36:35 UTC\n \n 2023-07-27 10:22:52 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n java.lang.String\n true\n \n \n 1473\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3679)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=10 and _weight <=13.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:36:35',4,'2023-07-27 12:22:52',4,0,NULL,NULL,NULL,'c14db25f-8596-4fae-ab12-430a740aa487'),(1474,'Clients given 4E weighing 14-19.9kg','Clients given 4E weighing 14-19.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E weighing 14-19.9kg\n Clients given 4E weighing 14-19.9kg\n \n 2022-06-30 10:38:12 UTC\n \n 2023-07-27 10:24:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1474\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3679)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=14 and _weight <=19.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:38:12',4,'2023-07-27 12:24:17',4,0,NULL,NULL,NULL,'bc5dc540-6696-47aa-a512-1cb7a78d7377'),(1475,'Clients given 4E weighing 20-24.9kg','Clients given 4E weighing 20-24.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E weighing 20-24.9kg\n Clients given 4E weighing 20-24.9kg\n \n 2022-06-30 10:40:04 UTC\n \n 2023-07-27 10:25:54 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1475\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3679)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=20 and _weight <=24.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:40:04',4,'2023-07-27 12:25:54',4,0,NULL,NULL,NULL,'221244d7-0042-432a-a711-d9cccd4358ab'),(1476,'Clients given 4E weighing 25-34.9kg','Clients given 4E weighing 25-34.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E weighing 25-34.9kg\n Clients given 4E weighing 25-34.9kg\n \n 2022-06-30 10:41:40 UTC\n \n 2023-07-27 10:26:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1476\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3679)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=25 and _weight <=34.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:41:40',4,'2023-07-27 12:26:28',4,0,NULL,NULL,NULL,'9490638d-1289-4114-bbbc-724006e38d93'),(1477,'Clients given 4E weighing >= 35kg','Clients given 4E weighing >= 35kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E weighing >= 35kg\n Clients given 4E weighing >= 35kg\n \n 2022-06-30 10:43:04 UTC\n \n 2023-07-27 10:21:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1477\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3679)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=35)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:43:04',4,'2023-07-27 12:21:29',4,0,NULL,NULL,NULL,'2bf8b315-8095-4176-ab7c-34d32e5302bb'),(1478,'Clients given 4F weighing 0-3.9kg','Clients given 4F weighing 0-3.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F weighing 0-3.9kg\n Clients given 4F weighing 0-3.9kg\n \n 2022-06-30 10:44:22 UTC\n \n 2023-07-27 10:41:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1478\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3680)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight <=3.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:44:22',4,'2023-07-27 12:41:29',4,0,NULL,NULL,NULL,'42b80ebc-ab48-48ca-a4f4-a20229c3e624'),(1479,'Clients given 4H weighing 0-3.9kg','Clients given 4H weighing 0-3.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H weighing 0-3.9kg\n Clients given 4H weighing 0-3.9kg\n \n 2022-06-30 10:44:56 UTC\n \n 2023-07-27 10:55:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1479\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4685)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight <=3.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:44:56',4,'2023-07-27 12:55:00',4,0,NULL,NULL,NULL,'4d8d584e-acb2-4935-b2ba-b1b175d8f7d5'),(1480,'Clients given 4H weighing 4-5.9kg','Clients given 4H weighing 4-5.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H weighing 4-5.9kg\n Clients given 4H weighing 4-5.9kg\n \n 2022-06-30 10:46:13 UTC\n \n 2023-07-27 10:56:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1480\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4685)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=4 and _weight <=5.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:46:13',4,'2023-07-27 12:56:53',4,0,NULL,NULL,NULL,'26f845a2-246d-468b-817a-9c60bdd078b9'),(1481,'Clients given 4F weighing 4-5.9kg','Clients given 4F weighing 4-5.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F weighing 4-5.9kg\n Clients given 4F weighing 4-5.9kg\n \n 2022-06-30 10:46:29 UTC\n \n 2023-07-27 10:43:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1481\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3680)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=4 and _weight <=5.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:46:29',4,'2023-07-27 12:43:41',4,0,NULL,NULL,NULL,'72862b43-6e4e-4a10-822f-ac5648433215'),(1482,'Clients given 4H weighing 6-9.9kg','Clients given 4H weighing 6-9.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H weighing 6-9.9kg\n Clients given 4H weighing 6-9.9kg\n \n 2022-06-30 10:46:57 UTC\n \n 2023-07-27 10:57:16 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1482\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4685)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=6 and _weight <=9.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:46:57',4,'2023-07-27 12:57:16',4,0,NULL,NULL,NULL,'01c48121-50df-46cb-8a3b-35623d584ebf'),(1483,'Clients given 4H weighing 10-13.9kg','Clients given 4H weighing 10-13.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H weighing 10-13.9kg\n Clients given 4H weighing 10-13.9kg\n \n 2022-06-30 10:47:36 UTC\n \n 2023-07-27 10:55:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1483\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4685)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=10 and _weight <=13.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:47:36',4,'2023-07-27 12:55:36',4,0,NULL,NULL,NULL,'d02359fe-619b-4a9c-871b-ae3aa3a98aa2'),(1484,'Clients given 4F weighing 6-9.9kg','Clients given 4F weighing 6-9.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F weighing 6-9.9kg\n Clients given 4F weighing 6-9.9kg\n \n 2022-06-30 10:47:39 UTC\n \n 2023-07-27 10:44:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1484\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3680)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=6 and _weight <=9.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:47:39',4,'2023-07-27 12:44:02',4,0,NULL,NULL,NULL,'b67ded87-6d0d-4d6a-8d86-01fffedfca86'),(1485,'Clients given 4F weighing 10-13.9kg','Clients given 4F weighing 10-13.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F weighing 10-13.9kg\n Clients given 4F weighing 10-13.9kg\n \n 2022-06-30 10:48:47 UTC\n \n 2023-07-27 10:41:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1485\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3680)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=10 and _weight <=13.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:48:47',4,'2023-07-27 12:41:53',4,0,NULL,NULL,NULL,'9ff30aca-0d8d-4fca-a3a9-13c0f28c48ac'),(1486,'Clients given 4H weighing 14-19.9kg','Clients given 4H weighing 14-19.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H weighing 14-19.9kg\n Clients given 4H weighing 14-19.9kg\n \n 2022-06-30 10:48:50 UTC\n \n 2023-07-27 10:55:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1486\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4685)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=14 and _weight <=19.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:48:50',4,'2023-07-27 12:55:55',4,0,NULL,NULL,NULL,'4477b341-8fb3-4d94-bc1a-cec68c45d5e8'),(1487,'Clients given 4F weighing 14-19.9kg','Clients given 4F weighing 14-19.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F weighing 14-19.9kg\n Clients given 4F weighing 14-19.9kg\n \n 2022-06-30 10:49:43 UTC\n \n 2023-07-27 10:42:09 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1487\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3680)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=14 and _weight <=19.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:49:43',4,'2023-07-27 12:42:09',4,0,NULL,NULL,NULL,'bc68c0e3-f9af-458a-9c48-e498e27e55cf'),(1488,'Clients given 4H weighing 20-24.9kg','Clients given 4H weighing 20-24.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H weighing 20-24.9kg\n Clients given 4H weighing 20-24.9kg\n \n 2022-06-30 10:49:44 UTC\n \n 2023-07-27 10:56:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1488\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4685)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=20 and _weight <=24.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:49:44',4,'2023-07-27 12:56:17',4,0,NULL,NULL,NULL,'db7df0b0-048e-4292-8047-aede481f516a'),(1489,'Clients given 4H weighing 25-34.9kg','Clients given 4H weighing 25-34.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H weighing 25-34.9kg\n Clients given 4H weighing 25-34.9kg\n \n 2022-06-30 10:50:30 UTC\n \n 2023-07-27 10:56:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1489\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4685)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=25 and _weight <=34.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:50:30',4,'2023-07-27 12:56:36',4,0,NULL,NULL,NULL,'8a0ffc3a-6f13-41d4-9012-80f7df387328'),(1490,'Clients given 4F weighing 20-24.9kg','Clients given 4F weighing 20-24.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F weighing 20-24.9kg\n Clients given 4F weighing 20-24.9kg\n \n 2022-06-30 10:50:41 UTC\n \n 2023-07-27 10:42:33 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1490\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3680)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=20 and _weight <=24.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:50:41',4,'2023-07-27 12:42:33',4,0,NULL,NULL,NULL,'acf07216-1652-4e83-9d65-6823c59981a8'),(1491,'Clients given 4H weighing >=35kg','Clients given 4H weighing >=35kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H weighing >=35kg\n Clients given 4H weighing >=35kg\n \n 2022-06-30 10:51:17 UTC\n \n 2023-07-27 10:54:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1491\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4685)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=35)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:51:17',4,'2023-07-27 12:54:12',4,0,NULL,NULL,NULL,'831a76ea-3a0d-4c8c-b68f-fcb26f67f6d8'),(1492,'Clients given 4F weighing 25-34.9kg','Clients given 4F weighing 25-34.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F weighing 25-34.9kg\n Clients given 4F weighing 25-34.9kg\n \n 2022-06-30 10:51:46 UTC\n \n 2023-07-27 10:43:13 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1492\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3680)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=25 and _weight <=34.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:51:46',4,'2023-07-27 12:43:13',4,0,NULL,NULL,NULL,'3da33639-d791-4633-8e15-b41313cb55f1'),(1493,'Clients given 4F weighing >= 35kg','Clients given 4F weighing >= 35kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F weighing >= 35kg\n Clients given 4F weighing >= 35kg\n \n 2022-06-30 10:53:56 UTC\n \n 2023-07-27 10:40:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1493\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3680)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=35)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:53:56',4,'2023-07-27 12:40:58',4,0,NULL,NULL,NULL,'c7599281-45dd-4b73-8ab0-ea8e524b98d1'),(1494,'Clients given 4G weighing 0-3.9kg','Clients given 4G weighing 0-3.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G weighing 0-3.9kg\n Clients given 4G weighing 0-3.9kg\n \n 2022-06-30 10:54:05 UTC\n \n 2023-07-27 10:46:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1494\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4684)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight <=3.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:54:05',4,'2023-07-27 12:46:39',4,0,NULL,NULL,NULL,'2475b103-3fa8-4b29-bb87-fab00aa27257'),(1495,'Clients given 4G weighing 4-5.9kg','Clients given 4G weighing 4-5.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G weighing 4-5.9kg\n Clients given 4G weighing 4-5.9kg\n \n 2022-06-30 10:55:47 UTC\n \n 2023-07-27 10:48:33 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1495\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4684)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=4 and _weight <=5.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:55:47',4,'2023-07-27 12:48:33',4,0,NULL,NULL,NULL,'b7fef4f2-1d0c-4942-88e3-45c9535ef4bc'),(1496,'Clients given 4G weighing 6-9.9kg','Clients given 4G weighing 6-9.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G weighing 6-9.9kg\n Clients given 4G weighing 6-9.9kg\n \n 2022-06-30 10:56:50 UTC\n \n 2023-07-27 10:48:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1496\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4684)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=6 and _weight <=9.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:56:50',4,'2023-07-27 12:48:51',4,0,NULL,NULL,NULL,'2539084a-3b56-4fd2-b7b7-1d75b7403e4c'),(1497,'Clients given 4G weighing 10-13.9kg','Clients given 4G weighing 10-13.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G weighing 10-13.9kg\n Clients given 4G weighing 10-13.9kg\n \n 2022-06-30 10:57:46 UTC\n \n 2023-07-27 10:47:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1497\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4684)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=10 and _weight <=13.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:57:46',4,'2023-07-27 12:47:08',4,0,NULL,NULL,NULL,'f7e13045-87fd-45c5-9e4c-818fbcb84888'),(1498,'Clients given 5A weighing 0-3.9kg','Clients given 5A weighing 0-3.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5A weighing 0-3.9kg\n Clients given 5A weighing 0-3.9kg\n \n 2022-06-30 10:58:03 UTC\n \n 2023-08-15 09:30:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1498\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5A \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3681)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=0 and _weight <=3.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:58:03',4,'2023-08-15 11:30:27',4,0,NULL,NULL,NULL,'87a82695-8e84-4f45-9b37-6fcfbdd68b9b'),(1499,'Clients given 4G weighing 14-19.9kg','Clients given 4G weighing 14-19.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G weighing 14-19.9kg\n Clients given 4G weighing 14-19.9kg\n \n 2022-06-30 10:58:40 UTC\n \n 2023-07-27 10:47:25 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1499\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4684)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=14 and _weight <=19.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:58:40',4,'2023-07-27 12:47:25',4,0,NULL,NULL,NULL,'91726710-94cf-4118-9c47-766cb5f11ae8'),(1500,'Clients given 4G weighing 20-24.9kg','Clients given 4G weighing 20-24.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G weighing 20-24.9kg\n Clients given 4G weighing 20-24.9kg\n \n 2022-06-30 10:59:29 UTC\n \n 2023-07-27 10:47:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1500\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4684)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=20 and _weight <=24.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:59:29',4,'2023-07-27 12:47:44',4,0,NULL,NULL,NULL,'e1070366-40ee-4f52-ae16-34a5de911a65'),(1501,'Clients given 4G weighing 25-34.9kg','Clients given 4G weighing 25-34.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G weighing 25-34.9kg\n Clients given 4G weighing 25-34.9kg\n \n 2022-06-30 11:00:09 UTC\n \n 2023-07-27 10:48:09 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1501\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4684)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=25 and _weight <=34.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:00:09',4,'2023-07-27 12:48:09',4,0,NULL,NULL,NULL,'d95d19d8-05d8-49d2-8b48-e0e179a7d99f'),(1502,'Clients given 5A weighing 4-5.9kg','Clients given 5A weighing 4-5.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5A weighing 4-5.9kg\n Clients given 5A weighing 4-5.9kg\n \n 2022-06-30 11:00:22 UTC\n \n 2023-08-15 10:10:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1502\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5A \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3681)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=4 and _weight <=5.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:00:22',4,'2023-08-15 12:10:02',4,0,NULL,NULL,NULL,'5b216507-efb0-46a6-a948-08f4bc7a2bf2'),(1503,'Clients given 4G weighing >=35kg','Clients given 4G weighing >=35kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G weighing >=35kg\n Clients given 4G weighing >=35kg\n \n 2022-06-30 11:00:59 UTC\n \n 2023-07-27 10:46:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1503\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4684)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=35)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:00:59',4,'2023-07-27 12:46:14',4,0,NULL,NULL,NULL,'0aa0cdb4-feed-4504-ad23-50fdfbb94347'),(1504,'Clients given 5A weighing 6-9.9kg','Clients given 5A weighing 6-9.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5A weighing 6-9.9kg\n Clients given 5A weighing 6-9.9kg\n \n 2022-06-30 11:01:39 UTC\n \n 2022-06-30 11:02:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1504\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5A \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND MONTH(os.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3681)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=6 and _weight <=9.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:01:39',4,'2022-06-30 13:02:04',4,0,NULL,NULL,NULL,'8c1a3939-af3e-4859-bc97-cfb2a9d2e712'),(1505,'Clients given 5A weighing 10-13.9kg','Clients given 5A weighing 10-13.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5A weighing 10-13.9kg\n Clients given 5A weighing 10-13.9kg\n \n 2022-06-30 11:02:41 UTC\n \n 2023-08-15 09:38:33 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1505\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5A \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3681)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=10 and _weight <=13.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:02:41',4,'2023-08-15 11:38:33',4,0,NULL,NULL,NULL,'3f90eaa0-49f7-4c6b-8ef4-9d75b1e83139'),(1506,'Clients given 5A weighing 14-19.9kg','Clients given 5A weighing 14-19.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5A weighing 14-19.9kg\n Clients given 5A weighing 14-19.9kg\n \n 2022-06-30 11:04:00 UTC\n \n 2023-08-15 09:44:19 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1506\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5A \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND MONTH(os.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3681)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=14 and _weight <=19.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:04:00',4,'2023-08-15 11:44:19',4,0,NULL,NULL,NULL,'f1b1f749-bfcc-4a13-b348-64c59866cc59'),(1507,'Clients given 5A weighing 20-24.9kg','Clients given 5A weighing 20-24.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5A weighing 20-24.9kg\n Clients given 5A weighing 20-24.9kg\n \n 2022-06-30 11:04:47 UTC\n \n 2023-08-15 09:46:25 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1507\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5A \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3681)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=20 and _weight <=24.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:04:47',4,'2023-08-15 11:46:25',4,0,NULL,NULL,NULL,'abad239c-e77e-4577-9ce7-dec2f8fec968'),(1508,'Clients given 5H weighing 0-3.9kg','Clients given 5H weighing 0-3.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5H weighing 0-3.9kg\n Clients given 5H weighing 0-3.9kg\n \n 2022-06-30 11:05:16 UTC\n \n 2022-06-30 11:05:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1508\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND MONTH(os.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4701)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight > 0 and _weight <=3.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:05:16',4,'2022-06-30 13:05:45',4,0,NULL,NULL,NULL,'6197805b-306c-4d08-8146-fa728c86cad0'),(1509,'Clients given 5A weighing 25-34.9kg','Clients given 5A weighing 25-34.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5A weighing 25-34.9kg\n Clients given 5A weighing 25-34.9kg\n \n 2022-06-30 11:05:57 UTC\n \n 2023-08-15 09:48:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1509\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5A \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3681)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=25 and _weight <=34.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:05:57',4,'2023-08-15 11:48:51',4,0,NULL,NULL,NULL,'56bc1e3d-3e39-4a2a-be29-f923f3403a9f'),(1510,'Clients given 5H weighing 4-5.9kg','Clients given 5H weighing 4-5.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5H weighing 4-5.9kg\n Clients given 5H weighing 4-5.9kg\n \n 2022-06-30 11:06:12 UTC\n \n 2022-06-30 11:06:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1510\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND MONTH(os.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4701)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 4 and _weight <=5.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:06:12',4,'2022-06-30 13:06:36',4,0,NULL,NULL,NULL,'f46b6d84-55a7-4fd0-af6d-da58bdfdadbc'),(1511,'Clients given 5A weighing >= 35kg','Clients given 5A weighing >= 35kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5A weighing >= 35kg\n Clients given 5A weighing >= 35kg\n \n 2022-06-30 11:07:03 UTC\n \n 2022-06-30 11:07:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1511\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5A \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND MONTH(os.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3681)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=35)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:07:03',4,'2022-06-30 13:07:39',4,0,NULL,NULL,NULL,'7313b979-6116-4b8c-8d45-159dce135628'),(1512,'Clients given 5H weighing 6-9.9kg','Clients given 5H weighing 6-9.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5H weighing 6-9.9kg\n Clients given 5H weighing 6-9.9kg\n \n 2022-06-30 11:07:30 UTC\n \n 2022-06-30 11:07:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1512\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND MONTH(os.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4701)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 6 and _weight <=9.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:07:30',4,'2022-06-30 13:07:53',4,0,NULL,NULL,NULL,'b302e353-da5b-495a-92bf-ac972aa7f94e'),(1513,'Clients given 5B weighing 0-3.9kg','Clients given 5B weighing 0-3.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5B weighing 0-3.9kg\n Clients given 5B weighing 0-3.9kg\n \n 2022-06-30 11:08:51 UTC\n \n 2023-08-15 10:23:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1513\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5B \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3682)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=0 and _weight <=3.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:08:51',4,'2023-08-15 12:23:59',4,0,NULL,NULL,NULL,'01fe5f00-9f8a-44c2-ba40-160f9d05d725'),(1514,'Clients given 5H weighing 10-13.9kg','Clients given 5H weighing 10-13.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5H weighing 10-13.9kg\n Clients given 5H weighing 10-13.9kg\n \n 2022-06-30 11:08:53 UTC\n \n 2022-06-30 11:09:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1514\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND MONTH(os.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4701)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 10 and _weight <=13.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:08:53',4,'2022-06-30 13:09:15',4,0,NULL,NULL,NULL,'fb13cd05-3a8a-4559-9bf2-8f2f4e2df601'),(1515,'Clients given 5H weighing 14-19.9kg','Clients given 5H weighing 14-19.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5H weighing 14-19.9kg\n Clients given 5H weighing 14-19.9kg\n \n 2022-06-30 11:09:36 UTC\n \n 2022-06-30 11:09:52 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1515\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND MONTH(os.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4701)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 14 and _weight <=19.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:09:36',4,'2022-06-30 13:09:52',4,0,NULL,NULL,NULL,'b99e2ade-ec65-4904-a6ca-e333b39322b6'),(1516,'Clients given 5H weighing 20-24.9kg','Clients given 5H weighing 20-24.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5H weighing 20-24.9kg\n Clients given 5H weighing 20-24.9kg\n \n 2022-06-30 11:10:25 UTC\n \n 2022-06-30 11:10:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1516\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND MONTH(os.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4701)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 20 and _weight <=24.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:10:25',4,'2022-06-30 13:10:43',4,0,NULL,NULL,NULL,'66408707-e4ad-4d2b-973c-77cd0220240c'),(1517,'Clients given 5B weighing 4-5.9kg','Clients given 5B weighing 4-5.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5B weighing 4-5.9kg\n Clients given 5B weighing 4-5.9kg\n \n 2022-06-30 11:10:36 UTC\n \n 2023-08-15 10:49:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1517\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5B \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3682)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=4 and _weight <=5.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:10:36',4,'2023-08-15 12:49:11',4,0,NULL,NULL,NULL,'ad0df8d9-d10d-4991-aa03-f7a96d902f69'),(1518,'Clients given 5H weighing 25-34.9kg','Clients given 5H weighing 25-34.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5H weighing 25-34.9kg\n Clients given 5H weighing 25-34.9kg\n \n 2022-06-30 11:11:12 UTC\n \n 2022-06-30 11:11:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1518\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND MONTH(os.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4701)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 25 and _weight <= 34.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:11:12',4,'2022-06-30 13:11:36',4,0,NULL,NULL,NULL,'67f0bd48-1cbf-4d6b-b037-1789f1b9f734'),(1519,'Clients given 5B weighing 6-9.9kg','Clients given 5B weighing 6-9.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5B weighing 6-9.9kg\n Clients given 5B weighing 6-9.9kg\n \n 2022-06-30 11:11:51 UTC\n \n 2023-08-15 10:50:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1519\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5B \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3682)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=6 and _weight <=9.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:11:51',4,'2023-08-15 12:50:59',4,0,NULL,NULL,NULL,'fcd13eef-bda1-46af-993f-ad29378c624a'),(1520,'Clients given 5H weighing >=35kg','Clients given 5H weighing >=35kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5H weighing >=35kg\n Clients given 5H weighing >=35kg\n \n 2022-06-30 11:12:13 UTC\n \n 2022-06-30 11:12:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1520\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND MONTH(os.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4701)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 35)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:12:13',4,'2022-06-30 13:12:39',4,0,NULL,NULL,NULL,'837029cf-0489-433f-b1f4-93207eb1bae5'),(1521,'Clients given 5B weighing 10-13.9kg','Clients given 5B weighing 10-13.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5B weighing 10-13.9kg\n Clients given 5B weighing 10-13.9kg\n \n 2022-06-30 11:13:00 UTC\n \n 2023-08-15 10:36:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1521\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5B \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3682)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=10 and _weight <=13.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:13:00',4,'2023-08-15 12:36:42',4,0,NULL,NULL,NULL,'f90822d7-8137-44bf-9b66-0022b61e1ece'),(1522,'Clients given 5B weighing 14-19.9kg','Clients given 5B weighing 14-19.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5B weighing 14-19.9kg\n Clients given 5B weighing 14-19.9kg\n \n 2022-06-30 11:13:55 UTC\n \n 2023-08-15 10:38:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1522\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5B \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3682)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=14 and _weight <=19.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:13:55',4,'2023-08-15 12:38:36',4,0,NULL,NULL,NULL,'247d8f89-0b72-4010-9328-a87600bd22d9'),(1523,'Clients given 5B weighing 20-24.9kg','Clients given 5B weighing 20-24.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5B weighing 20-24.9kg\n Clients given 5B weighing 20-24.9kg\n \n 2022-06-30 11:14:57 UTC\n \n 2023-08-15 10:43:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1523\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5B \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3682)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=20 and _weight <=24.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:14:57',4,'2023-08-15 12:43:27',4,0,NULL,NULL,NULL,'b9f0c6b6-a9f7-4ec3-9563-92a43def2068'),(1524,'Clients given 5G weighing 0-3.9kg','Clients given 5G weighing 0-3.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G weighing 0-3.9kg\n Clients given 5G weighing 0-3.9kg\n \n 2022-06-30 11:15:26 UTC\n \n 2023-08-15 14:15:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1524\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4700)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight > 0 and _weight <= 3.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:15:26',4,'2023-08-15 16:15:28',4,0,NULL,NULL,NULL,'d6899230-0f9b-4682-8822-478bfa1ad941'),(1525,'Clients given 5G weighing 4-5.9kg','Clients given 5G weighing 4-5.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G weighing 4-5.9kg\n Clients given 5G weighing 4-5.9kg\n \n 2022-06-30 11:16:09 UTC\n \n 2023-08-15 14:20:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1525\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4700)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 4 and _weight <= 5.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:16:09',4,'2023-08-15 16:20:31',4,0,NULL,NULL,NULL,'e0607707-f27c-434f-a5cd-44ed04531b3d'),(1526,'Clients given 5B weighing 25-34.9kg','Clients given 5B weighing 25-34.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5B weighing 25-34.9kg\n Clients given 5B weighing 25-34.9kg\n \n 2022-06-30 11:16:20 UTC\n \n 2023-08-15 10:46:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1526\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5B \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3682)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=25 and _weight <=34.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:16:20',4,'2023-08-15 12:46:41',4,0,NULL,NULL,NULL,'bd44e473-7f7a-4848-beb6-414f3c87ada1'),(1527,'Clients given 5G weighing 6-9.9kg','Clients given 5G weighing 6-9.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G weighing 6-9.9kg\n Clients given 5G weighing 6-9.9kg\n \n 2022-06-30 11:17:00 UTC\n \n 2023-08-15 14:21:24 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1527\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4700)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 6 and _weight <= 9.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:17:00',4,'2023-08-15 16:21:24',4,0,NULL,NULL,NULL,'2fa35676-ccce-4bde-a76f-65b9de55fd54'),(1528,'Clients given 5B weighing >= 35kg','Clients given 5B weighing >= 35kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5B weighing >= 35kg\n Clients given 5B weighing >= 35kg\n \n 2022-06-30 11:17:28 UTC\n \n 2023-08-15 10:21:09 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1528\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5B \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3682)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=35)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:17:28',4,'2023-08-15 12:21:09',4,0,NULL,NULL,NULL,'25a796fe-9437-4e38-9c95-6ef6bb295e8e'),(1529,'Clients given 5G weighing 10-13.9kg','Clients given 5G weighing 10-13.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G weighing 10-13.9kg\n Clients given 5G weighing 10-13.9kg\n \n 2022-06-30 11:18:10 UTC\n \n 2023-08-15 14:16:57 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1529\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4700)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 10 and _weight <= 13.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:18:10',4,'2023-08-15 16:16:57',4,0,NULL,NULL,NULL,'00ae6c3c-d1c6-44b8-ae77-0b0dadd15e1f'),(1530,'Clients given 5C weighing 0-3.9kg','Clients given 5C weighing 0-3.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5C weighing 0-3.9kg\n Clients given 5C weighing 0-3.9kg\n \n 2022-06-30 11:19:00 UTC\n \n 2023-08-15 10:58:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1530\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4696)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=0 and _weight <=3.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:19:00',4,'2023-08-15 12:58:29',4,0,NULL,NULL,NULL,'1e058b14-9ac4-4412-96ab-33fd04c575b0'),(1531,'Clients given 5G weighing 14-19.9kg','Clients given 5G weighing 14-19.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G weighing 14-19.9kg\n Clients given 5G weighing 14-19.9kg\n \n 2022-06-30 11:19:16 UTC\n \n 2023-08-15 14:18:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1531\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4700)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 14 and _weight <= 19.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:19:16',4,'2023-08-15 16:18:04',4,0,NULL,NULL,NULL,'2d4f2764-5ad4-4259-88bc-d6cfe29e5365'),(1532,'Clients given 5G weighing 20-24.9kg','Clients given 5G weighing 20-24.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G weighing 20-24.9kg\n Clients given 5G weighing 20-24.9kg\n \n 2022-06-30 11:19:50 UTC\n \n 2023-08-15 14:18:49 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1532\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4700)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 20 and _weight <= 24.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:19:50',4,'2023-08-15 16:18:49',4,0,NULL,NULL,NULL,'5869ce40-ff99-4614-b3f5-e058345f91a8'),(1533,'Clients given 5G weighing 25 -34.9kg','Clients given 5G weighing 25 -34.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G weighing 25 -34.9kg\n Clients given 5G weighing 25 -34.9kg\n \n 2022-06-30 11:20:43 UTC\n \n 2023-08-15 14:19:37 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1533\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4700)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 25 and _weight <= 34.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:20:43',4,'2023-08-15 16:19:37',4,0,NULL,NULL,NULL,'3134cfcd-283c-43a2-bb15-8ae6356ebbdd'),(1534,'Clients given 5C weighing 4-5.9kg','Clients given 5C weighing 4-5.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5C weighing 4-5.9kg\n Clients given 5C weighing 4-5.9kg\n \n 2022-06-30 11:21:08 UTC\n \n 2023-08-15 11:12:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1534\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4696)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=4 and _weight <=5.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:21:08',4,'2023-08-15 13:12:06',4,0,NULL,NULL,NULL,'b6a6e9f5-36ec-414e-95ec-b4a4bb1e7f77'),(1535,'Clients given 5G weighing >=35kg','Clients given 5G weighing >=35kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G weighing >=35kg\n Clients given 5G weighing >=35kg\n \n 2022-06-30 11:21:23 UTC\n \n 2023-08-15 14:14:25 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1535\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4700)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 35)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:21:23',4,'2023-08-15 16:14:25',4,0,NULL,NULL,NULL,'cb219c31-fab1-4f82-a202-48a4a8744a6e'),(1536,'Clients given 5C weighing 6-9.9kg','Clients given 5C weighing 6-9.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5C weighing 6-9.9kg\n Clients given 5C weighing 6-9.9kg\n \n 2022-06-30 11:22:17 UTC\n \n 2023-08-15 11:16:22 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1536\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4696)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=6 and _weight <=9.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:22:17',4,'2023-08-15 13:16:22',4,0,NULL,NULL,NULL,'e96a3e05-ee48-46f8-ad52-7ea11c785404'),(1537,'Clients given 5F weighing 0-3.9kg','Clients given 5F weighing 0-3.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5F weighing 0-3.9kg\n Clients given 5F weighing 0-3.9kg\n \n 2022-06-30 11:22:53 UTC\n \n 2023-08-15 13:52:56 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1537\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4699)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight > 0 and _weight <= 3.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:22:53',4,'2023-08-15 15:52:56',4,0,NULL,NULL,NULL,'3ed934cc-c2f7-4f9c-ab10-1794412389f1'),(1538,'Clients given 5C weighing 10-13.9kg','Clients given 5C weighing 10-13.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5C weighing 10-13.9kg\n Clients given 5C weighing 10-13.9kg\n \n 2022-06-30 11:23:09 UTC\n \n 2023-08-15 11:00:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1538\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND MONTH(os.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4696)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=10 and _weight <=13.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:23:09',4,'2023-08-15 13:00:14',4,0,NULL,NULL,NULL,'35aa87a9-9aec-42c6-a80d-1f71d2be1ef8'),(1539,'Clients given 5C weighing 14-19.9kg','Clients given 5C weighing 14-19.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5C weighing 14-19.9kg\n Clients given 5C weighing 14-19.9kg\n \n 2022-06-30 11:23:56 UTC\n \n 2023-08-15 11:03:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1539\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4696)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=14 and _weight <=19.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:23:56',4,'2023-08-15 13:03:40',4,0,NULL,NULL,NULL,'8827cdb6-b0b0-4dad-84d7-d06aae03ac3b'),(1540,'Clients given 5C weighing 20-24.9kg','Clients given 5C weighing 20-24.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5C weighing 20-24.9kg\n Clients given 5C weighing 20-24.9kg\n \n 2022-06-30 11:24:56 UTC\n \n 2023-08-15 11:06:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1540\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4696)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=20 and _weight <=24.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:24:56',4,'2023-08-15 13:06:21',4,0,NULL,NULL,NULL,'7cc30e9c-763c-454b-b961-d19c47d2da6a'),(1541,'Clients given 5F weighing 4-5.9kg','Clients given 5F weighing 4-5.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5F weighing 4-5.9kg\n Clients given 5F weighing 4-5.9kg\n \n 2022-06-30 11:24:57 UTC\n \n 2022-06-30 11:26:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1541\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND MONTH(os.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4699)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 4 and _weight <= 5.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:24:57',4,'2022-06-30 13:26:23',4,0,NULL,NULL,NULL,'86aec40b-a4e3-49f5-8c61-1b4395bddd75'),(1542,'Clients given 5F weighing 6-9.9kg','Clients given 5F weighing 6-9.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5F weighing 6-9.9kg\n Clients given 5F weighing 6-9.9kg\n \n 2022-06-30 11:25:26 UTC\n \n 2023-08-15 14:09:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1542\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4699)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 6 and _weight <= 9.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:25:26',4,'2023-08-15 16:09:20',4,0,NULL,NULL,NULL,'74ddbe48-ab4a-40e2-be97-c0ecfca4ec3d'),(1543,'Clients given 5C weighing 25-34.9kg','Clients given 5C weighing 25-34.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5C weighing 25-34.9kg\n Clients given 5C weighing 25-34.9kg\n \n 2022-06-30 11:26:03 UTC\n \n 2022-06-30 11:26:35 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1543\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND MONTH(os.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4696)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=25 and _weight <=34.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:26:03',4,'2022-06-30 13:26:35',4,0,NULL,NULL,NULL,'62831d13-bff3-4d96-b097-03c7f656489c'),(1544,'Clients given 5F weighing 10-13.9kg','Clients given 5F weighing 10-13.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5F weighing 10-13.9kg\n Clients given 5F weighing 10-13.9kg\n \n 2022-06-30 11:26:51 UTC\n \n 2023-08-15 13:54:54 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1544\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4699)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 10 and _weight <= 13.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:26:51',4,'2023-08-15 15:54:54',4,0,NULL,NULL,NULL,'32b14f2b-ab48-4905-a130-7cc98fadc7a3'),(1545,'Clients given 5C weighing >= 35kg','Clients given 5C weighing >= 35kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5C weighing >= 35kg\n Clients given 5C weighing >= 35kg\n \n 2022-06-30 11:27:06 UTC\n \n 2023-08-15 10:56:19 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1545\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4696)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=35)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:27:06',4,'2023-08-15 12:56:19',4,0,NULL,NULL,NULL,'2253da71-2fae-4683-87c0-4e876e27b5d9'); INSERT INTO `serialized_object` VALUES (1546,'Clients given 5F weighing 14-19.9kg','Clients given 5F weighing 14-19.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5F weighing 14-19.9kg\n Clients given 5F weighing 14-19.9kg\n \n 2022-06-30 11:27:37 UTC\n \n 2023-08-15 13:58:33 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1546\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4699)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 14 and _weight <= 19.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:27:37',4,'2023-08-15 15:58:33',4,0,NULL,NULL,NULL,'ce94925c-9501-475d-8ab6-9a34881d6c9a'),(1547,'Clients given 5F weighing 20-24.9kg','Clients given 5F weighing 20-24.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5F weighing 20-24.9kg\n Clients given 5F weighing 20-24.9kg\n \n 2022-06-30 11:28:13 UTC\n \n 2023-08-15 14:00:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1547\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4699)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 20 and _weight <= 24.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:28:13',4,'2023-08-15 16:00:55',4,0,NULL,NULL,NULL,'4e2fdf19-88d3-404b-8467-adbaba647c6c'),(1548,'Clients given 5D weighing 0-3.9kg','Clients given 5D weighing 0-3.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5D weighing 0-3.9kg\n Clients given 5D weighing 0-3.9kg\n \n 2022-06-30 11:28:24 UTC\n \n 2023-08-15 11:28:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1548\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5D \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4697)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=0 and _weight <=3.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:28:24',4,'2023-08-15 13:28:55',4,0,NULL,NULL,NULL,'9b7dc1a8-9c16-4ece-bf35-c13c45e27fd9'),(1549,'Clients given 5F weighing 25-34.9kg','Clients given 5F weighing 25-34.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5F weighing 25-34.9kg\n Clients given 5F weighing 25-34.9kg\n \n 2022-06-30 11:28:59 UTC\n \n 2023-08-15 14:02:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1549\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4699)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 25 and _weight <= 34.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:28:59',4,'2023-08-15 16:02:41',4,0,NULL,NULL,NULL,'8a336065-e783-4b0b-bfba-d49c0507171c'),(1550,'Clients given 5D weighing 4-5.9kg','Clients given 5D weighing 4-5.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5D weighing 4-5.9kg\n Clients given 5D weighing 4-5.9kg\n \n 2022-06-30 11:29:51 UTC\n \n 2023-08-15 12:02:22 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1550\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5D \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4697)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=4 and _weight <=5.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:29:51',4,'2023-08-15 14:02:22',4,0,NULL,NULL,NULL,'19fcd7c2-7d0e-4f89-8893-b7e56a90f565'),(1551,'Clients given 5F weighing >=35kg','Clients given 5F weighing >=35kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5F weighing >=35kg\n Clients given 5F weighing >=35kg\n \n 2022-06-30 11:30:09 UTC\n \n 2023-08-15 13:45:47 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1551\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4699)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 35)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:30:09',4,'2023-08-15 15:45:47',4,0,NULL,NULL,NULL,'8d926451-29fe-44cb-9898-a0aed10c3786'),(1552,'Clients given 5D weighing 6-9.9kg','Clients given 5D weighing 6-9.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5D weighing 6-9.9kg\n Clients given 5D weighing 6-9.9kg\n \n 2022-06-30 11:30:53 UTC\n \n 2023-08-15 12:03:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1552\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5D \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4697)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=6 and _weight <=9.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:30:53',4,'2023-08-15 14:03:43',4,0,NULL,NULL,NULL,'c4e2b4a6-62d3-4828-9088-05f88efd29d0'),(1553,'Clients given 5D weighing 10-13.9kg','Clients given 5D weighing 10-13.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5D weighing 10-13.9kg\n Clients given 5D weighing 10-13.9kg\n \n 2022-06-30 11:32:07 UTC\n \n 2023-08-15 11:52:13 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1553\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5D \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4697)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=10 and _weight <=13.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:32:07',4,'2023-08-15 13:52:13',4,0,NULL,NULL,NULL,'af887c72-8ee7-4273-abe0-8755f691eeb7'),(1554,'Clients given 5E weighing 0-3.9kg','Clients given 5E weighing 0-3.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5E weighing 0-3.9kg\n Clients given 5E weighing 0-3.9kg\n \n 2022-06-30 11:33:14 UTC\n \n 2023-08-15 12:11:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1554\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4698)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 0 and _weight <= 3.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:33:14',4,'2023-08-15 14:11:02',4,0,NULL,NULL,NULL,'e79351a3-8b87-48de-879e-7f531c97ae16'),(1555,'Clients given 5D weighing 14-19.9kg','Clients given 5D weighing 14-19.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5D weighing 14-19.9kg\n Clients given 5D weighing 14-19.9kg\n \n 2022-06-30 11:33:21 UTC\n \n 2023-08-15 11:55:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1555\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5D \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4697)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=14 and _weight <=19.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:33:21',4,'2023-08-15 13:55:11',4,0,NULL,NULL,NULL,'412170be-ff0c-4690-bc21-2fe362faafb1'),(1556,'Clients given 5E weighing 4-5.9kg','Clients given 5E weighing 4-5.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5E weighing 4-5.9kg\n Clients given 5E weighing 4-5.9kg\n \n 2022-06-30 11:34:03 UTC\n \n 2023-08-15 12:22:56 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1556\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4698)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 4 and _weight <= 5.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:34:03',4,'2023-08-15 14:22:56',4,0,NULL,NULL,NULL,'a6067fc6-8c70-4691-aa23-3e5a7973d4e4'),(1557,'Clients given 5D weighing 20-24.9kg','Clients given 5D weighing 20-24.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5D weighing 20-24.9kg\n Clients given 5D weighing 20-24.9kg\n \n 2022-06-30 11:34:31 UTC\n \n 2023-08-15 11:57:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1557\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5D \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4697)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=20 and _weight <=24.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:34:31',4,'2023-08-15 13:57:06',4,0,NULL,NULL,NULL,'b12b32c4-ae91-44c1-bb7a-f2a4f0f74dcc'),(1558,'Clients given 5E weighing 6-9.9kg','Clients given 5E weighing 6-9.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5E weighing 6-9.9kg\n Clients given 5E weighing 6-9.9kg\n \n 2022-06-30 11:34:43 UTC\n \n 2023-08-15 12:23:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1558\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4698)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 6 and _weight <= 9.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:34:43',4,'2023-08-15 14:23:53',4,0,NULL,NULL,NULL,'ddbb6383-120a-4cfc-b376-eb9ec22e891b'),(1559,'Clients given 5E weighing 10-13.9kg','Clients given 5E weighing 10-13.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5E weighing 10-13.9kg\n Clients given 5E weighing 10-13.9kg\n \n 2022-06-30 11:35:22 UTC\n \n 2023-08-15 12:13:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1559\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4698)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 10 and _weight <= 13.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:35:22',4,'2023-08-15 14:13:26',4,0,NULL,NULL,NULL,'9334b5ec-d46f-465b-91f5-aba7e4f590a0'),(1560,'Clients given 5D weighing 25-34.9kg','Clients given 5D weighing 25-34.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5D weighing 25-34.9kg\n Clients given 5D weighing 25-34.9kg\n \n 2022-06-30 11:35:31 UTC\n \n 2023-08-15 11:59:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1560\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5D \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4697)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=25 and _weight <=34.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:35:31',4,'2023-08-15 13:59:41',4,0,NULL,NULL,NULL,'88ff4abe-3367-4de0-be20-eaa6991568ce'),(1561,'Clients given 5E weighing 14-19.9kg','Clients given 5E weighing 14-19.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5E weighing 14-19.9kg\n Clients given 5E weighing 14-19.9kg\n \n 2022-06-30 11:36:01 UTC\n \n 2023-08-15 12:14:47 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1561\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4698)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 14 and _weight <= 19.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:36:01',4,'2023-08-15 14:14:47',4,0,NULL,NULL,NULL,'1514aaa6-288c-423b-96e6-ae5ee9074647'),(1562,'Clients given 5E weighing 20-24.9kg','Clients given 5E weighing 20-24.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5E weighing 20-24.9kg\n Clients given 5E weighing 20-24.9kg\n \n 2022-06-30 11:36:43 UTC\n \n 2023-08-15 12:20:37 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1562\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4698)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 20 and _weight <= 24.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:36:43',4,'2023-08-15 14:20:37',4,0,NULL,NULL,NULL,'28e98d97-dc6d-412f-89cb-3f19cd4d38b9'),(1563,'Clients given 5D weighing >= 35kg','Clients given 5D weighing >= 35kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5D weighing >= 35kg\n Clients given 5D weighing >= 35kg\n \n 2022-06-30 11:36:48 UTC\n \n 2023-08-15 11:23:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1563\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5D \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4697)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=35)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:36:48',4,'2023-08-15 13:23:11',4,0,NULL,NULL,NULL,'b4d8909f-2edb-4730-bf71-446d2fd8867c'),(1564,'Clients given 5E weighing 25-34.9kg','Clients given 5E weighing 25-34.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5E weighing 25-34.9kg\n Clients given 5E weighing 25-34.9kg\n \n 2022-06-30 11:37:59 UTC\n \n 2023-08-15 12:21:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1564\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4698)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 25 and _weight <= 34.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:37:59',4,'2023-08-15 14:21:55',4,0,NULL,NULL,NULL,'decbe846-1d21-400e-93c7-d535d80c75c2'),(1565,'Clients given 6A weighing 0-3.9kg','Clients given 6A weighing 0-3.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6A weighing 0-3.9kg\n Clients given 6A weighing 0-3.9kg\n \n 2022-06-30 11:38:28 UTC\n \n 2023-08-15 11:50:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1565\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6A \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight <=3.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:38:28',4,'2023-08-15 13:50:29',4,0,NULL,NULL,NULL,'9612971e-a174-4a5f-8fbd-59eec5a601b2'),(1566,'Clients given 5E weighing >=35kg','Clients given 5E weighing >=35kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5E weighing >=35kg\n Clients given 5E weighing >=35kg\n \n 2022-06-30 11:38:46 UTC\n \n 2023-08-15 12:08:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1566\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4698)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 35)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:38:46',4,'2023-08-15 14:08:51',4,0,NULL,NULL,NULL,'8e471ec5-2e65-4ade-9508-52eabac321a3'),(1567,'Clients given 6F weighing 0-3.9kg','Clients given 6F weighing 0-3.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F weighing 0-3.9kg\n Clients given 6F weighing 0-3.9kg\n \n 2022-06-30 11:41:42 UTC\n \n 2023-08-15 11:55:19 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1567\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4705)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight <=3.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:41:42',4,'2023-08-15 13:55:19',4,0,NULL,NULL,NULL,'21f2534a-381c-427b-85d0-2e8a156f55cc'),(1568,'Clients given 6A weighing 4-5.9kg','Clients given 6A weighing 4-5.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6A weighing 4-5.9kg\n Clients given 6A weighing 4-5.9kg\n \n 2022-06-30 11:42:04 UTC\n \n 2023-08-15 11:58:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1568\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6A \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=4 and _weight <=5.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:42:04',4,'2023-08-15 13:58:40',4,0,NULL,NULL,NULL,'349f5e74-fd1f-46ca-b279-089ec17daa3c'),(1569,'Clients given 6F weighing 4-5.9kg','Clients given 6F weighing 4-5.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F weighing 4-5.9kg\n Clients given 6F weighing 4-5.9kg\n \n 2022-06-30 11:42:52 UTC\n \n 2023-08-15 12:01:56 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1569\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4705)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=4 and _weight <=5.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:42:52',4,'2023-08-15 14:01:56',4,0,NULL,NULL,NULL,'6d6fd933-e915-4eb2-aa0a-5f9a3fc39c9e'),(1570,'Clients given 6A weighing 6-9.9kg','Clients given 6A weighing 6-9.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6A weighing 6-9.9kg\n Clients given 6A weighing 6-9.9kg\n \n 2022-06-30 11:42:56 UTC\n \n 2023-08-15 12:07:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1570\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6A \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=6 and _weight <=9.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:42:56',4,'2023-08-15 14:07:06',4,0,NULL,NULL,NULL,'d6cf3e57-fba8-4961-83e9-e0c69b152e91'),(1571,'Clients given 6F weighing 6-9.9kg','Clients given 6F weighing 6-9.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F weighing 6-9.9kg\n Clients given 6F weighing 6-9.9kg\n \n 2022-06-30 11:43:28 UTC\n \n 2023-08-15 12:11:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1571\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4705)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=6 and _weight <=9.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:43:28',4,'2023-08-15 14:11:18',4,0,NULL,NULL,NULL,'07ebdb1b-42fd-4338-9880-b53a0e857d14'),(1572,'Clients given 6A weighing 10-13.9kg','Clients given 6A weighing 10-13.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6A weighing 10-13.9kg\n Clients given 6A weighing 10-13.9kg\n \n 2022-06-30 11:43:45 UTC\n \n 2023-08-15 12:19:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1572\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6A \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=10 and _weight <=13.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:43:45',4,'2023-08-15 14:19:36',4,0,NULL,NULL,NULL,'de6af126-f558-4acf-b061-982dbfac0025'),(1573,'Clients given 6F weighing 10-13.9kg','Clients given 6F weighing 10-13.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F weighing 10-13.9kg\n Clients given 6F weighing 10-13.9kg\n \n 2022-06-30 11:44:06 UTC\n \n 2023-08-15 12:14:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1573\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4705)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=10 and _weight <=13.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:44:06',4,'2023-08-15 14:14:29',4,0,NULL,NULL,NULL,'e77aeb5b-70e2-46a1-9451-be37911a5dc0'),(1574,'Clients given 6A weighing 14-19.9kg','Clients given 6A weighing 14-19.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6A weighing 14-19.9kg\n Clients given 6A weighing 14-19.9kg\n \n 2022-06-30 11:44:40 UTC\n \n 2023-08-15 13:36:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1574\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6A \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=14 and _weight <=19.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:44:40',4,'2023-08-15 15:36:18',4,0,NULL,NULL,NULL,'6850d21e-415b-4941-aa12-ddcf45ebf1cf'),(1575,'Clients given 6F weighing 14-19.9kg','Clients given 6F weighing 14-19.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F weighing 14-19.9kg\n Clients given 6F weighing 14-19.9kg\n \n 2022-06-30 11:44:51 UTC\n \n 2023-08-15 13:39:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1575\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4705)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=14 and _weight <=19.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:44:51',4,'2023-08-15 15:39:53',4,0,NULL,NULL,NULL,'bffbdb83-5c53-4429-baca-46ef480cbbdd'),(1576,'Clients given 6A weighing 20-24.9kg','Clients given 6A weighing 20-24.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6A weighing 20-24.9kg\n Clients given 6A weighing 20-24.9kg\n \n 2022-06-30 11:45:34 UTC\n \n 2023-08-15 13:43:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1576\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6A \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=20 and _weight <=24.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:45:34',4,'2023-08-15 15:43:08',4,0,NULL,NULL,NULL,'00c9ee8c-dd26-4de8-8d76-65235331fc58'),(1577,'Clients given 6F weighing 20-24.9kg','Clients given 6F weighing 20-24.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F weighing 20-24.9kg\n Clients given 6F weighing 20-24.9kg\n \n 2022-06-30 11:45:40 UTC\n \n 2023-08-15 13:46:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1577\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4705)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=20 and _weight <=24.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:45:40',4,'2023-08-15 15:46:12',4,0,NULL,NULL,NULL,'1907619e-e315-4136-b63d-ebb12d9a8fc1'),(1578,'Clients given 6F weighing 25-34.9kg','Clients given 6F weighing 25-34.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F weighing 25-34.9kg\n Clients given 6F weighing 25-34.9kg\n \n 2022-06-30 11:46:30 UTC\n \n 2023-08-15 13:54:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1578\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4705)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=25 and _weight <=34.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:46:30',4,'2023-08-15 15:54:43',4,0,NULL,NULL,NULL,'67151923-545c-44f9-955c-705bd4b86bd8'),(1579,'Clients given 6A weighing 25-34.9kg','Clients given 6A weighing 25-34.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6A weighing 25-34.9kg\n Clients given 6A weighing 25-34.9kg\n \n 2022-06-30 11:46:33 UTC\n \n 2023-08-15 13:52:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1579\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6A \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=25 and _weight <=34.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:46:33',4,'2023-08-15 15:52:05',4,0,NULL,NULL,NULL,'c4410a3f-a272-4f5a-8b68-c293b482c8f2'),(1580,'Clients given 6F weighing >=35kg','Clients given 6F weighing >=35kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F weighing >=35kg\n Clients given 6F weighing >=35kg\n \n 2022-06-30 11:47:14 UTC\n \n 2023-08-15 14:01:34 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1580\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4705)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=35)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:47:14',4,'2023-08-15 16:01:34',4,0,NULL,NULL,NULL,'88e71ca5-8e27-438a-ad22-12007acc675a'),(1581,'Clients given 6A weighing >= 35kg','Clients given 6A weighing >= 35kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6A weighing >= 35kg\n Clients given 6A weighing >= 35kg\n \n 2022-06-30 11:47:26 UTC\n \n 2023-08-15 13:58:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1581\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6A \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=35)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:47:26',4,'2023-08-15 15:58:50',4,0,NULL,NULL,NULL,'120fc355-ea4b-4d74-9df3-713f396ad4d5'),(1582,'Clients given 6B weighing 0-3.9kg','Clients given 6B weighing 0-3.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6B weighing 0-3.9kg\n Clients given 6B weighing 0-3.9kg\n \n 2022-06-30 11:49:06 UTC\n \n 2023-08-15 11:51:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1582\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6B \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight <=3.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:49:06',4,'2023-08-15 13:51:04',4,0,NULL,NULL,NULL,'c94b83be-7708-46c9-803c-369d803ce612'),(1583,'Clients given 6E weighing 0-3.9kg','Clients given 6E weighing 0-3.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E weighing 0-3.9kg\n Clients given 6E weighing 0-3.9kg\n \n 2022-06-30 11:49:10 UTC\n \n 2023-08-15 11:55:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1583\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4704)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight <=3.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:49:10',4,'2023-08-15 13:55:28',4,0,NULL,NULL,NULL,'79f4464f-be3a-4f76-b911-1324264edb34'),(1584,'Clients given 6E weighing 4-5.9kg','Clients given 6E weighing 4-5.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E weighing 4-5.9kg\n Clients given 6E weighing 4-5.9kg\n \n 2022-06-30 11:50:19 UTC\n \n 2023-08-15 12:02:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1584\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4704)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=4 and _weight <=5.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:50:19',4,'2023-08-15 14:02:30',4,0,NULL,NULL,NULL,'c940a6d2-b183-4f3d-99c3-757c98c1d95d'),(1585,'Clients given 6B weighing 4-5.9kg','Clients given 6B weighing 4-5.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6B weighing 4-5.9kg\n Clients given 6B weighing 4-5.9kg\n \n 2022-06-30 11:50:41 UTC\n \n 2023-08-15 12:03:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1585\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6B \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=4 and _weight <=5.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:50:41',4,'2023-08-15 14:03:18',4,0,NULL,NULL,NULL,'b03e49d3-e03b-4a31-b0c9-dc33942ca80b'),(1586,'Clients given 6E weighing 6-9.9kg','Clients given 6E weighing 6-9.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E weighing 6-9.9kg\n Clients given 6E weighing 6-9.9kg\n \n 2022-06-30 11:51:01 UTC\n \n 2023-08-15 12:11:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1586\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4704)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=6 and _weight <=9.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:51:01',4,'2023-08-15 14:11:10',4,0,NULL,NULL,NULL,'b0f0ed35-fe90-4552-83a7-e10c1b509fdb'),(1587,'Clients given 6B weighing 6-9.9kg','Clients given 6B weighing 6-9.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6B weighing 6-9.9kg\n Clients given 6B weighing 6-9.9kg\n \n 2022-06-30 11:51:24 UTC\n \n 2023-08-15 12:07:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1587\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6B \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=6 and _weight <=9.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:51:24',4,'2023-08-15 14:07:40',4,0,NULL,NULL,NULL,'9b75e9b1-6086-4d10-aa5d-f574d58c2f9b'),(1588,'Clients given 6E weighing 10-13.9kg','Clients given 6E weighing 10-13.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E weighing 10-13.9kg\n Clients given 6E weighing 10-13.9kg\n \n 2022-06-30 11:51:37 UTC\n \n 2023-08-15 12:15:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1588\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4704)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=10 and _weight <=13.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:51:37',4,'2023-08-15 14:15:07',4,0,NULL,NULL,NULL,'4ab54017-730b-443b-b1a4-c7fb57c16069'),(1589,'Clients given 6B weighing 10-13.9kg','Clients given 6B weighing 10-13.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6B weighing 10-13.9kg\n Clients given 6B weighing 10-13.9kg\n \n 2022-06-30 11:52:19 UTC\n \n 2023-08-15 12:18:48 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1589\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6B \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=10 and _weight <=13.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:52:19',4,'2023-08-15 14:18:48',4,0,NULL,NULL,NULL,'439b52c1-c9d5-4366-9819-994f121bf0fa'),(1590,'Clients given 6E weighing 14-19.9kg','Clients given 6E weighing 14-19.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E weighing 14-19.9kg\n Clients given 6E weighing 14-19.9kg\n \n 2022-06-30 11:52:28 UTC\n \n 2023-08-15 13:39:35 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1590\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4704)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=14 and _weight <=19.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:52:28',4,'2023-08-15 15:39:35',4,0,NULL,NULL,NULL,'4a2873d6-97bb-42b9-8e4f-4786bf854462'),(1591,'Clients given 6E weighing 20-24.9kg','Clients given 6E weighing 20-24.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E weighing 20-24.9kg\n Clients given 6E weighing 20-24.9kg\n \n 2022-06-30 11:53:12 UTC\n \n 2023-08-15 13:45:54 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1591\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4704)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=20 and _weight <=24.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:53:12',4,'2023-08-15 15:45:54',4,0,NULL,NULL,NULL,'e129484c-9b6b-4ed5-a0b8-da691370e459'),(1592,'Clients given 6B weighing 14-19.9kg','Clients given 6B weighing 14-19.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6B weighing 14-19.9kg\n Clients given 6B weighing 14-19.9kg\n \n 2022-06-30 11:53:32 UTC\n \n 2023-08-15 13:38:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1592\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6B \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=14 and _weight <=19.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:53:32',4,'2023-08-15 15:38:03',4,0,NULL,NULL,NULL,'af7d5255-1e37-4def-b26d-dcded87c1ded'),(1593,'Clients given 6E weighing 25-34.9kg','Clients given 6E weighing 25-34.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E weighing 25-34.9kg\n Clients given 6E weighing 25-34.9kg\n \n 2022-06-30 11:54:08 UTC\n \n 2023-08-15 13:54:22 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1593\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4704)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=25 and _weight <=34.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:54:08',4,'2023-08-15 15:54:22',4,0,NULL,NULL,NULL,'5c8f4cdd-6c22-4df0-8d12-801a66ccff55'),(1594,'Clients given 6B weighing 20-24.9kg','Clients given 6B weighing 20-24.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6B weighing 20-24.9kg\n Clients given 6B weighing 20-24.9kg\n \n 2022-06-30 11:54:35 UTC\n \n 2023-08-15 13:43:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1594\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6B \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=20 and _weight <=24.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:54:35',4,'2023-08-15 15:43:29',4,0,NULL,NULL,NULL,'3d5ca230-bb1a-40ad-9a13-ae3d4a7868c1'),(1595,'Clients given 6E weighing >=35kg','Clients given 6E weighing >=35kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E weighing >=35kg\n Clients given 6E weighing >=35kg\n \n 2022-06-30 11:54:50 UTC\n \n 2023-08-15 14:01:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1595\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4704)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=35)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:54:50',4,'2023-08-15 16:01:10',4,0,NULL,NULL,NULL,'0ed30402-06d4-4a91-ab30-8aa4cb05f973'),(1596,'Clients given 6B weighing 25-34.9kg','Clients given 6B weighing 25-34.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6B weighing 25-34.9kg\n Clients given 6B weighing 25-34.9kg\n \n 2022-06-30 11:55:30 UTC\n \n 2023-08-15 13:52:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1596\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6B \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=25 and _weight <=34.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:55:30',4,'2023-08-15 15:52:19',4,0,NULL,NULL,NULL,'760b7d9e-5a7e-4a13-9517-59f18a299d60'),(1597,'Clients given 6B weighing >= 35kg','Clients given 6B weighing >= 35kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6B weighing >= 35kg\n Clients given 6B weighing >= 35kg\n \n 2022-06-30 11:56:44 UTC\n \n 2023-08-15 14:00:19 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1597\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6B \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=35)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:56:44',4,'2023-08-15 16:00:19',4,0,NULL,NULL,NULL,'89e94627-eb6a-4b05-8b5c-7c06482c67da'),(1598,'Clients given 6D weighing 0-3.9kg','Clients given 6D weighing 0-3.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D weighing 0-3.9kg\n Clients given 6D weighing 0-3.9kg\n \n 2022-06-30 11:57:07 UTC\n \n 2023-08-15 11:55:38 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1598\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6D \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4703)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight <=3.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:57:07',4,'2023-08-15 13:55:38',4,0,NULL,NULL,NULL,'c5ecfc78-4201-495c-9c7d-042b046d6c3d'),(1599,'Clients given 6D weighing 4-5.9kg','Clients given 6D weighing 4-5.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D weighing 4-5.9kg\n Clients given 6D weighing 4-5.9kg\n \n 2022-06-30 11:57:58 UTC\n \n 2023-08-15 12:02:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1599\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6D \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4703)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=4 and _weight <=5.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:57:58',4,'2023-08-15 14:02:40',4,0,NULL,NULL,NULL,'25950d8e-2a7a-484f-8674-e94ba2fc9071'),(1600,'Clients given 6C weighing 0-3.9kg','Clients given 6C weighing 0-3.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C weighing 0-3.9kg\n Clients given 6C weighing 0-3.9kg\n \n 2022-06-30 11:58:17 UTC\n \n 2023-08-15 11:52:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1600\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4702)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight <=3.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:58:17',4,'2023-08-15 13:52:01',4,0,NULL,NULL,NULL,'6eff51d3-2d07-44db-a617-ff288d027867'),(1601,'Clients given 6D weighing 6-9.9kg','Clients given 6D weighing 6-9.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D weighing 6-9.9kg\n Clients given 6D weighing 6-9.9kg\n \n 2022-06-30 11:58:42 UTC\n \n 2023-08-15 12:10:38 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1601\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6D \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4703)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=6 and _weight <=9.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:58:42',4,'2023-08-15 14:10:38',4,0,NULL,NULL,NULL,'0b2e111f-f266-4a34-ba0b-4080607ca595'),(1602,'Clients given 6D weighing 10-13.9kg','Clients given 6D weighing 10-13.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D weighing 10-13.9kg\n Clients given 6D weighing 10-13.9kg\n \n 2022-06-30 11:59:37 UTC\n \n 2023-08-15 12:15:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1602\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6D \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4703)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=10 and _weight <=13.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:59:37',4,'2023-08-15 14:15:29',4,0,NULL,NULL,NULL,'d13d961e-4f19-4d97-88f5-f0795b285859'),(1603,'Clients given 6D weighing 14-19.9kg','Clients given 6D weighing 14-19.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D weighing 14-19.9kg\n Clients given 6D weighing 14-19.9kg\n \n 2022-06-30 12:00:32 UTC\n \n 2023-08-15 13:39:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1603\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6D \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4703)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=14 and _weight <=19.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 14:00:32',4,'2023-08-15 15:39:12',4,0,NULL,NULL,NULL,'ba0967aa-34e7-4df6-a75b-cbe7c8b52cea'),(1604,'Clients given 6C weighing 4-5.9kg','Clients given 6C weighing 4-5.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C weighing 4-5.9kg\n Clients given 6C weighing 4-5.9kg\n \n 2022-06-30 12:00:54 UTC\n \n 2023-08-15 12:02:57 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1604\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4702)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=4 and _weight <=5.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 14:00:54',4,'2023-08-15 14:02:57',4,0,NULL,NULL,NULL,'9538730a-29f7-45cc-a6e5-4b20a1b80f2f'),(1605,'Clients given 6D weighing 20-24.9kg','Clients given 6D weighing 20-24.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D weighing 20-24.9kg\n Clients given 6D weighing 20-24.9kg\n \n 2022-06-30 12:01:12 UTC\n \n 2023-08-15 13:45:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1605\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6D \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4703)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=20 and _weight <=24.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 14:01:12',4,'2023-08-15 15:45:42',4,0,NULL,NULL,NULL,'87b14d09-b20e-47d1-b20e-c38bc338df15'),(1606,'Clients given 6D weighing 25-34.9kg','Clients given 6D weighing 25-34.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D weighing 25-34.9kg\n Clients given 6D weighing 25-34.9kg\n \n 2022-06-30 12:01:59 UTC\n \n 2023-08-15 13:54:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1606\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6D \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4703)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=25 and _weight <=34.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 14:01:59',4,'2023-08-15 15:54:05',4,0,NULL,NULL,NULL,'9b8508f6-6c59-4408-90d1-4366ad9f3df7'),(1607,'Clients given 6C weighing 6-9.9kg','Clients given 6C weighing 6-9.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C weighing 6-9.9kg\n Clients given 6C weighing 6-9.9kg\n \n 2022-06-30 12:02:20 UTC\n \n 2023-08-15 12:08:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1607\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4702)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=6 and _weight <=9.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 14:02:20',4,'2023-08-15 14:08:10',4,0,NULL,NULL,NULL,'021aecf8-4314-4feb-921d-dbab609bce88'),(1608,'Clients given 6D weighing >=35kg','Clients given 6D weighing >=35kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D weighing >=35kg\n Clients given 6D weighing >=35kg\n \n 2022-06-30 12:02:42 UTC\n \n 2023-08-15 14:00:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1608\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6D \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4703)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=35)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 14:02:42',4,'2023-08-15 16:00:51',4,0,NULL,NULL,NULL,'6b8cf9ee-1659-46da-8aab-1580ccd82fe7'),(1609,'Clients given 6C weighing 10-13.9kg','Clients given 6C weighing 10-13.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C weighing 10-13.9kg\n Clients given 6C weighing 10-13.9kg\n \n 2022-06-30 12:03:07 UTC\n \n 2023-08-15 12:15:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1609\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4702)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=10 and _weight <=13.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 14:03:07',4,'2023-08-15 14:15:45',4,0,NULL,NULL,NULL,'e43ddc56-97c9-4c2b-9dd1-4439ab2d154e'),(1610,'Clients given 6C weighing 14-19.9kg','Clients given 6C weighing 14-19.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C weighing 14-19.9kg\n Clients given 6C weighing 14-19.9kg\n \n 2022-06-30 12:03:52 UTC\n \n 2023-08-15 13:38:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1610\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4702)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=14 and _weight <=19.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 14:03:52',4,'2023-08-15 15:38:51',4,0,NULL,NULL,NULL,'7cc34bd7-01dc-4e10-97b4-3aabce82e0d2'),(1611,'Clients given 6C weighing 20-24.9kg','Clients given 6C weighing 20-24.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C weighing 20-24.9kg\n Clients given 6C weighing 20-24.9kg\n \n 2022-06-30 12:05:08 UTC\n \n 2023-08-15 13:45:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1611\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4702)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=20 and _weight <=24.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 14:05:08',4,'2023-08-15 15:45:29',4,0,NULL,NULL,NULL,'eb9fff17-d2d9-4c0a-a4ff-919fe86f2cfe'),(1612,'Clients given 6C weighing 25-34.9kg','Clients given 6C weighing 25-34.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C weighing 25-34.9kg\n Clients given 6C weighing 25-34.9kg\n \n 2022-06-30 12:06:35 UTC\n \n 2023-08-15 13:52:38 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1612\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4702)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=25 and _weight <=34.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 14:06:35',4,'2023-08-15 15:52:38',4,0,NULL,NULL,NULL,'95004055-2dd1-4b3c-9536-877974c6fc23'),(1613,'Clients given 6C weighing >= 35kg','Clients given 6C weighing >= 35kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C weighing >= 35kg\n Clients given 6C weighing >= 35kg\n \n 2022-06-30 12:07:48 UTC\n \n 2023-08-15 14:00:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1613\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4702)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=35)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 14:07:48',4,'2023-08-15 16:00:36',4,0,NULL,NULL,NULL,'a5659098-23a4-41c0-8bbd-12dd4c9bca64'),(1614,'Clients given 4C weighing 0-3.9kg','Clients given 4C weighing 0-3.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.SqlIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C weighing 0-3.9kg\n Clients given 4C weighing 0-3.9kg\n \n 2022-06-30 12:15:27 UTC\n \n','2022-06-30 14:15:27',4,NULL,NULL,0,NULL,NULL,NULL,'46894193-4656-4941-9050-4498338da679'),(1615,'Clients given 4C weighing 0-3.9kg','Clients given 4C weighing 0-3.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C weighing 0-3.9kg\n Clients given 4C weighing 0-3.9kg\n \n 2022-06-30 12:16:38 UTC\n \n 2022-06-30 12:20:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1615\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 14:16:38',4,'2022-06-30 14:20:27',4,0,NULL,NULL,NULL,'4a2b667a-930c-4d98-9073-18aa9e6104ec'),(1616,'Clients given 4C weighing 4-5.9kg','Clients given 4C weighing 4-5.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C weighing 4-5.9kg\n Clients given 4C weighing 4-5.9kg\n \n 2022-06-30 12:21:22 UTC\n \n 2022-06-30 12:23:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1616\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 14:21:22',4,'2022-06-30 14:23:05',4,0,NULL,NULL,NULL,'aa294dde-6440-4b72-ab4a-d5b782cec371'),(1617,'Clients given 4C weighing 6-9.9kg','Clients given 4C weighing 6-9.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C weighing 6-9.9kg\n Clients given 4C weighing 6-9.9kg\n \n 2022-06-30 12:23:45 UTC\n \n 2022-06-30 12:24:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1617\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 14:23:45',4,'2022-06-30 14:24:45',4,0,NULL,NULL,NULL,'5a98d199-a896-47ec-830e-56cd2fef0351'),(1618,'Clients given 4C weighing 10-13.9kg','Clients given 4C weighing 10-13.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C weighing 10-13.9kg\n Clients given 4C weighing 10-13.9kg\n \n 2022-06-30 12:25:23 UTC\n \n 2022-06-30 12:26:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1618\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 14:25:23',4,'2022-06-30 14:26:36',4,0,NULL,NULL,NULL,'bc8cd79c-b1fd-4956-8f87-596d56a8b0b9'),(1619,'Clients given 4C weighing 14-19.9kg','Clients given 4C weighing 14-19.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C weighing 14-19.9kg\n Clients given 4C weighing 14-19.9kg\n \n 2022-06-30 12:27:19 UTC\n \n 2022-06-30 12:28:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1619\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 14:27:19',4,'2022-06-30 14:28:17',4,0,NULL,NULL,NULL,'220abe15-cbb2-464a-bb57-fb1e75ad56c6'),(1620,'Clients given 4C weighing 20-24.9kg','Clients given 4C weighing 20-24.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C weighing 20-24.9kg\n Clients given 4C weighing 20-24.9kg\n \n 2022-06-30 12:28:52 UTC\n \n 2022-06-30 12:29:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1620\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 14:28:52',4,'2022-06-30 14:29:51',4,0,NULL,NULL,NULL,'0e4c3cca-5e54-4f77-a359-6c5a47141593'),(1621,'Clients given 4C weighing 25-34.9kg','Clients given 4C weighing 25-34.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C weighing 25-34.9kg\n Clients given 4C weighing 25-34.9kg\n \n 2022-06-30 12:30:29 UTC\n \n 2022-06-30 12:31:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1621\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 14:30:29',4,'2022-06-30 14:31:26',4,0,NULL,NULL,NULL,'d1810771-902c-44c5-b1a9-988f037cf87d'),(1622,'Clients given 4C weighing >= 35kg','Clients given 4C weighing >= 35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C weighing >= 35kg\n Clients given 4C weighing >= 35kg\n \n 2022-06-30 12:32:03 UTC\n \n 2022-06-30 12:33:13 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1622\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 14:32:03',4,'2022-06-30 14:33:13',4,0,NULL,NULL,NULL,'1d840c5f-240c-4159-8a72-6b0db642b53f'),(1623,'Clients given 4D weighing 0-3.9kg','Clients given 4D weighing 0-3.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D weighing 0-3.9kg\n Clients given 4D weighing 0-3.9kg\n \n 2022-06-30 12:33:59 UTC\n \n 2022-06-30 12:36:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1623\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 14:33:59',4,'2022-06-30 14:36:06',4,0,NULL,NULL,NULL,'0746d03a-e518-473c-809e-f764e275f42a'),(1624,'Clients given 4D weighing 4-5.9kg','Clients given 4D weighing 4-5.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D weighing 4-5.9kg\n Clients given 4D weighing 4-5.9kg\n \n 2022-06-30 12:36:44 UTC\n \n 2022-06-30 12:38:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1624\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 14:36:44',4,'2022-06-30 14:38:51',4,0,NULL,NULL,NULL,'fdaff2b0-2a93-4eed-8a21-37b4493a93d8'),(1625,'Clients given 4D weighing 6-9.9kg','Clients given 4D weighing 6-9.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D weighing 6-9.9kg\n Clients given 4D weighing 6-9.9kg\n \n 2022-06-30 12:37:11 UTC\n \n 2022-06-30 12:39:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1625\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 14:37:11',4,'2022-06-30 14:39:41',4,0,NULL,NULL,NULL,'f7342534-15b0-4b7f-abf7-4689c7510e5d'),(1626,'Clients given 4D weighing 10-13.9kg','Clients given 4D weighing 10-13.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D weighing 10-13.9kg\n Clients given 4D weighing 10-13.9kg\n \n 2022-06-30 12:40:08 UTC\n \n 2022-06-30 12:40:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1626\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 14:40:08',4,'2022-06-30 14:40:58',4,0,NULL,NULL,NULL,'f70b046a-7684-4087-85ac-b8e890c99a7d'),(1627,'Clients given 4D weighing 14-19.9kg','Clients given 4D weighing 14-19.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D weighing 14-19.9kg\n Clients given 4D weighing 14-19.9kg\n \n 2022-06-30 12:41:22 UTC\n \n 2022-06-30 12:46:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1627\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 14:41:22',4,'2022-06-30 14:46:15',4,0,NULL,NULL,NULL,'a78b89dd-1172-4ae3-9db1-252697c46714'),(1628,'Children ARV Regimen_1stLine_2022','Children ARV Regimen_1stLine','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_2022\n Children ARV Regimen_1stLine\n \n 2022-06-30 12:44:42 UTC\n \n 2022-06-30 12:44:52 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1628\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2022-06-30 14:44:42',4,'2022-06-30 14:44:52',4,0,NULL,NULL,NULL,'6d96f107-4e14-48ff-b6d7-c845d87e37e1'),(1629,'Children ARV Regimen_1stLine_2022 Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_2022 Data Set\n \n 2022-06-30 12:44:52 UTC\n \n 2022-06-30 19:13:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1629\n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n 4C0to3.9\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Age\n Children 0to14\n \n \n \n \n \n 4C10to13.9\n \n \n \n \n \n \n \n \n \n 4C14to19.9\n \n \n \n \n \n \n \n \n \n 4C20to24.9\n \n \n \n \n \n \n \n \n \n 4C25to34.9\n \n \n \n \n \n \n \n \n \n 4C35plus\n \n \n \n \n \n \n \n \n \n 4C4to5.9\n \n \n \n \n \n \n \n \n \n 4C6to9.9\n \n \n \n \n \n \n \n \n \n 4D0to3.9\n \n \n \n \n \n \n \n \n \n 4D10to13.9\n \n \n \n \n \n \n \n \n \n 4D14to19.9\n \n \n \n \n \n \n \n \n \n 4D20to24.9\n \n \n \n \n \n \n \n \n \n 4D25to34.9\n \n \n \n \n \n \n \n \n \n 4D35plus\n \n \n \n \n \n \n \n \n \n 4D4to5.9\n \n \n \n \n \n \n \n \n \n 4D6to9.9\n \n \n \n \n \n \n \n \n \n 4E0to3.9\n \n \n \n \n \n \n \n \n \n 4E10to13.9\n \n \n \n \n \n \n \n \n \n 4E14to19.9\n \n \n \n \n \n \n \n \n \n 4E20to24.9\n \n \n \n \n \n \n \n \n \n 4E25to34.9\n \n \n \n \n \n \n \n \n \n 4E35plus\n \n \n \n \n \n \n \n \n \n 4E4to5.9\n \n \n \n \n \n \n \n \n \n 4E6to9.9\n \n \n \n \n \n \n \n \n \n 4F0to3.9\n \n \n \n \n \n \n \n \n \n 4F10to13.9\n \n \n \n \n \n \n \n \n \n 4F14to19.9\n \n \n \n \n \n \n \n \n \n 4F20to24.9\n \n \n \n \n \n \n \n \n \n 4F25to34.9\n \n \n \n \n \n \n \n \n \n 4F35plus\n \n \n \n \n \n \n \n \n \n 4F4to5.9\n \n \n \n \n \n \n \n \n \n 4F6to9.9\n \n \n \n \n \n \n \n \n \n 4G0to3.9\n \n \n \n \n \n \n \n \n \n 4G10to13.9\n \n \n \n \n \n \n \n \n \n 4G14to19.9\n \n \n \n \n \n \n \n \n \n 4G20to24.9\n \n \n \n \n \n \n \n \n \n 4G25to34.9\n \n \n \n \n \n \n \n \n \n 4G35plus\n \n \n \n \n \n \n \n \n \n 4G4to5.9\n \n \n \n \n \n \n \n \n \n 4G6to9.9\n \n \n \n \n \n \n \n \n \n 4H0to3.9\n \n \n \n \n \n \n \n \n \n 4H10to13.9\n \n \n \n \n \n \n \n \n \n 4H14to19.9\n \n \n \n \n \n \n \n \n \n 4H20to24.9\n \n \n \n \n \n \n \n \n \n 4H25to34.9\n \n \n \n \n \n \n \n \n \n 4H35plus\n \n \n \n \n \n \n \n \n \n 4H4to5.9\n \n \n \n \n \n \n \n \n \n 4H6to9.9\n \n \n \n \n \n \n \n \n \n 4J0to3.9\n \n \n \n \n \n \n \n \n \n 4J10to13.9\n \n \n \n \n \n \n \n \n \n 4J14to19.9\n \n \n \n \n \n \n \n \n \n 4J20to24.9\n \n \n \n \n \n \n \n \n \n 4J25to34.9\n \n \n \n \n \n \n \n \n \n 4J35plus\n \n \n \n \n \n \n \n \n \n 4J4to5.9\n \n \n \n \n \n \n \n \n \n 4J6to9.9\n \n \n \n \n \n \n \n \n \n 4K0to3.9\n \n \n \n \n \n \n \n \n \n 4K10to13.9\n \n \n \n \n \n \n \n \n \n 4K14to19.9\n \n \n \n \n \n \n \n \n \n 4K20to24.9\n \n \n \n \n \n \n \n \n \n 4K25to34.9\n \n \n \n \n \n \n \n \n \n 4K35plus\n \n \n \n \n \n \n \n \n \n 4K4to5.9\n \n \n \n \n \n \n \n \n \n 4K6to9.9\n \n \n \n \n \n \n \n \n \n 4L0to3.9\n \n \n \n \n \n \n \n \n \n 4L10to13.9\n \n \n \n \n \n \n \n \n \n 4L14to19.9\n \n \n \n \n \n \n \n \n \n 4L20to24.9\n \n \n \n \n \n \n \n \n \n 4L25to34.9\n \n \n \n \n \n \n \n \n \n 4L35plus\n \n \n \n \n \n \n \n \n \n 4L4to5.9\n \n \n \n \n \n \n \n \n \n 4L6to9.9\n \n \n \n \n \n \n \n \n \n','2022-06-30 12:44:52',4,'2022-06-30 19:13:55',4,0,NULL,NULL,NULL,'72dc6096-f429-4c40-93bf-fbf45c22d970'),(1630,'Clients given 4D weighing 20-24.9kg','Clients given 4D weighing 20-24.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D weighing 20-24.9kg\n Clients given 4D weighing 20-24.9kg\n \n 2022-06-30 12:46:40 UTC\n \n 2022-06-30 12:47:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1630\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 14:46:40',4,'2022-06-30 14:47:39',4,0,NULL,NULL,NULL,'6c0b4f36-cc2c-4d85-a2ad-c5b5bf36b66b'),(1631,'Clients given 4D weighing 25-34.9kg','Clients given 4D weighing 25-34.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D weighing 25-34.9kg\n Clients given 4D weighing 25-34.9kg\n \n 2022-06-30 12:48:05 UTC\n \n 2022-06-30 12:49:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1631\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 14:48:05',4,'2022-06-30 14:49:27',4,0,NULL,NULL,NULL,'1c5157a7-08d8-4eb5-99df-f2ca1825baaa'),(1632,'Clients given 4D weighing >= 35kg','Clients given 4D weighing >= 35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D weighing >= 35kg\n Clients given 4D weighing >= 35kg\n \n 2022-06-30 12:48:59 UTC\n \n 2022-06-30 12:50:46 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1632\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 14:48:59',4,'2022-06-30 14:50:46',4,0,NULL,NULL,NULL,'5cbfb29b-e0b1-42b0-b7f5-a1b561ae3bb5'),(1633,'Clients given 4E weighing 0-3.9kg','Clients given 4E weighing 0-3.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E weighing 0-3.9kg\n Clients given 4E weighing 0-3.9kg\n \n 2022-06-30 12:50:28 UTC\n \n 2022-06-30 12:54:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1633\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 14:50:28',4,'2022-06-30 14:54:40',4,0,NULL,NULL,NULL,'36f7fe8c-f369-4152-a361-bc941ca32f35'),(1634,'Clients given 4E weighing 4-5.9kg','Clients given 4E weighing 4-5.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E weighing 4-5.9kg\n Clients given 4E weighing 4-5.9kg\n \n 2022-06-30 12:54:09 UTC\n \n 2022-06-30 12:55:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1634\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 14:54:09',4,'2022-06-30 14:55:44',4,0,NULL,NULL,NULL,'d6c46caf-e87c-4654-963f-91039f99e100'),(1635,'Clients given 4E weighing 6-9.9kg','Clients given 4E weighing 6-9.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E weighing 6-9.9kg\n Clients given 4E weighing 6-9.9kg\n \n 2022-06-30 12:57:00 UTC\n \n 2022-06-30 13:15:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1635\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 14:57:00',4,'2022-06-30 15:15:29',4,0,NULL,NULL,NULL,'2c954752-aaeb-427b-8cef-714be116f8d5'),(1636,'Clients given 4E weighing 10-13.9kg','Clients given 4E weighing 10-13.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E weighing 10-13.9kg\n Clients given 4E weighing 10-13.9kg\n \n 2022-06-30 13:16:23 UTC\n \n 2022-06-30 13:20:47 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1636\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:16:23',4,'2022-06-30 15:20:47',4,0,NULL,NULL,NULL,'92eb0675-5667-4202-ae12-91e31e89bc0a'),(1637,'Clients given 4K weighing 0-3.9kg','Clients given 4K weighing 0-3.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K weighing 0-3.9kg\n Clients given 4K weighing 0-3.9kg\n \n 2022-06-30 13:21:01 UTC\n \n 2022-06-30 13:22:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1637\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:21:01',4,'2022-06-30 15:22:04',4,0,NULL,NULL,NULL,'5166d416-8394-41a8-a7bf-cddf0f4573f9'),(1638,'Clients given 4E weighing 14-19.9kg','Clients given 4E weighing 14-19.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E weighing 14-19.9kg\n Clients given 4E weighing 14-19.9kg\n \n 2022-06-30 13:21:21 UTC\n \n 2022-06-30 13:23:24 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1638\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:21:21',4,'2022-06-30 15:23:24',4,0,NULL,NULL,NULL,'7c801f27-0d0e-4f8e-8d16-c9abbbc1d70f'),(1639,'Clients given 4K weighing 4-5.9kg','Clients given 4K weighing 4-5.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K weighing 4-5.9kg\n Clients given 4K weighing 4-5.9kg\n \n 2022-06-30 13:22:30 UTC\n \n 2022-06-30 13:23:19 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1639\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:22:30',4,'2022-06-30 15:23:19',4,0,NULL,NULL,NULL,'c3840473-881e-4c28-8b70-08ee65d51205'),(1640,'Clients given 4E weighing 20-24.9kg','Clients given 4E weighing 20-24.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E weighing 20-24.9kg\n Clients given 4E weighing 20-24.9kg\n \n 2022-06-30 13:22:54 UTC\n \n 2022-06-30 13:24:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1640\n COUNT\n \n \n \n \n endDate\n ${startDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:22:54',4,'2022-06-30 15:24:23',4,0,NULL,NULL,NULL,'7171def2-3caa-415e-8d0c-ae70c50ee52a'),(1641,'Clients given 4K weighing 6-9.9kg','Clients given 4K weighing 6-9.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K weighing 6-9.9kg\n Clients given 4K weighing 6-9.9kg\n \n 2022-06-30 13:23:54 UTC\n \n 2022-06-30 13:24:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1641\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:23:54',4,'2022-06-30 15:24:45',4,0,NULL,NULL,NULL,'2dc1198d-9268-4a29-b96d-7ac8921d3551'),(1642,'Clients given 4E weighing 25-34.9kg','Clients given 4E weighing 25-34.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E weighing 25-34.9kg\n Clients given 4E weighing 25-34.9kg\n \n 2022-06-30 13:24:00 UTC\n \n 2022-06-30 13:25:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1642\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:24:00',4,'2022-06-30 15:25:27',4,0,NULL,NULL,NULL,'40ac2a8b-12d5-4b3d-bea2-b63e3d969db9'),(1643,'Clients given 4E weighing >= 35kg','Clients given 4E weighing >= 35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E weighing >= 35kg\n Clients given 4E weighing >= 35kg\n \n 2022-06-30 13:25:02 UTC\n \n 2022-06-30 13:26:56 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1643\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:25:02',4,'2022-06-30 15:26:56',4,0,NULL,NULL,NULL,'9f104324-88d3-4be9-8a9e-2535e4368371'),(1644,'Clients given 4K weighing 10-13.9kg','Clients given 4K weighing 10-13.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K weighing 10-13.9kg\n Clients given 4K weighing 10-13.9kg\n \n 2022-06-30 13:25:05 UTC\n \n 2022-06-30 13:26:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1644\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:25:05',4,'2022-06-30 15:26:01',4,0,NULL,NULL,NULL,'38fbaae4-791a-4bba-85ea-d149625c3d79'),(1645,'Clients given 4K weighing 14-19.9kg','Clients given 4K weighing 14-19.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K weighing 14-19.9kg\n Clients given 4K weighing 14-19.9kg\n \n 2022-06-30 13:26:26 UTC\n \n 2022-06-30 13:27:37 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1645\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:26:26',4,'2022-06-30 15:27:37',4,0,NULL,NULL,NULL,'c0be7036-edcf-4337-97d7-2bb22bc6ef54'),(1646,'Clients given 4F weighing 0-3.9kg','Clients given 4F weighing 0-3.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F weighing 0-3.9kg\n Clients given 4F weighing 0-3.9kg\n \n 2022-06-30 13:26:29 UTC\n \n 2022-06-30 13:28:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1646\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:26:29',4,'2022-06-30 15:28:31',4,0,NULL,NULL,NULL,'3df707cf-c633-4a85-ab9a-affe8619ca0e'),(1647,'Clients given 4K weighing 20-24.9kg','Clients given 4K weighing 20-24.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K weighing 20-24.9kg\n Clients given 4K weighing 20-24.9kg\n \n 2022-06-30 13:26:52 UTC\n \n 2022-06-30 13:27:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1647\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:26:52',4,'2022-06-30 15:27:51',4,0,NULL,NULL,NULL,'f1be8c70-bd5f-4b25-8703-ebc91a56a354'),(1648,'Clients given 4F weighing 4-5.9kg','Clients given 4F weighing 4-5.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F weighing 4-5.9kg\n Clients given 4F weighing 4-5.9kg\n \n 2022-06-30 13:27:32 UTC\n \n 2022-06-30 13:28:56 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1648\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:27:32',4,'2022-06-30 15:28:56',4,0,NULL,NULL,NULL,'651b9843-2f38-4e58-a87b-8d01b1e1b736'),(1649,'Clients given 4K weighing 25-34.9kg','Clients given 4K weighing 25-34.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K weighing 25-34.9kg\n Clients given 4K weighing 25-34.9kg\n \n 2022-06-30 13:28:20 UTC\n \n 2022-06-30 13:29:38 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1649\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:28:20',4,'2022-06-30 15:29:38',4,0,NULL,NULL,NULL,'4a021424-b101-4001-8078-cd6e93935845'),(1650,'Clients given 4K weighing >=35kg','Clients given 4K weighing >=35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K weighing >=35kg\n Clients given 4K weighing >=35kg\n \n 2022-06-30 13:28:45 UTC\n \n 2022-06-30 13:29:54 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1650\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:28:45',4,'2022-06-30 15:29:54',4,0,NULL,NULL,NULL,'86cffb6f-3533-48b5-a568-425a6d32e7e6'),(1651,'Clients given 4F weighing 6-9.9kg','Clients given 4F weighing 6-9.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F weighing 6-9.9kg\n Clients given 4F weighing 6-9.9kg\n \n 2022-06-30 13:29:29 UTC\n \n 2022-06-30 13:33:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1651\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:29:29',4,'2022-06-30 15:33:15',4,0,NULL,NULL,NULL,'0d1c19ab-8761-43c9-b362-a733800ce420'),(1652,'Clients given 4F weighing 10-13.9kg','Clients given 4F weighing 10-13.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F weighing 10-13.9kg\n Clients given 4F weighing 10-13.9kg\n \n 2022-06-30 13:29:53 UTC\n \n 2022-06-30 13:31:09 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1652\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:29:53',4,'2022-06-30 15:31:09',4,0,NULL,NULL,NULL,'0be49339-dac1-4872-9c6c-50fee86542d0'),(1653,'Clients given 4F weighing 14-19.9kg','Clients given 4F weighing 14-19.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F weighing 14-19.9kg\n Clients given 4F weighing 14-19.9kg\n \n 2022-06-30 13:32:50 UTC\n \n 2022-06-30 13:34:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1653\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:32:50',4,'2022-06-30 15:34:42',4,0,NULL,NULL,NULL,'10f82a49-a80e-4feb-8a54-5011945608bc'),(1654,'Clients given 4F weighing 20-24.9kg','Clients given 4F weighing 20-24.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F weighing 20-24.9kg\n Clients given 4F weighing 20-24.9kg\n \n 2022-06-30 13:33:57 UTC\n \n 2022-06-30 13:35:34 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1654\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:33:57',4,'2022-06-30 15:35:34',4,0,NULL,NULL,NULL,'1b492993-7168-4cee-aeae-ed3cb3136ef4'),(1655,'Clients given 4F weighing 25-34.9kg','Clients given 4F weighing 25-34.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F weighing 25-34.9kg\n Clients given 4F weighing 25-34.9kg\n \n 2022-06-30 13:35:56 UTC\n \n 2022-06-30 13:37:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1655\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:35:56',4,'2022-06-30 15:37:26',4,0,NULL,NULL,NULL,'fd363f21-64f5-4465-8f1c-94a10ec790bc'),(1656,'Clients given 4F weighing >= 35kg','Clients given 4F weighing >= 35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F weighing >= 35kg\n Clients given 4F weighing >= 35kg\n \n 2022-06-30 13:36:27 UTC\n \n 2022-06-30 13:37:46 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1656\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:36:27',4,'2022-06-30 15:37:46',4,0,NULL,NULL,NULL,'2ca64d93-82d9-40b9-ae24-669a1d529641'),(1657,'Clients given 4G weighing 0-3.9kg','Clients given 4G weighing 0-3.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G weighing 0-3.9kg\n Clients given 4G weighing 0-3.9kg\n \n 2022-06-30 13:38:33 UTC\n \n 2022-06-30 13:39:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1657\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:38:33',4,'2022-06-30 15:39:42',4,0,NULL,NULL,NULL,'e2b136d9-95a4-49fa-8069-476f5b7e1bc2'),(1658,'Clients given 4G weighing 4-5.9kg','Clients given 4G weighing 4-5.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G weighing 4-5.9kg\n Clients given 4G weighing 4-5.9kg\n \n 2022-06-30 13:38:58 UTC\n \n 2022-06-30 13:40:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1658\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:38:58',4,'2022-06-30 15:40:05',4,0,NULL,NULL,NULL,'dc8af817-8512-4a0a-b692-331377842479'),(1659,'Clients given 4G weighing 6-9.9kg','Clients given 4G weighing 6-9.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G weighing 6-9.9kg\n Clients given 4G weighing 6-9.9kg\n \n 2022-06-30 13:40:27 UTC\n \n 2022-06-30 13:41:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1659\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:40:27',4,'2022-06-30 15:41:40',4,0,NULL,NULL,NULL,'97f6acaa-3818-4efc-b6e0-8d8ecd3255b5'),(1660,'Clients given 4G weighing 10-13.9kg','Clients given 4G weighing 10-13.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G weighing 10-13.9kg\n Clients given 4G weighing 10-13.9kg\n \n 2022-06-30 13:40:47 UTC\n \n 2022-06-30 13:43:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1660\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:40:47',4,'2022-06-30 15:43:02',4,0,NULL,NULL,NULL,'ebcfa3fc-dea8-4a53-99f7-a16dc23a026c'),(1661,'Clients given 4G weighing 14-19.9kg','Clients given 4G weighing 14-19.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G weighing 14-19.9kg\n Clients given 4G weighing 14-19.9kg\n \n 2022-06-30 13:42:19 UTC\n \n 2022-06-30 13:43:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1661\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:42:19',4,'2022-06-30 15:43:59',4,0,NULL,NULL,NULL,'793e78bb-284c-47fa-8967-3fa124d3e9c7'),(1662,'Clients given 4G weighing 20-24.9kg','Clients given 4G weighing 20-24.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G weighing 20-24.9kg\n Clients given 4G weighing 20-24.9kg\n \n 2022-06-30 13:43:37 UTC\n \n 2022-06-30 13:44:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1662\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:43:37',4,'2022-06-30 15:44:44',4,0,NULL,NULL,NULL,'2bffd86c-c304-4fe5-bea0-dcba1ddacd30'),(1663,'Clients given 4G weighing 25-34.9kg','Clients given 4G weighing 25-34.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G weighing 25-34.9kg\n Clients given 4G weighing 25-34.9kg\n \n 2022-06-30 13:44:57 UTC\n \n 2022-06-30 13:48:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1663\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:44:57',4,'2022-06-30 15:48:30',4,0,NULL,NULL,NULL,'dff299fd-70e4-42b6-821b-24bbfca5d130'),(1664,'Clients given 4G weighing >= 35kg','Clients given 4G weighing >= 35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G weighing >= 35kg\n Clients given 4G weighing >= 35kg\n \n 2022-06-30 13:45:24 UTC\n \n 2022-06-30 13:47:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1664\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:45:24',4,'2022-06-30 15:47:50',4,0,NULL,NULL,NULL,'250554d7-b11e-4572-9fe8-191077c91497'),(1665,'Clients given 4H weighing 0-3.9kg','Clients given 4H weighing 0-3.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H weighing 0-3.9kg\n Clients given 4H weighing 0-3.9kg\n \n 2022-06-30 13:49:48 UTC\n \n 2022-06-30 13:51:33 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1665\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:49:48',4,'2022-06-30 15:51:33',4,0,NULL,NULL,NULL,'0681f349-aa2a-4030-8932-08fe50d977b7'),(1666,'Clients given 4H weighing 4-5.9kg','Clients given 4H weighing 4-5.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H weighing 4-5.9kg\n Clients given 4H weighing 4-5.9kg\n \n 2022-06-30 13:50:26 UTC\n \n 2022-06-30 13:52:13 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1666\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:50:26',4,'2022-06-30 15:52:13',4,0,NULL,NULL,NULL,'7d0948bd-e302-428d-be3e-c15ad93d5002'),(1667,'Clients given 4H weighing 6-9.9kg','Clients given 4H weighing 6-9.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H weighing 6-9.9kg\n Clients given 4H weighing 6-9.9kg\n \n 2022-06-30 13:52:32 UTC\n \n 2022-06-30 13:53:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1667\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:52:32',4,'2022-06-30 15:53:36',4,0,NULL,NULL,NULL,'ec54533d-f75a-4314-b085-4016edf73ccc'),(1668,'Clients given 4H weighing 10-13.9kg','Clients given 4H weighing 10-13.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H weighing 10-13.9kg\n Clients given 4H weighing 10-13.9kg\n \n 2022-06-30 13:52:54 UTC\n \n 2022-06-30 13:53:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1668\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:52:54',4,'2022-06-30 15:53:58',4,0,NULL,NULL,NULL,'306fc3f9-604f-4088-84fc-565bd360942d'),(1669,'Clients given 4H weighing 14-19.9kg','Clients given 4H weighing 14-19.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H weighing 14-19.9kg\n Clients given 4H weighing 14-19.9kg\n \n 2022-06-30 13:54:20 UTC\n \n 2022-06-30 13:55:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1669\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:54:20',4,'2022-06-30 15:55:40',4,0,NULL,NULL,NULL,'afa2260d-2d12-4922-8214-7321d1a7a0b2'),(1670,'Clients given 4H weighing 20-24.9kg','Clients given 4H weighing 20-24.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H weighing 20-24.9kg\n Clients given 4H weighing 20-24.9kg\n \n 2022-06-30 13:54:47 UTC\n \n 2022-06-30 13:56:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1670\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:54:47',4,'2022-06-30 15:56:07',4,0,NULL,NULL,NULL,'b12d0c96-1d85-4c87-8224-fcdcca3684ad'),(1671,'Clients given 4H weighing 25-34.9kg','Clients given 4H weighing 25-34.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H weighing 25-34.9kg\n Clients given 4H weighing 25-34.9kg\n \n 2022-06-30 13:56:49 UTC\n \n 2022-06-30 13:59:24 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1671\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:56:49',4,'2022-06-30 15:59:24',4,0,NULL,NULL,NULL,'c03a3023-e223-4974-82d2-f9884b64fd94'),(1672,'Clients given 4H weighing >= 35kg','Clients given 4H weighing >= 35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H weighing >= 35kg\n Clients given 4H weighing >= 35kg\n \n 2022-06-30 13:57:18 UTC\n \n 2022-06-30 13:59:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1672\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:57:18',4,'2022-06-30 15:59:06',4,0,NULL,NULL,NULL,'021ba7c8-9dde-4912-850e-7e1f90746b9c'),(1673,'Clients given 4J weighing 0-3.9kg','Clients given 4J weighing 0-3.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J weighing 0-3.9kg\n Clients given 4J weighing 0-3.9kg\n \n 2022-06-30 14:00:30 UTC\n \n 2022-06-30 14:01:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1673\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 16:00:30',4,'2022-06-30 16:01:59',4,0,NULL,NULL,NULL,'21e22f99-3f2f-4e4a-ac19-ea6a1fe4030a'),(1674,'Clients given 4J weighing 4-5.9kg','Clients given 4J weighing 4-5.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J weighing 4-5.9kg\n Clients given 4J weighing 4-5.9kg\n \n 2022-06-30 14:00:54 UTC\n \n 2022-06-30 14:02:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1674\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 16:00:54',4,'2022-06-30 16:02:01',4,0,NULL,NULL,NULL,'14f446ec-5d3e-43b6-ad36-6153fe3ee3e9'),(1675,'Clients given 4J weighing 6-9.9kg','Clients given 4J weighing 6-9.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J weighing 6-9.9kg\n Clients given 4J weighing 6-9.9kg\n \n 2022-06-30 14:03:04 UTC\n \n 2022-06-30 14:04:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1675\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 16:03:04',4,'2022-06-30 16:04:17',4,0,NULL,NULL,NULL,'cc3db8f2-7644-426f-9c03-2a1d48ebd7d7'),(1676,'Clients given 4J weighing 10-13.9kg','Clients given 4J weighing 10-13.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J weighing 10-13.9kg\n Clients given 4J weighing 10-13.9kg\n \n 2022-06-30 14:03:25 UTC\n \n 2022-06-30 14:04:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1676\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 16:03:25',4,'2022-06-30 16:04:39',4,0,NULL,NULL,NULL,'adc9fdd3-0019-4213-998f-ab2d235aae80'),(1677,'Clients given 4J weighing 14-19.9kg','Clients given 4J weighing 14-19.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J weighing 14-19.9kg\n Clients given 4J weighing 14-19.9kg\n \n 2022-06-30 14:05:01 UTC\n \n 2022-06-30 14:06:13 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1677\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 16:05:01',4,'2022-06-30 16:06:13',4,0,NULL,NULL,NULL,'4fc6749f-c47b-4021-8dbf-26732df08880'),(1678,'Clients given 4J weighing 20-24.9kg','Clients given 4J weighing 20-24.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J weighing 20-24.9kg\n Clients given 4J weighing 20-24.9kg\n \n 2022-06-30 14:05:23 UTC\n \n 2022-06-30 14:06:34 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1678\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 16:05:23',4,'2022-06-30 16:06:34',4,0,NULL,NULL,NULL,'669e5746-1eee-4811-94dd-e4c6dd949131'),(1679,'Clients given 4J weighing 25-34.9kg','Clients given 4J weighing 25-34.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J weighing 25-34.9kg\n Clients given 4J weighing 25-34.9kg\n \n 2022-06-30 14:06:56 UTC\n \n 2022-06-30 14:08:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1679\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 16:06:56',4,'2022-06-30 16:08:42',4,0,NULL,NULL,NULL,'78cbb142-b205-4059-89fa-70bd488a0513'),(1680,'Clients given 4J weighing >= 35kg','Clients given 4J weighing >= 35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J weighing >= 35kg\n Clients given 4J weighing >= 35kg\n \n 2022-06-30 14:07:26 UTC\n \n 2022-06-30 14:09:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1680\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 16:07:26',4,'2022-06-30 16:09:04',4,0,NULL,NULL,NULL,'ec90ccaa-999c-4b18-956b-50bee7c36868'),(1681,'Clients given 4L weighing 0-3.9kg','Clients given 4L weighing 0-3.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L weighing 0-3.9kg\n Clients given 4L weighing 0-3.9kg\n \n 2022-06-30 14:09:37 UTC\n \n 2022-06-30 14:10:48 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1681\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 16:09:37',4,'2022-06-30 16:10:48',4,0,NULL,NULL,NULL,'0e228ccb-1909-4a98-8334-89bf36d6e810'),(1682,'Clients given 4L weighing 4-5.9kg','Clients given 4L weighing 4-5.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L weighing 4-5.9kg\n Clients given 4L weighing 4-5.9kg\n \n 2022-06-30 14:10:06 UTC\n \n 2022-06-30 14:11:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1682\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 16:10:06',4,'2022-06-30 16:11:40',4,0,NULL,NULL,NULL,'d962f501-7157-4c19-9c7b-1a2a22053674'),(1683,'Clients given 4L weighing 6-9.9kg','Clients given 4L weighing 6-9.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L weighing 6-9.9kg\n Clients given 4L weighing 6-9.9kg\n \n 2022-06-30 14:11:24 UTC\n \n 2022-06-30 14:13:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1683\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 16:11:24',4,'2022-06-30 16:13:32',4,0,NULL,NULL,NULL,'16bb43f6-91a5-4e02-9627-9921460d5c68'),(1684,'Clients given 4L weighing 10-13.9kg','Clients given 4L weighing 10-13.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L weighing 10-13.9kg\n Clients given 4L weighing 10-13.9kg\n \n 2022-06-30 14:12:51 UTC\n \n 2022-06-30 14:14:24 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1684\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 16:12:51',4,'2022-06-30 16:14:24',4,0,NULL,NULL,NULL,'52d68e65-aa63-4c88-820e-e00bf66061ea'),(1685,'Clients given 4L weighing 14-19.9kg','Clients given 4L weighing 14-19.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L weighing 14-19.9kg\n Clients given 4L weighing 14-19.9kg\n \n 2022-06-30 14:14:11 UTC\n \n 2022-06-30 14:15:56 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1685\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 16:14:11',4,'2022-06-30 16:15:56',4,0,NULL,NULL,NULL,'1eb7fbd6-fa49-4ada-af7e-19424fb5a7e8'),(1686,'Clients given 4L weighing 20-24.9kg','Clients given 4L weighing 20-24.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L weighing 20-24.9kg\n Clients given 4L weighing 20-24.9kg\n \n 2022-06-30 14:15:00 UTC\n \n 2022-06-30 14:16:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1686\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 16:15:00',4,'2022-06-30 16:16:18',4,0,NULL,NULL,NULL,'d889b33a-5324-4655-965f-1fb6fdb8864d'),(1687,'Clients given 4L weighing 25-34.9kg','Clients given 4L weighing 25-34.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L weighing 25-34.9kg\n Clients given 4L weighing 25-34.9kg\n \n 2022-06-30 14:16:41 UTC\n \n 2022-06-30 14:18:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1687\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 16:16:41',4,'2022-06-30 16:18:03',4,0,NULL,NULL,NULL,'f8853175-2a1a-4d34-9a40-2d9ae44b5367'),(1688,'Clients given 4L weighing >= 35kg','Clients given 4L weighing >= 35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L weighing >= 35kg\n Clients given 4L weighing >= 35kg\n \n 2022-06-30 14:17:04 UTC\n \n 2022-06-30 14:18:34 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1688\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 16:17:04',4,'2022-06-30 16:18:34',4,0,NULL,NULL,NULL,'6cf112ca-592d-4638-8919-561aeb0e1b2e'),(1689,'Clients given 5A weighing 0-3.9kg','Clients given 5A weighing 0-3.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5A weighing 0-3.9kg\n Clients given 5A weighing 0-3.9kg\n \n 2022-07-04 07:51:16 UTC\n \n 2022-07-04 07:59:19 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1689\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 13:21:16',4,'2022-07-04 13:29:19',4,0,NULL,NULL,NULL,'1e8f892d-f7dd-4c03-bae2-2b6af9a96063'),(1690,'Clients given 5A weighing 4-5.9kg','Clients given 5A weighing 4-5.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5A weighing 4-5.9kg\n Clients given 5A weighing 4-5.9kg\n \n 2022-07-04 08:01:43 UTC\n \n 2022-07-04 08:08:34 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1690\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 13:31:43',4,'2022-07-04 13:38:34',4,0,NULL,NULL,NULL,'caef996e-3278-49a5-a46b-264db7abba88'),(1691,'Clients given 5A weighing 6-9.9kg','Clients given 5A weighing 6-9.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5A weighing 6-9.9kg\n Clients given 5A weighing 6-9.9kg\n \n 2022-07-04 08:10:17 UTC\n \n 2022-07-04 08:27:38 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1691\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 13:40:17',4,'2022-07-04 13:57:38',4,0,NULL,NULL,NULL,'e035adc0-696d-46e6-8075-9ea647aea054'),(1692,'Clients given 5A weighing 10-13.9kg','Clients given 5A weighing 10-13.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5A weighing 10-13.9kg\n Clients given 5A weighing 10-13.9kg\n \n 2022-07-04 08:12:41 UTC\n \n 2022-07-04 08:29:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1692\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 13:42:41',4,'2022-07-04 13:59:01',4,0,NULL,NULL,NULL,'ee8edb07-58b9-4884-8044-948e6bdef0a8'),(1693,'Clients given 5A weighing 14-19.9kg','Clients given 5A weighing 14-19.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5A weighing 14-19.9kg\n Clients given 5A weighing 14-19.9kg\n \n 2022-07-04 08:15:22 UTC\n \n 2022-07-04 08:30:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1693\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 13:45:22',4,'2022-07-04 14:00:32',4,0,NULL,NULL,NULL,'91a9fa6e-69dc-4980-bb69-ff2399a6e30e'),(1694,'Clients given 5A weighing 25-34.9kg','Clients given 5A weighing 25-34.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5A weighing 25-34.9kg\n Clients given 5A weighing 25-34.9kg\n \n 2022-07-04 08:17:38 UTC\n \n 2022-07-04 08:33:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1694\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 13:47:38',4,'2022-07-04 14:03:14',4,0,NULL,NULL,NULL,'671c4577-cc93-464c-b822-cdbee99fce15'),(1695,'Clients given 5A weighing 20-24.9kg','Clients given 5A weighing 20-24.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5A weighing 20-24.9kg\n Clients given 5A weighing 20-24.9kg\n \n 2022-07-04 08:21:33 UTC\n \n 2022-07-04 08:32:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1695\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 13:51:33',4,'2022-07-04 14:02:01',4,0,NULL,NULL,NULL,'33f3931b-17d8-445a-8275-abe1c9c62e60'),(1696,'Clients given 5A weighing >= 35kg','Clients given 5A weighing >= 35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5A weighing >= 35kg\n Clients given 5A weighing >= 35kg\n \n 2022-07-04 08:22:19 UTC\n \n 2022-07-04 08:25:33 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1696\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 13:52:19',4,'2022-07-04 13:55:33',4,0,NULL,NULL,NULL,'4174b385-1353-40e8-8771-820e7b8cc439'),(1697,'Clients given 5B weighing 0-3.9kg','Clients given 5B weighing 0-3.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5B weighing 0-3.9kg\n Clients given 5B weighing 0-3.9kg\n \n 2022-07-04 08:35:49 UTC\n \n 2022-07-04 08:39:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1697\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 14:05:49',4,'2022-07-04 14:09:51',4,0,NULL,NULL,NULL,'8ccf814e-72c3-40b9-8dae-53c47231713a'),(1698,'Clients given 5B weighing 4-5.9kg','Clients given 5B weighing 4-5.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5B weighing 4-5.9kg\n Clients given 5B weighing 4-5.9kg\n \n 2022-07-04 09:11:19 UTC\n \n 2022-07-04 09:12:47 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1698\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 14:41:19',4,'2022-07-04 14:42:47',4,0,NULL,NULL,NULL,'da9d3384-9203-4c29-9bb3-0064275b0bbf'),(1699,'Clients given 5B weighing 6-9.9kg','Clients given 5B weighing 6-9.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5B weighing 6-9.9kg\n Clients given 5B weighing 6-9.9kg\n \n 2022-07-04 09:12:11 UTC\n \n 2022-07-04 09:14:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1699\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 14:42:11',4,'2022-07-04 14:44:17',4,0,NULL,NULL,NULL,'9b461cbe-5394-43f1-a3a8-5cab077d880b'),(1700,'Clients given 5B weighing 10-13.9kg','Clients given 5B weighing 10-13.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5B weighing 10-13.9kg\n Clients given 5B weighing 10-13.9kg\n \n 2022-07-04 09:13:47 UTC\n \n 2022-07-04 09:15:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1700\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 14:43:47',4,'2022-07-04 14:45:39',4,0,NULL,NULL,NULL,'e757de08-36b9-48aa-ae1c-6e8b67f41517'),(1701,'Clients given 5B weighing 14-19.9kg','Clients given 5B weighing 14-19.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5B weighing 14-19.9kg\n Clients given 5B weighing 14-19.9kg\n \n 2022-07-04 09:17:29 UTC\n \n 2022-07-04 09:33:16 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1701\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 14:47:29',4,'2022-07-04 15:03:16',4,0,NULL,NULL,NULL,'b1164742-ca14-4264-979a-53f89a268f3a'),(1702,'Clients given 5B weighing 20-24.9kg','Clients given 5B weighing 20-24.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5B weighing 20-24.9kg\n Clients given 5B weighing 20-24.9kg\n \n 2022-07-04 09:18:14 UTC\n \n 2022-07-04 09:33:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1702\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 14:48:14',4,'2022-07-04 15:03:55',4,0,NULL,NULL,NULL,'37598126-d94c-4da8-bbac-1e0b9020ef33'),(1703,'Clients given 5B weighing 25-34.9kg','Clients given 5B weighing 25-34.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5B weighing 25-34.9kg\n Clients given 5B weighing 25-34.9kg\n \n 2022-07-04 09:38:26 UTC\n \n 2022-07-04 09:39:35 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1703\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 15:08:26',4,'2022-07-04 15:09:35',4,0,NULL,NULL,NULL,'578575b5-5eaf-4487-85b6-e81f72e577e7'),(1704,'Clients given 5C weighing 0-3.9kg','Clients given 5C weighing 0-3.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5C weighing 0-3.9kg\n Clients given 5C weighing 0-3.9kg\n \n 2022-07-04 09:40:50 UTC\n \n 2022-07-04 09:46:13 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1704\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 15:10:50',4,'2022-07-04 15:16:13',4,0,NULL,NULL,NULL,'183f7dbc-af84-4166-802d-fc168517be56'),(1705,'Clients given 5B weighing >= 35kg','Clients given 5B weighing >= 35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5B weighing >= 35kg\n Clients given 5B weighing >= 35kg\n \n 2022-07-04 09:41:33 UTC\n \n 2022-07-04 09:45:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1705\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 15:11:33',4,'2022-07-04 15:15:51',4,0,NULL,NULL,NULL,'bcad7f66-5905-4cb4-820c-20b76c185df0'),(1706,'Clients given 5C weighing 4-5.9kg','Clients given 5C weighing 4-5.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5C weighing 4-5.9kg\n Clients given 5C weighing 4-5.9kg\n \n 2022-07-04 09:46:54 UTC\n \n 2022-07-04 09:48:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1706\n COUNT\n \n \n \n \n endDate\n ${startDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 15:16:54',4,'2022-07-04 15:18:55',4,0,NULL,NULL,NULL,'646d055c-d02e-46d9-8af4-e8edd67a053a'),(1707,'Clients given 5C weighing 6-9.9kg','Clients given 5C weighing 6-9.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5C weighing 6-9.9kg\n Clients given 5C weighing 6-9.9kg\n \n 2022-07-04 09:47:34 UTC\n \n 2022-07-04 09:49:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1707\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 15:17:34',4,'2022-07-04 15:19:45',4,0,NULL,NULL,NULL,'bff00fe0-ccdd-4e59-8a04-5daae78f609f'),(1708,'Clients given 5C weighing 6-9.9kg','Clients given 5C weighing 6-9.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5C weighing 6-9.9kg\n Clients given 5C weighing 6-9.9kg\n \n 2022-07-04 09:50:21 UTC\n \n 2022-07-04 09:52:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1708\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 15:20:21',4,'2022-07-04 15:22:53',4,0,NULL,NULL,NULL,'a12b3ec6-868f-49da-9993-65fcea6139ce'),(1709,'Clients given 5C weighing 10-13.9kg','Clients given 5C weighing 10-13.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5C weighing 10-13.9kg\n Clients given 5C weighing 10-13.9kg\n \n 2022-07-04 09:51:17 UTC\n \n 2022-07-04 09:54:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1709\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 15:21:17',4,'2022-07-04 15:24:31',4,0,NULL,NULL,NULL,'11fd5caf-00b2-4c9b-89d3-dbe43460e1b4'),(1710,'Clients given 5C weighing 14-19.9kg','Clients given 5C weighing 14-19.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5C weighing 14-19.9kg\n Clients given 5C weighing 14-19.9kg\n \n 2022-07-04 09:54:02 UTC\n \n 2022-07-04 10:19:24 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1710\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 15:24:02',4,'2022-07-04 15:49:24',4,0,NULL,NULL,NULL,'35c1a303-9f1d-41a4-a7b2-a63222c0c0f8'),(1711,'Clients given 5C weighing 20-24.9kg','Clients given 5C weighing 20-24.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5C weighing 20-24.9kg\n Clients given 5C weighing 20-24.9kg\n \n 2022-07-04 10:20:29 UTC\n \n 2022-07-04 10:24:33 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1711\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 15:50:29',4,'2022-07-04 15:54:33',4,0,NULL,NULL,NULL,'300ad93a-8a96-42ee-b027-15e6ea66150c'),(1712,'Clients given 5C weighing 25-34.9kg','Clients given 5C weighing 25-34.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5C weighing 25-34.9kg\n Clients given 5C weighing 25-34.9kg\n \n 2022-07-04 10:20:49 UTC\n \n 2022-07-04 10:23:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1712\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 15:50:49',4,'2022-07-04 15:53:58',4,0,NULL,NULL,NULL,'2fb0cc71-47ac-4408-bb68-608d33609d53'),(1713,'Clients given 5C weighing >= 35kg','Clients given 5C weighing >= 35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5C weighing >= 35kg\n Clients given 5C weighing >= 35kg\n \n 2022-07-04 10:26:20 UTC\n \n 2022-07-04 10:29:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1713\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 15:56:20',4,'2022-07-04 15:59:43',4,0,NULL,NULL,NULL,'731fc698-2509-4d99-9163-e08624e75417'),(1714,'Clients given 5D weighing 0-3.9kg','Clients given 5D weighing 0-3.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5D weighing 0-3.9kg\n Clients given 5D weighing 0-3.9kg\n \n 2022-07-04 10:31:02 UTC\n \n 2022-07-04 10:34:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1714\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 16:01:02',4,'2022-07-04 16:04:29',4,0,NULL,NULL,NULL,'b285d939-9f51-47bd-8a6d-7f4e5d321058'),(1715,'Clients given 5D weighing 4-5.9kg','Clients given 5D weighing 4-5.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5D weighing 4-5.9kg\n Clients given 5D weighing 4-5.9kg\n \n 2022-07-04 10:36:13 UTC\n \n 2022-07-04 10:38:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1715\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 16:06:13',4,'2022-07-04 16:08:50',4,0,NULL,NULL,NULL,'8c7b5eac-d68a-4dbe-b341-3417d6c7cb50'),(1716,'Clients given 5D weighing 6-9.9kg','Clients given 5D weighing 6-9.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5D weighing 6-9.9kg\n Clients given 5D weighing 6-9.9kg\n \n 2022-07-04 10:36:38 UTC\n \n 2022-07-04 10:38:25 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1716\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 16:06:38',4,'2022-07-04 16:08:25',4,0,NULL,NULL,NULL,'f1dbcf85-e7e2-406e-ab4f-5b29a0f2dfb3'),(1717,'Clients given 5D weighing 10-13.9kg','Clients given 5D weighing 10-13.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5D weighing 10-13.9kg\n Clients given 5D weighing 10-13.9kg\n \n 2022-07-04 10:39:56 UTC\n \n 2022-07-04 10:42:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1717\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 16:09:56',4,'2022-07-04 16:12:05',4,0,NULL,NULL,NULL,'cc9e92c9-53f2-46a4-be46-ca904d385286'),(1718,'Clients given 5D weighing 14-19.9kg','Clients given 5D weighing 14-19.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5D weighing 14-19.9kg\n Clients given 5D weighing 14-19.9kg\n \n 2022-07-04 10:40:24 UTC\n \n 2022-07-04 10:42:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1718\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 16:10:24',4,'2022-07-04 16:12:36',4,0,NULL,NULL,NULL,'ea3aa469-cc4f-499c-b20f-a163afa5c116'),(1719,'Clients given 5D weighing 20-24.9kg','Clients given 5D weighing 20-24.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5D weighing 20-24.9kg\n Clients given 5D weighing 20-24.9kg\n \n 2022-07-04 10:43:39 UTC\n \n 2022-07-04 10:45:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1719\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 16:13:39',4,'2022-07-04 16:15:07',4,0,NULL,NULL,NULL,'51201bc9-2e68-47b2-a264-dfe852767cbb'),(1720,'Clients given 5D weighing 25-34.9kg','Clients given 5D weighing 25-34.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5D weighing 25-34.9kg\n Clients given 5D weighing 25-34.9kg\n \n 2022-07-04 10:44:10 UTC\n \n 2022-07-04 10:46:49 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1720\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 16:14:10',4,'2022-07-04 16:16:49',4,0,NULL,NULL,NULL,'99779a0a-4228-4d21-bc53-a4724c950f64'),(1721,'Clients given 5D weighing >= 35kg','Clients given 5D weighing >= 35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5D weighing >= 35kg\n Clients given 5D weighing >= 35kg\n \n 2022-07-04 10:46:20 UTC\n \n 2022-07-04 10:49:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1721\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 16:16:20',4,'2022-07-04 16:19:12',4,0,NULL,NULL,NULL,'a9db689b-55c9-49a6-bf7b-f841503b81d4'),(1722,'Clients given 5E weighing 0-3.9kg','Clients given 5E weighing 0-3.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5E weighing 0-3.9kg\n Clients given 5E weighing 0-3.9kg\n \n 2022-07-04 10:49:03 UTC\n \n 2022-07-04 10:54:57 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1722\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 16:19:03',4,'2022-07-04 16:24:57',4,0,NULL,NULL,NULL,'98825a71-acf0-4a06-b318-1dfbc4bc85e8'),(1723,'Clients given 5E weighing 4-5.9kg','Clients given 5E weighing 4-5.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5E weighing 4-5.9kg\n Clients given 5E weighing 4-5.9kg\n \n 2022-07-04 10:50:24 UTC\n \n 2022-07-04 10:53:38 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1723\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 16:20:24',4,'2022-07-04 16:23:38',4,0,NULL,NULL,NULL,'09876d38-7d00-460f-a95d-f1d084f84cb0'),(1724,'Clients given 5E weighing 6-9.9kg','Clients given 5E weighing 6-9.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5E weighing 6-9.9kg\n Clients given 5E weighing 6-9.9kg\n \n 2022-07-04 10:55:45 UTC\n \n 2022-07-04 10:59:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1724\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 16:25:45',4,'2022-07-04 16:29:01',4,0,NULL,NULL,NULL,'d95839a2-da76-4d9f-9dde-6ef33f9d3c7d'),(1725,'Clients given 5E weighing 10-13.9kg','Clients given 5E weighing 10-13.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5E weighing 10-13.9kg\n Clients given 5E weighing 10-13.9kg\n \n 2022-07-04 10:56:27 UTC\n \n 2022-07-04 11:04:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1725\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 16:26:27',4,'2022-07-04 16:34:36',4,0,NULL,NULL,NULL,'c0a9a74f-b14c-42fb-87bc-710bd652916c'),(1726,'Clients given 5E weighing 14-19.9kg','Clients given 5E weighing 14-19.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5E weighing 14-19.9kg\n Clients given 5E weighing 14-19.9kg\n \n 2022-07-04 11:00:36 UTC\n \n 2022-07-04 11:07:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1726\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 16:30:36',4,'2022-07-04 16:37:08',4,0,NULL,NULL,NULL,'29478b1e-23c8-4fa0-a17e-9f3c11e801af'),(1727,'Clients given 5E weighing 20-24.9kg','Clients given 5E weighing 20-24.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5E weighing 20-24.9kg\n Clients given 5E weighing 20-24.9kg\n \n 2022-07-04 11:06:35 UTC\n \n 2022-07-04 11:08:57 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1727\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 16:36:35',4,'2022-07-04 16:38:57',4,0,NULL,NULL,NULL,'0a71c7f2-39c8-4d46-bdb3-847b616997b6'),(1728,'Clients given 5E weighing 25-34.9kg','Clients given 5E weighing 25-34.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5E weighing 25-34.9kg\n Clients given 5E weighing 25-34.9kg\n \n 2022-07-04 11:09:38 UTC\n \n 2022-07-04 11:12:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1728\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 16:39:38',4,'2022-07-04 16:42:02',4,0,NULL,NULL,NULL,'f20e7d1a-0f66-4fb8-a254-11720f9fcdb4'),(1729,'Clients given 5E weighing >= 35kg','Clients given 5E weighing >= 35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5E weighing >= 35kg\n Clients given 5E weighing >= 35kg\n \n 2022-07-04 11:10:10 UTC\n \n 2022-07-04 11:11:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1729\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 16:40:10',4,'2022-07-04 16:41:28',4,0,NULL,NULL,NULL,'6c8300f9-3327-46f5-b538-5926daf7f3e9'),(1730,'Clients given 5F weighing 0-3.9kg','Clients given 5F weighing 0-3.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5F weighing 0-3.9kg\n Clients given 5F weighing 0-3.9kg\n \n 2022-07-04 11:12:43 UTC\n \n 2022-07-04 11:16:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1730\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 16:42:43',4,'2022-07-04 16:46:11',4,0,NULL,NULL,NULL,'cc140697-6404-4bfa-927a-1e331e05a771'),(1731,'Clients given 5F weighing 4-5.9kg','Clients given 5F weighing 4-5.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5F weighing 4-5.9kg\n Clients given 5F weighing 4-5.9kg\n \n 2022-07-04 11:15:42 UTC\n \n 2022-07-04 11:17:37 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1731\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 16:45:42',4,'2022-07-04 16:47:37',4,0,NULL,NULL,NULL,'feee080e-df6e-4d55-a631-a5b8e6561be8'),(1732,'Clients given 5F weighing 6-9.9kg','Clients given 5F weighing 6-9.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5F weighing 6-9.9kg\n Clients given 5F weighing 6-9.9kg\n \n 2022-07-04 11:16:51 UTC\n \n 2022-07-04 11:20:54 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1732\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 16:46:51',4,'2022-07-04 16:50:54',4,0,NULL,NULL,NULL,'fefc7c1d-f181-415a-b896-9ef303b4ce6a'),(1733,'Clients given 5F weighing 10-13.9kg','Clients given 5F weighing 10-13.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5F weighing 10-13.9kg\n Clients given 5F weighing 10-13.9kg\n \n 2022-07-04 11:19:35 UTC\n \n 2022-07-04 11:21:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1733\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 16:49:35',4,'2022-07-04 16:51:36',4,0,NULL,NULL,NULL,'cc52bd93-49e7-488c-9706-669f6401eb7a'),(1734,'Clients given 5F weighing 14-19.9kg','Clients given 5F weighing 14-19.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5F weighing 14-19.9kg\n Clients given 5F weighing 14-19.9kg\n \n 2022-07-04 11:27:47 UTC\n \n 2022-07-04 11:30:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1734\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 16:57:47',4,'2022-07-04 17:00:51',4,0,NULL,NULL,NULL,'a1b3f036-8f11-463c-906f-0907c8bb3168'),(1735,'Clients given 5F weighing 20-24.9kg','Clients given 5F weighing 20-24.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5F weighing 20-24.9kg\n Clients given 5F weighing 20-24.9kg\n \n 2022-07-04 11:28:06 UTC\n \n 2022-07-04 11:31:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1735\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 16:58:06',4,'2022-07-04 17:01:26',4,0,NULL,NULL,NULL,'545d0307-0065-48ef-b35d-db0b97d6f0a4'),(1736,'Clients given 5F weighing 25-34.9kg','Clients given 5F weighing 25-34.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5F weighing 25-34.9kg\n Clients given 5F weighing 25-34.9kg\n \n 2022-07-04 11:32:18 UTC\n \n 2022-07-04 11:34:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1736\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 17:02:18',4,'2022-07-04 17:04:20',4,0,NULL,NULL,NULL,'a3cc0250-e3f5-4b02-a569-d5737c7c2ca2'),(1737,'Clients given 5F weighing >= 35kg','Clients given 5F weighing >= 35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5F weighing >= 35kg\n Clients given 5F weighing >= 35kg\n \n 2022-07-04 11:32:59 UTC\n \n 2022-07-04 11:34:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1737\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 17:02:59',4,'2022-07-04 17:04:45',4,0,NULL,NULL,NULL,'ff867f63-d45f-4ffc-8378-22a72111492b'),(1738,'Clients given 5G weighing 0-3.9kg','Clients given 5G weighing 0-3.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G weighing 0-3.9kg\n Clients given 5G weighing 0-3.9kg\n \n 2022-07-04 11:37:11 UTC\n \n 2022-07-04 11:39:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1738\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 17:07:11',4,'2022-07-04 17:09:08',4,0,NULL,NULL,NULL,'b5725eac-2a7a-4f4b-be0b-670c5edae46f'),(1739,'Clients given 5G weighing 4-5.9kg','Clients given 5G weighing 4-5.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G weighing 4-5.9kg\n Clients given 5G weighing 4-5.9kg\n \n 2022-07-04 11:38:21 UTC\n \n 2022-07-04 11:40:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1739\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 17:08:21',4,'2022-07-04 17:10:28',4,0,NULL,NULL,NULL,'01b5a831-a97a-473d-9cab-171aed11937a'),(1740,'Clients given 5G weighing 6-9.9kg','Clients given 5G weighing 6-9.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G weighing 6-9.9kg\n Clients given 5G weighing 6-9.9kg\n \n 2022-07-04 11:40:56 UTC\n \n 2022-07-04 11:42:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1740\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 17:10:56',4,'2022-07-04 17:12:46',4,0,NULL,NULL,NULL,'b35556af-d5de-4740-8d7d-ee2c7415f2aa'),(1741,'Clients given 5G weighing 10-13.9kg','Clients given 5G weighing 10-13.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G weighing 10-13.9kg\n Clients given 5G weighing 10-13.9kg\n \n 2022-07-04 11:41:26 UTC\n \n 2022-07-04 11:43:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1741\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 17:11:26',4,'2022-07-04 17:13:31',4,0,NULL,NULL,NULL,'fecb7060-8111-4db9-aa13-9355bfe19034'),(1742,'Clients given 5G weighing 14-19.9kg','Clients given 5G weighing 14-19.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G weighing 14-19.9kg\n Clients given 5G weighing 14-19.9kg\n \n 2022-07-04 11:44:52 UTC\n \n 2022-07-04 11:47:38 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1742\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 17:14:52',4,'2022-07-04 17:17:38',4,0,NULL,NULL,NULL,'edcea1e9-f4fe-459c-a9a5-99dc5b454f6b'),(1743,'Clients given 5G weighing 20-24.9kg','Clients given 5G weighing 20-24.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G weighing 20-24.9kg\n Clients given 5G weighing 20-24.9kg\n \n 2022-07-04 11:45:28 UTC\n \n 2022-07-04 11:47:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1743\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 17:15:28',4,'2022-07-04 17:17:23',4,0,NULL,NULL,NULL,'d624256f-ee53-49de-b806-e54f0f885165'),(1744,'Clients given 5G weighing 25-34.9kg','Clients given 5G weighing 25-34.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G weighing 25-34.9kg\n Clients given 5G weighing 25-34.9kg\n \n 2022-07-04 11:48:46 UTC\n \n 2022-07-06 09:16:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1744\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 11:48:46',4,'2022-07-06 09:16:23',4,0,NULL,NULL,NULL,'2fdbe8de-90ef-4198-8960-6d195608e255'),(1745,'Clients given 5G weighing >= 35kg','Clients given 5G weighing >= 35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G weighing >= 35kg\n Clients given 5G weighing >= 35kg\n \n 2022-07-04 11:49:49 UTC\n \n 2022-07-04 11:51:52 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1745\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 17:19:49',4,'2022-07-04 17:21:52',4,0,NULL,NULL,NULL,'477dc5ab-12a7-4553-b65d-57ced1093ae7'),(1746,'Clients given 5G weighing 0-3.9kg','Clients given 5G weighing 0-3.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G weighing 0-3.9kg\n Clients given 5G weighing 0-3.9kg\n \n 2022-07-04 11:52:26 UTC\n \n 2022-07-04 11:55:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1746\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 17:22:26',4,'2022-07-04 17:25:43',4,0,NULL,NULL,NULL,'b30dd237-ce5e-4eb4-8c3e-e4522f1fc695'),(1747,'Clients given 5G weighing 4-5.9kg','Clients given 5G weighing 4-5.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G weighing 4-5.9kg\n Clients given 5G weighing 4-5.9kg\n \n 2022-07-04 11:53:47 UTC\n \n 2022-07-04 11:56:37 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1747\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 17:23:47',4,'2022-07-04 17:26:37',4,0,NULL,NULL,NULL,'8e235e40-e811-4db9-82c2-ab1b5d2965f9'),(1748,'Clients given 5G weighing 6-9.9kg','Clients given 5G weighing 6-9.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G weighing 6-9.9kg\n Clients given 5G weighing 6-9.9kg\n \n 2022-07-04 11:57:59 UTC\n \n 2022-07-04 12:00:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1748\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 17:27:59',4,'2022-07-04 17:30:12',4,0,NULL,NULL,NULL,'b0a0a091-97ba-49d0-9845-f10070dd4ea3'),(1749,'Clients given 5G weighing 10-13.9kg','Clients given 5G weighing 10-13.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G weighing 10-13.9kg\n Clients given 5G weighing 10-13.9kg\n \n 2022-07-04 11:58:53 UTC\n \n 2022-07-04 12:00:48 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1749\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 17:28:53',4,'2022-07-04 17:30:48',4,0,NULL,NULL,NULL,'3d826ce1-96c8-4e57-892d-c097e4ac9ac5'),(1750,'Clients given 5G weighing 14-19.9kg','Clients given 5G weighing 14-19.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G weighing 14-19.9kg\n Clients given 5G weighing 14-19.9kg\n \n 2022-07-04 12:03:51 UTC\n \n 2022-07-04 12:08:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1750\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 17:33:51',4,'2022-07-04 17:38:23',4,0,NULL,NULL,NULL,'79890495-f468-4d64-b519-756630352b5d'),(1751,'Clients given 5G weighing 20-24.9kg','Clients given 5G weighing 20-24.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G weighing 20-24.9kg\n Clients given 5G weighing 20-24.9kg\n \n 2022-07-04 12:04:50 UTC\n \n 2022-07-04 18:39:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1751\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 17:34:50',4,'2022-07-05 00:09:28',4,0,NULL,NULL,NULL,'d06ae952-edbf-4c3e-b3a8-1c4ee70886fc'),(1752,' Clients given 5G weighing 25-29.9kg',' Clients given 5G weighing 25-29.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G weighing 25-29.9kg\n Clients given 5G weighing 25-29.9kg\n \n 2022-07-04 18:44:18 UTC\n \n 2022-07-04 18:47:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1752\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 00:14:18',4,'2022-07-05 00:17:20',4,0,NULL,NULL,NULL,'ad3c3764-3438-43a7-ade5-98458af16de5'),(1753,' Clients given 5G weighing >= 35kg',' Clients given 5G weighing >= 35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G weighing >= 35kg\n Clients given 5G weighing >= 35kg\n \n 2022-07-04 18:47:57 UTC\n \n 2022-07-04 18:49:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1753\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 00:17:57',4,'2022-07-05 00:19:45',4,0,NULL,NULL,NULL,'5c731dbc-ddd2-4a58-9e69-c112f74d40a7'),(1754,' Clients given 5H weighing 0-3.9kg',' Clients given 5H weighing 0-3.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5H weighing 0-3.9kg\n Clients given 5H weighing 0-3.9kg\n \n 2022-07-04 18:49:18 UTC\n \n 2022-07-04 18:53:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1754\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 00:19:18',4,'2022-07-05 00:23:27',4,0,NULL,NULL,NULL,'76ca732d-65f9-4ec3-8c5c-41d7503ed512'),(1755,' Clients given 5H weighing 4-5.9kg',' Clients given 5H weighing 4-5.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5H weighing 4-5.9kg\n Clients given 5H weighing 4-5.9kg\n \n 2022-07-04 18:54:29 UTC\n \n 2022-07-04 18:55:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1755\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 00:24:29',4,'2022-07-05 00:25:53',4,0,NULL,NULL,NULL,'75354bc7-40ec-489e-a13a-5b0de9d609cd'),(1756,' Clients given 5H weighing 6-9.9kg',' Clients given 5H weighing 6-9.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5H weighing 6-9.9kg\n Clients given 5H weighing 6-9.9kg\n \n 2022-07-04 18:55:07 UTC\n \n 2022-07-04 18:58:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1756\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 00:25:07',4,'2022-07-05 00:28:07',4,0,NULL,NULL,NULL,'4c27c57e-78ec-4934-837f-d52f59a8e263'),(1757,' Clients given 5H weighing 10-13.9kg',' Clients given 5H weighing 10-13.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5H weighing 10-13.9kg\n Clients given 5H weighing 10-13.9kg\n \n 2022-07-04 18:57:10 UTC\n \n 2022-07-04 19:05:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1757\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 00:27:10',4,'2022-07-05 00:35:15',4,0,NULL,NULL,NULL,'10ee2cc4-a8c0-46c7-8b26-2c69eafd6aed'),(1758,' Clients given 5H weighing 14-19.9kg',' Clients given 5H weighing 14-19.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5H weighing 14-19.9kg\n Clients given 5H weighing 14-19.9kg\n \n 2022-07-04 18:58:51 UTC\n \n 2022-07-04 19:01:57 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1758\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 00:28:51',4,'2022-07-05 00:31:57',4,0,NULL,NULL,NULL,'bfd4191f-c556-41df-8f09-970ece8eb883'),(1759,' Clients given 5H weighing 20-24.9kg',' Clients given 5H weighing 20-24.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5H weighing 20-24.9kg\n Clients given 5H weighing 20-24.9kg\n \n 2022-07-04 19:02:44 UTC\n \n 2022-07-04 19:03:54 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1759\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 00:32:44',4,'2022-07-05 00:33:54',4,0,NULL,NULL,NULL,'3118f852-4fd1-4807-abfc-6f4d8a4b34e3'),(1760,' Clients given 5H weighing 25-34.9kg',' Clients given 5H weighing 25-34.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5H weighing 25-34.9kg\n Clients given 5H weighing 25-34.9kg\n \n 2022-07-04 19:04:45 UTC\n \n 2022-07-04 19:07:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1760\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 00:34:45',4,'2022-07-05 00:37:04',4,0,NULL,NULL,NULL,'443efbd3-a0a9-473a-8408-e57b58477156'),(1761,' Clients given 5H weighing >= 35kg',' Clients given 5H weighing >= 35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5H weighing >= 35kg\n Clients given 5H weighing >= 35kg\n \n 2022-07-04 19:06:06 UTC\n \n 2022-07-04 19:07:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1761\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 00:36:06',4,'2022-07-05 00:37:27',4,0,NULL,NULL,NULL,'89320a1f-49b4-464e-8a37-21748419ed81'),(1762,' Clients given 6A weighing 0-3.9kg',' Clients given 6A weighing 0-3.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6A weighing 0-3.9kg\n Clients given 6A weighing 0-3.9kg\n \n 2022-07-04 19:08:02 UTC\n \n 2022-07-04 19:09:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1762\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 00:38:02',4,'2022-07-05 00:39:31',4,0,NULL,NULL,NULL,'f0cdda8e-9894-4125-b1c0-014ccc6ad7ea'),(1763,' Clients given 6A weighing 4-5.9kg',' Clients given 6A weighing 4-5.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6A weighing 4-5.9kg\n Clients given 6A weighing 4-5.9kg\n \n 2022-07-04 19:08:26 UTC\n \n 2022-07-04 19:09:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1763\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 00:38:26',4,'2022-07-05 00:39:50',4,0,NULL,NULL,NULL,'5701682a-a88c-46a8-957a-3322894a6e43'),(1764,' Clients given 6A weighing 6-9.9kg',' Clients given 6A weighing 6-9.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6A weighing 6-9.9kg\n Clients given 6A weighing 6-9.9kg\n \n 2022-07-04 19:10:14 UTC\n \n 2022-07-04 19:11:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1764\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 00:40:14',4,'2022-07-05 00:41:50',4,0,NULL,NULL,NULL,'92f27e6f-6178-4e65-b055-798f3dd1e1ae'),(1765,' Clients given 6A weighing 10-13.9kg',' Clients given 6A weighing 10-13.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6A weighing 10-13.9kg\n Clients given 6A weighing 10-13.9kg\n \n 2022-07-04 19:10:49 UTC\n \n 2022-07-04 19:12:19 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1765\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 00:40:49',4,'2022-07-05 00:42:19',4,0,NULL,NULL,NULL,'a74e222c-96c6-45f8-83e7-3ce0d50cc83c'),(1766,' Clients given 6A weighing 14-19.9kg',' Clients given 6A weighing 14-19.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6A weighing 14-19.9kg\n Clients given 6A weighing 14-19.9kg\n \n 2022-07-04 19:12:45 UTC\n \n 2022-07-04 19:14:57 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1766\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 00:42:45',4,'2022-07-05 00:44:57',4,0,NULL,NULL,NULL,'79e9b5db-636c-4afb-8291-cb558667ebd5'),(1767,' Clients given 6A weighing 20-24.9kg',' Clients given 6A weighing 20-24.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6A weighing 20-24.9kg\n Clients given 6A weighing 20-24.9kg\n \n 2022-07-04 19:13:20 UTC\n \n 2022-07-04 19:15:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1767\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 00:43:20',4,'2022-07-05 00:45:14',4,0,NULL,NULL,NULL,'11eeec05-8a04-4f44-bc0c-dddb88b8270d'),(1768,' Clients given 6A weighing 25-34.9kg',' Clients given 6A weighing 25-34.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6A weighing 25-34.9kg\n Clients given 6A weighing 25-34.9kg\n \n 2022-07-04 19:13:46 UTC\n \n 2022-07-04 19:15:35 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1768\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 00:43:46',4,'2022-07-05 00:45:35',4,0,NULL,NULL,NULL,'23c30258-a527-4c1e-92b8-c3d7310c7c49'),(1769,' Clients given 6A weighing >= 35kg',' Clients given 6A weighing >= 35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6A weighing >= 35kg\n Clients given 6A weighing >= 35kg\n \n 2022-07-04 19:16:05 UTC\n \n 2022-07-04 19:18:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1769\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 00:46:05',4,'2022-07-05 00:48:21',4,0,NULL,NULL,NULL,'eac739c5-ff7a-4169-a6c2-faba753958df'),(1770,' Clients given 6B weighing 0-3.9kg',' Clients given 6B weighing 0-3.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6B weighing 0-3.9kg\n Clients given 6B weighing 0-3.9kg\n \n 2022-07-04 19:16:33 UTC\n \n 2022-07-04 19:18:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1770\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 00:46:33',4,'2022-07-05 00:48:05',4,0,NULL,NULL,NULL,'6e8cb9ab-5663-4da1-9c67-9188bf5ce4c6'),(1771,' Clients given 6B weighing 4-5.9kg',' Clients given 6B weighing 4-5.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6B weighing 4-5.9kg\n Clients given 6B weighing 4-5.9kg\n \n 2022-07-04 19:16:56 UTC\n \n 2022-07-04 19:18:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1771\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 00:46:56',4,'2022-07-05 00:48:41',4,0,NULL,NULL,NULL,'6e7f8b89-d2bb-42a4-8b0d-687950bfd3a8'),(1772,' Clients given 6B weighing 6-9.9kg',' Clients given 6B weighing 6-9.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6B weighing 6-9.9kg\n Clients given 6B weighing 6-9.9kg\n \n 2022-07-04 19:19:08 UTC\n \n 2022-07-04 19:22:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1772\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 00:49:08',4,'2022-07-05 00:52:03',4,0,NULL,NULL,NULL,'4ccea0f3-80d7-4b3f-850f-93985538cfeb'),(1773,' Clients given 6B weighing 10-13.9kg',' Clients given 6B weighing 10-13.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6B weighing 10-13.9kg\n Clients given 6B weighing 10-13.9kg\n \n 2022-07-04 19:19:37 UTC\n \n 2022-07-04 19:22:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1773\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 00:49:37',4,'2022-07-05 00:52:18',4,0,NULL,NULL,NULL,'3c303fcf-f9db-4e5f-8e9e-33df86616930'),(1774,' Clients given 6B weighing 14-19.9kg',' Clients given 6B weighing 14-19.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6B weighing 14-19.9kg\n Clients given 6B weighing 14-19.9kg\n \n 2022-07-04 19:20:09 UTC\n \n 2022-07-04 19:24:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1774\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 00:50:09',4,'2022-07-05 00:54:44',4,0,NULL,NULL,NULL,'551ea342-168d-4089-834b-dab745648722'),(1775,' Clients given 6B weighing 20-24.9kg',' Clients given 6B weighing 20-24.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6B weighing 20-24.9kg\n Clients given 6B weighing 20-24.9kg\n \n 2022-07-04 19:20:32 UTC\n \n 2022-07-04 19:23:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1775\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 00:50:32',4,'2022-07-05 00:53:03',4,0,NULL,NULL,NULL,'42e304a1-3961-4344-ae32-2348b7a5b81a'); -INSERT INTO `serialized_object` VALUES (1776,' Clients given 6B weighing 25-34.9kg',' Clients given 6B weighing 25-34.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6B weighing 25-34.9kg\n Clients given 6B weighing 25-34.9kg\n \n 2022-07-04 19:23:47 UTC\n \n 2022-07-04 19:27:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1776\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 00:53:47',4,'2022-07-05 00:57:17',4,0,NULL,NULL,NULL,'70621294-d632-4b66-8f10-0343433b8267'),(1777,' Clients given 6B weighing >= 35kg',' Clients given 6B weighing >= 35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6B weighing >= 35kg\n Clients given 6B weighing >= 35kg\n \n 2022-07-04 19:24:19 UTC\n \n 2022-07-04 19:27:33 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1777\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 00:54:19',4,'2022-07-05 00:57:33',4,0,NULL,NULL,NULL,'ed32ff5b-41ed-4933-a39e-bc4fb685b9eb'),(1778,'Clients given 6C weighing 0-3.9kg','Clients given 6C weighing 0-3.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C weighing 0-3.9kg\n Clients given 6C weighing 0-3.9kg\n \n 2022-07-05 06:03:11 UTC\n \n 2022-07-05 06:05:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1778\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:33:11',4,'2022-07-05 11:35:26',4,0,NULL,NULL,NULL,'7708c697-6d7d-42e7-aba6-613e36081fab'),(1779,'Clients given 6C weighing 4-5.9kg','Clients given 6C weighing 6-9.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C weighing 4-5.9kg\n Clients given 6C weighing 6-9.9kg\n \n 2022-07-05 06:03:33 UTC\n \n 2022-07-05 06:09:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1779\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:33:33',4,'2022-07-05 11:39:04',4,0,NULL,NULL,NULL,'95504660-becd-4eff-a280-5aa869762885'),(1780,'Clients given 6C weighing 6-9.9kg','Clients given 6C weighing 6-9.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C weighing 6-9.9kg\n Clients given 6C weighing 6-9.9kg\n \n 2022-07-05 06:03:55 UTC\n \n 2022-07-05 06:07:47 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1780\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:33:55',4,'2022-07-05 11:37:47',4,0,NULL,NULL,NULL,'d3ba1e90-03ce-4af3-8b68-9e4bb86a2fda'),(1781,'Clients given 6C weighing 10-13.9kg','Clients given 6C weighing 10-13.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C weighing 10-13.9kg\n Clients given 6C weighing 10-13.9kg\n \n 2022-07-05 06:09:31 UTC\n \n 2022-07-05 06:12:33 UTC\n \n \n location\n \n org.openmrs.Location\n true\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n 1781\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:39:31',4,'2022-07-05 11:42:33',4,0,NULL,NULL,NULL,'bd61f262-344c-4834-846b-dbfd4b8f8454'),(1782,'Clients given 6C weighing 14-19.9kg','Clients given 6C weighing 14-19.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C weighing 14-19.9kg\n Clients given 6C weighing 14-19.9kg\n \n 2022-07-05 06:11:03 UTC\n \n 2022-07-05 06:14:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1782\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:41:03',4,'2022-07-05 11:44:18',4,0,NULL,NULL,NULL,'ef452600-16ec-4d05-bf02-a2f5da8c503d'),(1783,'Clients given 6C weighing 20-24.9kg','Clients given 6C weighing 20-24.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C weighing 20-24.9kg\n Clients given 6C weighing 20-24.9kg\n \n 2022-07-05 06:12:09 UTC\n \n 2022-07-05 06:14:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1783\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:42:09',4,'2022-07-05 11:44:44',4,0,NULL,NULL,NULL,'84b7e946-ef4b-498c-aa99-a7469d841d89'),(1784,'Clients given 6C weighing 25-34.9kg','Clients given 6C weighing 25-34.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C weighing 25-34.9kg\n Clients given 6C weighing 25-34.9kg\n \n 2022-07-05 06:13:57 UTC\n \n 2022-07-05 06:17:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1784\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:43:57',4,'2022-07-05 11:47:03',4,0,NULL,NULL,NULL,'d0662ec5-9909-46a1-8d42-4f13c5e08f54'),(1785,'Clients given 6C weighing >= 35kg','Clients given 6C weighing >= 35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C weighing >= 35kg\n Clients given 6C weighing >= 35kg\n \n 2022-07-05 06:17:43 UTC\n \n 2022-07-05 06:20:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1785\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:47:43',4,'2022-07-05 11:50:43',4,0,NULL,NULL,NULL,'e469295b-caa7-4154-b5ac-e2d0a7042d5b'),(1786,'Clients given 6D weighing 0-3.9kg','Clients given 6D weighing 0-3.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D weighing 0-3.9kg\n Clients given 6D weighing 0-3.9kg\n \n 2022-07-05 06:18:16 UTC\n \n 2022-07-05 06:19:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1786\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:48:16',4,'2022-07-05 11:49:53',4,0,NULL,NULL,NULL,'a6985c5b-86f8-4647-86ea-ddd69097681e'),(1787,'Clients given 6D weighing 4-5.9kg','Clients given 6D weighing 4-5.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D weighing 4-5.9kg\n Clients given 6D weighing 4-5.9kg\n \n 2022-07-05 06:18:43 UTC\n \n 2022-07-05 06:20:24 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1787\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:48:43',4,'2022-07-05 11:50:24',4,0,NULL,NULL,NULL,'3eec1d07-6d91-43dd-a942-24d23e4a0f9c'),(1788,'Clients given 6D weighing 6-9.9kg','Clients given 6D weighing 6-9.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D weighing 6-9.9kg\n Clients given 6D weighing 6-9.9kg\n \n 2022-07-05 06:21:17 UTC\n \n 2022-07-05 06:22:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1788\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:51:17',4,'2022-07-05 11:52:45',4,0,NULL,NULL,NULL,'37509f55-cbd9-4096-8522-1e7918b1a48c'),(1789,'Clients given 6D weighing 10-13.9kg','Clients given 6D weighing 10-13.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D weighing 10-13.9kg\n Clients given 6D weighing 10-13.9kg\n \n 2022-07-05 06:21:34 UTC\n \n 2022-07-05 06:23:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1789\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:51:34',4,'2022-07-05 11:53:04',4,0,NULL,NULL,NULL,'477311cf-0367-47e1-9717-4732fc0752f0'),(1790,'Clients given 6D weighing 14-19.9kg','Clients given 6D weighing 14-19.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D weighing 14-19.9kg\n Clients given 6D weighing 14-19.9kg\n \n 2022-07-05 06:21:55 UTC\n \n 2022-07-05 06:23:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1790\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:51:55',4,'2022-07-05 11:53:21',4,0,NULL,NULL,NULL,'62232334-aa48-4e29-92fc-c4f931bcfb01'),(1791,'Clients given 6D weighing 20-24.9kg','Clients given 6D weighing 20-24.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D weighing 20-24.9kg\n Clients given 6D weighing 20-24.9kg\n \n 2022-07-05 06:23:43 UTC\n \n 2022-07-05 06:25:33 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1791\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:53:43',4,'2022-07-05 11:55:33',4,0,NULL,NULL,NULL,'8b171cf1-4052-49f3-9b28-76161872f1ac'),(1792,'Clients given 6D weighing 25-34.9kg','Clients given 6D weighing 25-34.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D weighing 25-34.9kg\n Clients given 6D weighing 25-34.9kg\n \n 2022-07-05 06:24:03 UTC\n \n 2022-07-05 06:25:47 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1792\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:54:03',4,'2022-07-05 11:55:47',4,0,NULL,NULL,NULL,'20d6a8c0-12ee-420c-a3f6-22d2e7a829bd'),(1793,'Clients given 6D weighing >= 35kg','Clients given 6D weighing >= 35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D weighing >= 35kg\n Clients given 6D weighing >= 35kg\n \n 2022-07-05 06:24:35 UTC\n \n 2022-07-05 06:26:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1793\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:54:35',4,'2022-07-05 11:56:11',4,0,NULL,NULL,NULL,'41d104fe-8277-4caa-b55e-07ea346801a7'),(1794,'Clients given 6E weighing 0-3.9 kg','Clients given 6E weighing 0-3.9 kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E weighing 0-3.9 kg\n Clients given 6E weighing 0-3.9 kg\n \n 2022-07-05 06:27:58 UTC\n \n 2022-07-05 06:30:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1794\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:57:58',4,'2022-07-05 12:00:43',4,0,NULL,NULL,NULL,'ddcdfef8-c5fd-4bd2-9963-4d5d48702f57'),(1795,'Clients given 6E weighing 4-5.9 kg','Clients given 6E weighing 4-5.9 kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E weighing 4-5.9 kg\n Clients given 6E weighing 4-5.9 kg\n \n 2022-07-05 06:28:17 UTC\n \n 2022-07-05 06:32:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1795\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:58:17',4,'2022-07-05 12:02:01',4,0,NULL,NULL,NULL,'52757686-f3a7-4d53-84bb-76aea347f4d3'),(1796,'Clients given 6E weighing 6-9.9 kg','Clients given 6E weighing 6-9.9 kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E weighing 6-9.9 kg\n Clients given 6E weighing 6-9.9 kg\n \n 2022-07-05 06:30:03 UTC\n \n 2022-07-05 06:31:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1796\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${endDate}\n \n \n \n','2022-07-05 12:00:03',4,'2022-07-05 12:01:15',4,0,NULL,NULL,NULL,'d0682189-7d23-4c17-9648-ae39ea0f6916'),(1797,'Clients given 6E weighing 10-13.9 kg','Clients given 6E weighing 10-13.9 kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E weighing 10-13.9 kg\n Clients given 6E weighing 10-13.9 kg\n \n 2022-07-05 06:32:34 UTC\n \n 2022-07-05 06:34:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1797\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 12:02:34',4,'2022-07-05 12:04:30',4,0,NULL,NULL,NULL,'ad8a6b3c-88dd-4328-b042-076242f1ce54'),(1798,'Clients given 6E weighing 14-19.9 kg','Clients given 6E weighing 14-19.9 kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E weighing 14-19.9 kg\n Clients given 6E weighing 14-19.9 kg\n \n 2022-07-05 06:33:01 UTC\n \n 2022-07-05 06:34:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1798\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 12:03:01',4,'2022-07-05 12:04:51',4,0,NULL,NULL,NULL,'d58c1b55-d21c-497a-b201-c1f544c8264c'),(1799,'Clients given 6E weighing 20-24.9 kg','Clients given 6E weighing 20-24.9 kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E weighing 20-24.9 kg\n Clients given 6E weighing 20-24.9 kg\n \n 2022-07-05 06:33:24 UTC\n \n 2022-07-05 06:35:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1799\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 12:03:24',4,'2022-07-05 12:05:10',4,0,NULL,NULL,NULL,'e38de12c-6c72-4188-a8b7-b6d912e7baf2'),(1800,'Clients given 6E weighing 25-34.9 kg','Clients given 6E weighing 25-34.9 kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E weighing 25-34.9 kg\n Clients given 6E weighing 25-34.9 kg\n \n 2022-07-05 06:35:31 UTC\n \n 2022-07-05 06:37:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1800\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 12:05:31',4,'2022-07-05 12:07:03',4,0,NULL,NULL,NULL,'24def27b-738c-424e-b397-689a9fc28dd0'),(1801,'Clients given 6E weighing >= 35 kg','Clients given 6E weighing >= 35 kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E weighing >= 35 kg\n Clients given 6E weighing >= 35 kg\n \n 2022-07-05 06:35:59 UTC\n \n 2022-07-05 06:37:19 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1801\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 12:05:59',4,'2022-07-05 12:07:19',4,0,NULL,NULL,NULL,'bc732e0d-7aa7-412d-855c-76442487b9c9'),(1802,'Clients given 6F weighing 4-5.9kg','Clients given 6F weighing 4-5.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F weighing 4-5.9kg\n Clients given 6F weighing 4-5.9kg\n \n 2022-07-05 06:38:03 UTC\n \n 2022-07-05 06:42:09 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1802\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 12:08:03',4,'2022-07-05 12:12:09',4,0,NULL,NULL,NULL,'31aaf13e-0c70-472d-9d6f-8d288c6545d7'),(1803,'Clients given 6F weighing 0-3.9kg','Clients given 6F weighing 0-3.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F weighing 0-3.9kg\n Clients given 6F weighing 0-3.9kg\n \n 2022-07-05 06:38:38 UTC\n \n 2022-07-05 06:43:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1803\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 12:08:38',4,'2022-07-05 12:13:27',4,0,NULL,NULL,NULL,'ec58cc67-3866-4031-a385-d5f40bf5fa80'),(1804,'Clients given 6F weighing 6-9.9kg','Clients given 6F weighing 6-9.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F weighing 6-9.9kg\n Clients given 6F weighing 6-9.9kg\n \n 2022-07-05 06:40:34 UTC\n \n 2022-07-05 06:42:24 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1804\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${endDate}\n \n \n \n','2022-07-05 12:10:34',4,'2022-07-05 12:12:24',4,0,NULL,NULL,NULL,'ece7781b-8125-44f0-8189-6f4f66258b2c'),(1805,'Clients given 6F weighing 10-13.9kg','Clients given 6F weighing 10-13.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F weighing 10-13.9kg\n Clients given 6F weighing 10-13.9kg\n \n 2022-07-05 06:44:04 UTC\n \n 2022-07-05 06:47:25 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1805\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 12:14:04',4,'2022-07-05 12:17:25',4,0,NULL,NULL,NULL,'6cd6003e-fd2a-4acd-acbf-8025ed274332'),(1806,'Clients given 6F weighing 14-19.9kg','Clients given 6F weighing 14-19.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F weighing 14-19.9kg\n Clients given 6F weighing 14-19.9kg\n \n 2022-07-05 06:44:30 UTC\n \n 2022-07-05 06:50:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1806\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 12:14:30',4,'2022-07-05 12:20:01',4,0,NULL,NULL,NULL,'c465345e-8ab1-45d7-972a-d39b87dd1ade'),(1807,'Clients given 6F weighing 20-24.9kg','Clients given 6F weighing 20-24.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F weighing 20-24.9kg\n Clients given 6F weighing 20-24.9kg\n \n 2022-07-05 06:44:51 UTC\n \n 2022-07-05 06:46:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1807\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 12:14:51',4,'2022-07-05 12:16:42',4,0,NULL,NULL,NULL,'383ecc01-a8e6-42b4-83f3-eb9c2e48386b'),(1808,'Clients given 6F weighing 25-34.9kg','Clients given 6F weighing 25-34.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F weighing 25-34.9kg\n Clients given 6F weighing 25-34.9kg\n \n 2022-07-05 06:49:35 UTC\n \n 2022-07-05 06:54:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1808\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 12:19:35',4,'2022-07-05 12:24:29',4,0,NULL,NULL,NULL,'bacab6c2-b1d6-4a10-9f0d-ffb24844bae5'),(1809,'Clients given 6F weighing >= 35kg','Clients given 6F weighing >= 35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F weighing >= 35kg\n Clients given 6F weighing >= 35kg\n \n 2022-07-05 06:53:17 UTC\n \n 2022-07-05 06:56:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1809\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 12:23:17',4,'2022-07-05 12:26:41',4,0,NULL,NULL,NULL,'2614b81d-6441-4ee3-b4a7-a15f3ba36ace'),(1810,'Children ARV Regimen_2ndLine_2022','Children ARV Regimen_2ndLine','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_2022\n Children ARV Regimen_2ndLine\n \n 2022-07-06 07:16:05 UTC\n \n 2022-07-06 10:13:16 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1810\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2022-07-06 07:16:05',4,'2022-07-06 10:13:16',4,0,NULL,NULL,NULL,'dffce2c4-7adc-497e-8216-fa138d0201b1'),(1811,'Children ARV Regimen_2ndLine Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine Data Set\n \n 2022-07-06 07:16:44 UTC\n \n 2022-07-06 10:11:25 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1811\n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n 5A0to3.9\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Age\n Children 0to14\n \n \n \n \n \n 5A10to13.9\n \n \n \n \n \n \n \n \n \n 5A14to19.9\n \n \n \n \n \n \n \n \n \n 5A20to24.9\n \n \n \n \n \n \n \n \n \n 5A25to34.9\n \n \n \n \n \n \n \n \n \n 5A35plus\n \n \n \n \n \n \n \n \n \n 5A4to5.9\n \n \n \n \n \n \n \n \n \n 5A6to9.9\n \n \n \n \n \n \n \n \n \n 5B0to3.9\n \n \n \n \n \n \n \n \n \n 5B10to13.9\n \n \n \n \n \n \n \n \n \n 5B14to19.9\n \n \n \n \n \n \n \n \n \n 5B20to24.9\n \n \n \n \n \n \n \n \n \n 5B25to34.9\n \n \n \n \n \n \n \n \n \n 5B35plus\n \n \n \n \n \n \n \n \n \n 5B4to5.9\n \n \n \n \n \n \n \n \n \n 5B6to9.9\n \n \n \n \n \n \n \n \n \n 5C0to3.9\n \n \n \n \n \n \n \n \n \n 5C10to13.9\n \n \n \n \n \n \n \n \n \n 5C14to19.9\n \n \n \n \n \n \n \n \n \n 5C20to24.9\n \n \n \n \n \n \n \n \n \n 5C25to34.9\n \n \n \n \n \n \n \n \n \n 5C35plus\n \n \n \n \n \n \n \n \n \n 5C4to5.9\n \n \n \n \n \n \n \n \n \n 5C6to9.9\n \n \n \n \n \n \n \n \n \n 5D0to3.9\n \n \n \n \n \n \n \n \n \n 5D10to13.9\n \n \n \n \n \n \n \n \n \n 5D14to19.9\n \n \n \n \n \n \n \n \n \n 5D20to24.9\n \n \n \n \n \n \n \n \n \n 5D25to34.9\n \n \n \n \n \n \n \n \n \n 5D35plus\n \n \n \n \n \n \n \n \n \n 5D4to5.9\n \n \n \n \n \n \n \n \n \n 5D6to9.9\n \n \n \n \n \n \n \n \n \n 5E0to3.9\n \n \n \n \n \n \n \n \n \n 5E10to13.9\n \n \n \n \n \n \n \n \n \n 5E14to19.9\n \n \n \n \n \n \n \n \n \n 5E20to24.9\n \n \n \n \n \n \n \n \n \n 5E25to34.9\n \n \n \n \n \n \n \n \n \n 5E35plus\n \n \n \n \n \n \n \n \n \n 5E4to5.9\n \n \n \n \n \n \n \n \n \n 5E6to9.9\n \n \n \n \n \n \n \n \n \n 5F0to3.9\n \n \n \n \n \n \n \n \n \n 5F10to13.9\n \n \n \n \n \n \n \n \n \n 5F14to19.9\n \n \n \n \n \n \n 5F20to24.9\n \n \n \n \n \n \n \n \n \n 5F25to34.9\n \n \n \n \n \n \n \n \n \n 5F35plus\n \n \n \n \n \n \n \n \n \n 5F4to5.9\n \n \n \n \n \n \n \n \n \n 5F6to9.9\n \n \n \n \n \n \n \n \n \n 5G0to3.9\n \n \n \n \n \n \n \n \n \n 5G10to13.9\n \n \n \n \n \n \n \n \n \n 5G14to19.9\n \n \n \n \n \n \n \n \n \n 5G20to24.9\n \n \n \n \n \n \n \n \n \n 5G25to34.9\n \n \n \n \n \n \n \n \n \n 5G35plus\n \n \n \n \n \n \n \n \n \n 5G4to5.9\n \n \n \n \n \n \n \n \n \n 5G6to9.9\n \n \n \n \n \n \n \n \n \n 5H0to3.9\n \n \n \n \n \n \n \n \n \n 5H10to13.9\n \n \n \n \n \n \n \n \n \n 5H14to19.9\n \n \n \n \n \n \n \n \n \n 5H20to24.9\n \n \n \n \n \n \n \n \n \n 5H25to34.9\n \n \n \n \n \n \n \n \n \n 5H35plus\n \n \n \n \n \n \n \n \n \n 5H4to5.9\n \n \n \n \n \n \n \n \n \n 5H6to9.9\n \n \n \n \n \n \n \n \n \n','2022-07-06 07:16:44',4,'2022-07-06 10:11:25',4,0,NULL,NULL,NULL,'437a2414-1894-4eb5-8c13-356a8e2aa747'),(1812,'Children ARV Regimen_3rdLine_2022','Children ARV Regimen_3rdLine','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_2022\n Children ARV Regimen_3rdLine\n \n 2022-07-06 10:16:11 UTC\n \n 2022-07-06 10:16:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1812\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2022-07-06 10:16:11',4,'2022-07-06 10:16:23',4,0,NULL,NULL,NULL,'b6b0cf68-1305-49a2-8f43-30f3f175958d'),(1813,'Children ARV Regimen_3rdLine_2022 Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_2022 Data Set\n \n 2022-07-06 10:16:23 UTC\n \n 2022-07-06 14:44:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1813\n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n 6A0to3.9\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Age\n Children 0to14\n \n \n \n \n \n 6A10to13.9\n \n \n \n \n \n \n \n \n \n 6A14to19.9\n \n \n \n \n \n \n \n \n \n 6A20to24.9\n \n \n \n \n \n \n \n \n \n 6A25to34.9\n \n \n \n \n \n \n \n \n \n 6A35plus\n \n \n \n \n \n \n \n \n \n 6A4to5.9\n \n \n \n \n \n \n \n \n \n 6A6to9.9\n \n \n \n \n \n \n \n \n \n 6B0to3.9\n \n \n \n \n \n \n \n \n \n 6B10to13.9\n \n \n \n \n \n \n \n \n \n 6B14to19.9\n \n \n \n \n \n \n \n \n \n 6B20to24.9\n \n \n \n \n \n \n \n \n \n 6B25to34.9\n \n \n \n \n \n \n \n \n \n 6B35plus\n \n \n \n \n \n \n \n \n \n 6B4to5.9\n \n \n \n \n \n \n \n \n \n 6B6to9.9\n \n \n \n \n \n \n \n \n \n 6C0to3.9\n \n \n \n \n \n \n \n \n \n 6C10to13.9\n \n \n \n \n \n \n \n \n \n 6C14to19.9\n \n \n \n \n \n \n \n \n \n 6C20to24.9\n \n \n \n \n \n \n \n \n \n 6C25to34.9\n \n \n \n \n \n \n \n \n \n 6C35plus\n \n \n \n \n \n \n \n \n \n 6C4to5.9\n \n \n \n \n \n \n \n \n \n 6C6to9.9\n \n \n \n \n \n \n \n \n \n 6D0to3.9\n \n \n \n \n \n \n \n \n \n 6D10to13.9\n \n \n \n \n \n \n \n \n \n 6D14to19.9\n \n \n \n \n \n \n \n \n \n 6D20to24.9\n \n \n \n \n \n \n \n \n \n 6D25to34.9\n \n \n \n \n \n \n \n \n \n 6D35plus\n \n \n \n \n \n \n \n \n \n 6D4to5.9\n \n \n \n \n \n \n \n \n \n 6D6to9.9\n \n \n \n \n \n \n \n \n \n 6E0to3.9\n \n \n \n \n \n \n \n \n \n 6E10to13.9\n \n \n \n \n \n \n \n \n \n 6E14to19.9\n \n \n \n \n \n \n \n \n \n 6E20to24.9\n \n \n \n \n \n \n \n \n \n 6E25to34.9\n \n \n \n \n \n \n \n \n \n 6E35plus\n \n \n \n \n \n \n \n \n \n 6E4to5.9\n \n \n \n \n \n \n \n \n \n 6E6to9.9\n \n \n \n \n \n \n \n \n \n 6F0to3.9\n \n \n \n \n \n \n \n \n \n 6F10to13.9\n \n \n \n \n \n \n \n \n \n 6F14to19.9\n \n \n \n \n \n \n \n \n \n 6F20to24.9\n \n \n \n \n \n \n \n \n \n 6F25to34.9\n \n \n \n \n \n \n \n \n \n 6F35plus\n \n \n \n \n \n \n \n \n \n 6F4to5.9\n \n \n \n \n \n \n \n \n \n 6F6to9.9\n \n \n \n \n \n \n \n \n \n','2022-07-06 10:16:23',4,'2022-07-06 14:44:30',4,0,NULL,NULL,NULL,'3fa2b422-d556-4710-bfd7-bc8a5b0c9c0b'),(1814,'TX_ML-06 Clients who are current on ART at reporting period and experienced IIT_3-5 months','TX_ML-06 Clients who are current on ART at reporting period and experienced IIT_3-5 months','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TX_ML-06 Clients who are current on ART at reporting period and experienced IIT_3-5 months\n TX_ML-06 Clients who are current on ART at reporting period and experienced IIT_3-5 months\n \n 2022-08-10 11:03:51 UTC\n \n 2024-02-15 09:03:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1814\n select obs_ml_clients.person_id \nfrom obs os \ninner join location l on os.location_id = l.location_id \ninner join \n( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND patient.voided = 0 AND o.voided = 0 \n AND o.person_id in ( \n select person_id \n from \n (select oss.person_id, MAX(oss.obs_datetime) as max_observation, SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_datetime)), 20) AS latest_follow_up \n from obs oss \n inner join person p on oss.person_id=p.person_id and oss.concept_id = 3752 and oss.voided=0 \n and oss.obs_datetime < cast(:startDate as DATE) \n group by p.person_id \n having datediff(CAST(DATE_ADD(CAST(:startDate AS DATE), INTERVAL -1 DAY) AS DATE), latest_follow_up) < 29) as On_ART_Beginning_Quarter \n ) \n AND o.person_id in ( \n select person_id \n from \n (select oss.person_id, MAX(oss.obs_datetime) as max_observation, SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_datetime)), 20) AS latest_follow_up \n from obs oss \n inner join person p on oss.person_id=p.person_id and oss.concept_id = 3752 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as DATE) \n group by p.person_id \n having datediff(CAST(:endDate AS DATE), latest_follow_up) > 28) as Missed_Greater_Than_28Days \n ) \n INNER JOIN patient_identifier ON patient_identifier.patient_id = patient.patient_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n group by patient.patient_id \n UNION \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND patient.voided = 0 AND o.voided = 0 \n AND o.concept_id = 2249 and cast(o.value_datetime as date) >= cast(:startDate as DATE) and cast(o.value_datetime as date) <= cast(:endDate as DATE) \n AND o.person_id in ( \n select person_id \n from \n (select oss.person_id, MAX(oss.obs_datetime) as max_observation, SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_datetime)), 20) AS latest_follow_up \n from obs oss \n inner join person p on oss.person_id=p.person_id and oss.concept_id = 3752 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as DATE) \n group by p.person_id \n having datediff(CAST(:endDate AS DATE), latest_follow_up) > 28) as Missed_Greater_Than_28Days \n ) \n INNER JOIN patient_identifier ON patient_identifier.patient_id = patient.patient_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n group by patient.patient_id \n) as obs_ml_clients on os.person_id = obs_ml_clients.person_id \nINNER JOIN person ON person.person_id = obs_ml_clients.person_id AND person.voided = 0 \nINNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \nWHERE os.location_id =:location or parent_location =:location \n -- INITIATED ON ART BETWEEN 3 AND 5 MONTHS AGO \n AND obs_ml_clients.person_id in ( \n select distinct os.person_id \n from obs os \n where os.concept_id = 2249 \n AND datediff(CAST(:endDate AS DATE), os.value_datetime) BETWEEN 89 AND 180 \n ) \n -- NOT Transfered Out to Another Site \n AND obs_ml_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where os.concept_id = 4155 and os.value_coded = 2146 \n AND os.obs_datetime <= CAST(:endDate AS DATE) \n ) \n -- NOT DEAD \n AND obs_ml_clients.person_id not in ( \n select person_id \n from person \n where death_date <= CAST(:endDate AS DATE) \n and dead = 1 \n ) \nAND obs_ml_clients.person_id not in ( \n -- Visitors \n select o.person_id \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as examination_timing \n from obs oss \n where oss.concept_id = 3753 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where concept_id = 5416 \n and o.value_coded =1 and o.voided=0 \n and cast(o.obs_datetime as date) = cast(max_observation as date) \n )\n','2022-08-10 16:33:51',4,'2024-02-15 14:33:32',4,0,NULL,NULL,NULL,'e2a2e29e-040a-45b1-902d-fa25074d52a1'),(1815,'CI63:TxML IIT3-5','TxML IIT3-5','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CI63:TxML IIT3-5\n TxML IIT3-5\n \n 2022-08-10 11:07:17 UTC\n \n 2022-08-10 11:08:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1815\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-08-10 11:07:17',4,'2022-08-10 11:08:59',4,0,NULL,NULL,NULL,'781f34cd-9cce-41ef-acbe-b89b0e1257e4'),(1816,'TX_RTT-02 Clients with IIT for < 3 months in previous period who restarted ARV\'s during current period','TX_RTT-02 Clients with IIT for < 3 months in previous period who restarted ARV\'s during current period','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TX_RTT-02 Clients with IIT for < 3 months in previous period who restarted ARV's during current period\n TX_RTT-02 Clients with IIT for < 3 months in previous period who restarted ARV's during current period\n \n 2022-08-23 16:34:31 UTC\n \n 2024-02-15 08:22:47 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1816\n select distinct o.person_id \nfrom obs o \n-- PATIENTS WITH NO CLINICAL CONTACT OR ARV PICK-UP FOR GREATER THAN 28 DAYS \n-- SINCE THEIR LAST EXPECTED CONTACT WHO RESTARTED ARVs WITHIN THE REPORTING PERIOD \ninner join location l on o.location_id = l.location_id \nINNER JOIN patient ON o.person_id = patient.patient_id \nAND patient.voided = 0 AND o.voided = 0 \nAND o.person_id in ( \n select person_id \n from \n (select oss.person_id, MAX(oss.obs_datetime) as max_observation, SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_datetime)), 20) AS latest_follow_up \n from obs oss \n inner join person p on oss.person_id=p.person_id and oss.concept_id = 3752 and oss.voided=0 \n and oss.obs_datetime < cast(:startDate as DATE) \n group by p.person_id \n having datediff(CAST(DATE_ADD(CAST(:startDate AS DATE), INTERVAL -1 DAY) AS DATE), latest_follow_up) BETWEEN 29 and 90) as Missed_Greater_Than_28Days \n ) \n \n -- Client Seen: As either patient OR Treatment Buddy \n AND ( \n o.person_id in ( \n select distinct os.person_id \n from obs os \n where (os.concept_id = 3843 AND os.value_coded = 3841 OR os.value_coded = 3842) \n AND os.obs_datetime BETWEEN CAST(:startDate AS DATE) AND CAST(:endDate AS DATE) \n ) \n \n -- Client Seen and Date Restarted picked \n OR o.person_id in ( \n select distinct os.person_id \n from obs os \n where os.concept_id = 3708 AND os.value_datetime BETWEEN CAST(:startDate AS DATE) AND CAST(:endDate AS DATE) \n ) \n ) \n -- Still on treatment at the end of the reporting period \n AND o.person_id in ( \n select person_id \n from \n (select oss.person_id, MAX(oss.obs_datetime) as max_observation, SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_datetime)), 20) AS latest_follow_up \n from obs oss \n inner join person p on oss.person_id=p.person_id and oss.concept_id = 3752 and oss.voided=0 \n and oss.obs_datetime >= cast(:startDate as DATE) and oss.obs_datetime <= cast(:endDate as DATE) \n group by p.person_id \n having datediff(CAST(:endDate AS DATE), latest_follow_up) <= 28) as Still_On_Treatment_End_Period \n ) \n \n -- Transfered Out to Another Site during their latest encounter before the start date \n AND o.person_id not in ( \n select person_id \n from \n (select oss.person_id, MAX(oss.obs_datetime) as max_observation, SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) AS last_obs_tout \n from obs oss \n inner join person p on oss.person_id=p.person_id and oss.concept_id = 4155 and oss.voided=0 \n and oss.obs_datetime < cast(:startDate as DATE) \n group by p.person_id \n having last_obs_tout = 2146) as Transfered_Out_In_Last_Encounter \n ) \n \n-- NOT Transfered In from another Site \n AND o.person_id not in ( \n select os.person_id \n from obs os \n where (os.concept_id = 2253 AND DATE(os.value_datetime) BETWEEN CAST(:startDate AS DATE) AND CAST(:endDate AS DATE)) \n AND os.voided = 0 \n ) \n \n AND o.person_id not in ( \n select person_id \n from person \n where death_date <= CAST(:endDate AS DATE) \n and dead = 1 \n ) \n AND o.person_id not in ( \n -- Visitors \n select o.person_id \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as examination_timing \n from obs oss \n where oss.concept_id = 3753 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where concept_id = 5416 \n and o.value_coded =1 and o.voided=0 \n and cast(o.obs_datetime as date) = cast(max_observation as date) \n) \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \nWHERE (o.location_id =:location or parent_location =:location)\n','2022-08-23 22:04:31',4,'2024-02-15 13:52:47',4,0,NULL,NULL,NULL,'505841df-fa38-436c-8463-8a437f536b69'),(1817,'TX_RTT-03 Clients with IIT for 3-5 months in previous period who restarted ARV\'s during current period','TX_RTT-03 Clients with IIT for 3-5 months in previous period who restarted ARV\'s during current period','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TX_RTT-03 Clients with IIT for 3-5 months in previous period who restarted ARV's during current period\n TX_RTT-03 Clients with IIT for 3-5 months in previous period who restarted ARV's during current period\n \n 2022-08-23 16:42:57 UTC\n \n 2024-02-15 08:26:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1817\n select distinct o.person_id \nfrom obs o \n-- PATIENTS WITH NO CLINICAL CONTACT OR ARV PICK-UP FOR GREATER THAN 28 DAYS \n-- SINCE THEIR LAST EXPECTED CONTACT WHO RESTARTED ARVs WITHIN THE REPORTING PERIOD \ninner join location l on o.location_id = l.location_id \nINNER JOIN patient ON o.person_id = patient.patient_id \nAND patient.voided = 0 AND o.voided = 0 \nAND o.person_id in ( \n select person_id \n from \n (select oss.person_id, MAX(oss.obs_datetime) as max_observation, SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_datetime)), 20) AS latest_follow_up \n from obs oss \n inner join person p on oss.person_id=p.person_id and oss.concept_id = 3752 and oss.voided=0 \n and oss.obs_datetime < cast(:startDate as DATE) \n group by p.person_id \n having datediff(CAST(DATE_ADD(CAST(:startDate AS DATE), INTERVAL -1 DAY) AS DATE), latest_follow_up) BETWEEN 89 and 180) as Missed_Between_89_and_180Days \n ) \n \n -- Client Seen: As either patient OR Treatment Buddy \n AND ( \n o.person_id in ( \n select distinct os.person_id \n from obs os \n where (os.concept_id = 3843 AND os.value_coded = 3841 OR os.value_coded = 3842) \n AND os.obs_datetime BETWEEN CAST(:startDate AS DATE) AND CAST(:endDate AS DATE) \n ) \n \n -- Client Seen and Date Restarted picked \n OR o.person_id in ( \n select distinct os.person_id \n from obs os \n where os.concept_id = 3708 AND os.value_datetime BETWEEN CAST(:startDate AS DATE) AND CAST(:endDate AS DATE) \n ) \n ) \n -- Still on treatment at the end of the reporting period \n AND o.person_id in ( \n select person_id \n from \n (select oss.person_id, MAX(oss.obs_datetime) as max_observation, SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_datetime)), 20) AS latest_follow_up \n from obs oss \n inner join person p on oss.person_id=p.person_id and oss.concept_id = 3752 and oss.voided=0 \n and oss.obs_datetime >= cast(:startDate as DATE) and oss.obs_datetime <= cast(:endDate as DATE) \n group by p.person_id \n having datediff(CAST(:endDate AS DATE), latest_follow_up) <= 28) as Still_On_Treatment_End_Period \n ) \n \n -- Transfered Out to Another Site during their latest encounter before the start date \n AND o.person_id not in ( \n select person_id \n from \n (select oss.person_id, MAX(oss.obs_datetime) as max_observation, SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) AS last_obs_tout \n from obs oss \n inner join person p on oss.person_id=p.person_id and oss.concept_id = 4155 and oss.voided=0 \n and oss.obs_datetime < cast(:startDate as DATE) \n group by p.person_id \n having last_obs_tout = 2146) as Transfered_Out_In_Last_Encounter \n ) \n \n-- NOT Transfered In from another Site \n AND o.person_id not in ( \n select os.person_id \n from obs os \n where (os.concept_id = 2253 AND DATE(os.value_datetime) BETWEEN CAST(:startDate AS DATE) AND CAST(:endDate AS DATE)) \n AND os.voided = 0 \n ) \n \n AND o.person_id not in ( \n select person_id \n from person \n where death_date <= CAST(:endDate AS DATE) \n and dead = 1 \n ) \n AND o.person_id not in ( \n -- Visitors \n select o.person_id \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as examination_timing \n from obs oss \n where oss.concept_id = 3753 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where concept_id = 5416 \n and o.value_coded =1 and o.voided=0 \n and cast(o.obs_datetime as date) = cast(max_observation as date) \n ) \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \nWHERE (o.location_id =:location or parent_location =:location)\n','2022-08-23 22:12:57',4,'2024-02-15 13:56:51',4,0,NULL,NULL,NULL,'129f5049-8d6d-4cd9-8922-7cf72b623ab3'),(1818,' TX_RTT-04 Clients with IIT for >6 months in previous period who restarted ARV\'s during current period',' TX_RTT-04 Clients with IIT for >6 months in previous period who restarted ARV\'s during current period','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TX_RTT-04 Clients with IIT for >6 months in previous period who restarted ARV's during current period\n TX_RTT-04 Clients with IIT for >6 months in previous period who restarted ARV's during current period\n \n 2022-08-23 16:45:46 UTC\n \n 2024-02-15 08:42:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n endDateAS\n \n java.util.Date\n true\n \n \n 1818\n select distinct o.person_id \nfrom obs o \n-- PATIENTS WITH NO CLINICAL CONTACT OR ARV PICK-UP FOR GREATER THAN 28 DAYS \n-- SINCE THEIR LAST EXPECTED CONTACT WHO RESTARTED ARVs WITHIN THE REPORTING PERIOD \ninner join location l on o.location_id = l.location_id \nINNER JOIN patient ON o.person_id = patient.patient_id \nAND patient.voided = 0 AND o.voided = 0 \nAND o.person_id in ( \n select person_id \n from \n (select oss.person_id, MAX(oss.obs_datetime) as max_observation, SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_datetime)), 20) AS latest_follow_up \n from obs oss \n inner join person p on oss.person_id=p.person_id and oss.concept_id = 3752 and oss.voided=0 \n and oss.obs_datetime < cast(:startDate as DATE) \n group by p.person_id \n having datediff(CAST(DATE_ADD(CAST(:startDate AS DATE), INTERVAL -1 DAY) AS DATE), latest_follow_up) >= 180) as Missed_Greater_than_180Days \n ) \n \n -- Client Seen: As either patient OR Treatment Buddy \n AND ( \n o.person_id in ( \n select distinct os.person_id \n from obs os \n where (os.concept_id = 3843 AND os.value_coded = 3841 OR os.value_coded = 3842) \n AND os.obs_datetime BETWEEN CAST(:startDate AS DATE) AND CAST(:endDate AS DATE) \n ) \n \n -- Client Seen and Date Restarted picked \n OR o.person_id in ( \n select distinct os.person_id \n from obs os \n where os.concept_id = 3708 AND os.value_datetime BETWEEN CAST(:startDate AS DATE) AND CAST(:endDate AS DATE) \n ) \n ) \n -- Still on treatment at the end of the reporting period \n AND o.person_id in ( \n select person_id \n from \n (select oss.person_id, MAX(oss.obs_datetime) as max_observation, SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_datetime)), 20) AS latest_follow_up \n from obs oss \n inner join person p on oss.person_id=p.person_id and oss.concept_id = 3752 and oss.voided=0 \n and oss.obs_datetime >= cast(:startDate as DATE) and oss.obs_datetime <= cast(:endDate as DATE) \n group by p.person_id \n having datediff(CAST(:endDate AS DATE), latest_follow_up) <= 28) as Still_On_Treatment_End_Period \n ) \n \n -- Transfered Out to Another Site during their latest encounter before the start date \n AND o.person_id not in ( \n select person_id \n from \n (select oss.person_id, MAX(oss.obs_datetime) as max_observation, SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) AS last_obs_tout \n from obs oss \n inner join person p on oss.person_id=p.person_id and oss.concept_id = 4155 and oss.voided=0 \n and oss.obs_datetime < cast(:startDate as DATE) \n group by p.person_id \n having last_obs_tout = 2146) as Transfered_Out_In_Last_Encounter \n ) \n \n-- NOT Transfered In from another Site \n AND o.person_id not in ( \n select os.person_id \n from obs os \n where (os.concept_id = 2253 AND DATE(os.value_datetime) BETWEEN CAST(:startDate AS DATE) AND CAST(:endDate AS DATE)) \n AND os.voided = 0 \n ) \n \n AND o.person_id not in ( \n select person_id \n from person \n where death_date <= CAST(:endDate AS DATE) \n and dead = 1 \n ) \n AND o.person_id not in ( \n -- Visitors \n select o.person_id \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as examination_timing \n from obs oss \n where oss.concept_id = 3753 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where concept_id = 5416 \n and o.value_coded =1 and o.voided=0 \n and cast(o.obs_datetime as date) = cast(max_observation as date) \n ) \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \nWHERE (o.location_id =:location or parent_location =:location)\n','2022-08-23 22:15:46',4,'2024-02-15 14:12:31',4,0,NULL,NULL,NULL,'afc2a5d5-53e4-427a-9491-b3b1609bbe69'),(1819,'CI64:TxRTT IIT<3months','CI64:TxRTT IIT<3months','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CI64:TxRTT IIT<3months\n CI64:TxRTT IIT<3months\n \n 2022-08-24 07:46:14 UTC\n \n 2022-08-24 07:47:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1819\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-08-24 07:46:14',4,'2022-08-24 07:47:14',4,0,NULL,NULL,NULL,'6c4e2daf-e83f-4899-98f5-203f33ee4827'),(1820,'CI65:TxRTT IIT_3-5months','CI65:TxRTT IIT_3-5months','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CI65:TxRTT IIT_3-5months\n CI65:TxRTT IIT_3-5months\n \n 2022-08-24 07:47:56 UTC\n \n 2022-08-24 07:48:48 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1820\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-08-24 07:47:56',4,'2022-08-24 07:48:48',4,0,NULL,NULL,NULL,'714af509-9ade-48b5-b6f0-10d7499a6f15'),(1821,'CI66:TxRTT IIT_6+months','CI66:TxRTT IIT_6+months','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CI66:TxRTT IIT_6+months\n CI66:TxRTT IIT_6+months\n \n 2022-08-24 07:49:18 UTC\n \n 2022-08-24 07:49:56 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1821\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-08-24 07:49:18',4,'2022-08-24 07:49:56',4,0,NULL,NULL,NULL,'271261f4-75c6-4c64-a6f0-7be2d40c33c3'),(1822,'Pulmonary Bacteriologically Confirmed New','New Pulmonary Bacteriologically Confirmed clients','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Pulmonary Bacteriologically Confirmed New\n New Pulmonary Bacteriologically Confirmed clients\n \n 2023-03-27 10:50:04 UTC\n \n 2023-03-29 16:41:33 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1822\n select distinct o.person_id \n \n from obs o \ninner join location l on o.location_id = l.location_id \n \n -- Relapsed TB Client \nWHERE (o.location_id =:location or parent_location =:location) \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n -- TB Start Date \n where ob.concept_id = 2237 \n and ob.value_datetime >= :startDate \n and ob.value_datetime <= :endDate \n and ob.voided = 0 \n ) \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- New Clients \n select distinct person_id \n from obs \n where concept_id = 3785 and value_coded = 1034 \n and obs_datetime >= :startDate \n and obs_datetime <= :endDate \n ) \n ) \n \n \n AND o.person_id not in ( \n select distinct os.person_id \n from obs os \n -- Patient must not be a tranfer in \n where os.concept_id = 3772 and os.value_coded =2095 \n AND (os.obs_datetime BETWEEN :startDate AND :endDate) \n AND os.voided = 0 \n )\n','2023-03-27 12:50:04',4,'2023-03-29 18:41:33',4,0,NULL,NULL,NULL,'5ab3fc4d-0d1e-4a30-b0c7-d35c68f7f19a'),(1823,'NewRelapse_Tb_Treatment_History','Tb Treatment History - New and Relapse Patients','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n NewRelapse_Tb_Treatment_History\n Tb Treatment History - New and Relapse Patients\n \n 2023-03-27 11:51:48 UTC\n \n 2023-03-27 20:29:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1823\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in( \nSELECT Id \nFROM \n((SELECT distinct Id, patientIdentifier AS "Patient_Identifier", patientName AS "Patient_Name", Age , Gender, age_group, 'New Patient' AS 'TB_Treatment_History' \n FROM \n \n (select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n person.gender AS Gender, \n observed_age_group.name AS age_group, \n observed_age_group.sort_order AS sort_order \n \n from obs o \n -- New TB Patient \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n -- TB Start Date \n where ob.concept_id = 2237 \n and ob.value_datetime >= CAST(:startDate AS DATE) \n and ob.value_datetime <= CAST(:endDate AS DATE) \n and ob.voided = 0 \n ) \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- New Clients \n select distinct person_id \n from obs \n where concept_id = 3785 and value_coded = 1034 \n and obs_datetime >= CAST(:startDate AS DATE) \n and obs_datetime <= CAST(:endDate AS DATE) \n ) \n ) \n \n \n AND o.person_id not in ( \n select distinct os.person_id \n from obs os \n -- Patient must not be a tranfer in \n where os.concept_id = 3772 and os.value_coded =2095 \n AND (os.obs_datetime BETWEEN CAST(:startDate AS DATE) AND CAST(:endDate AS DATE)) \n AND patient.voided = 0 AND os.voided = 0 \n ) \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages') AS NEW_TB_CLIENTS \n ORDER BY NEW_TB_CLIENTS.Age) \n \n \n UNION \n \n (SELECT distinct Id, patientIdentifier AS "Patient_Identifier", patientName AS "Patient_Name", Age , Gender, age_group, 'Relapsed Patient' AS 'TB_Treatment_History' \n FROM \n (select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n person.gender AS Gender, \n observed_age_group.name AS age_group, \n observed_age_group.sort_order AS sort_order \n \n from obs o \n -- Relapsed TB Client \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n -- TB Start Date \n where ob.concept_id = 2237 \n and ob.value_datetime >= CAST(:startDate AS DATE) \n and ob.value_datetime <= CAST(:endDate AS DATE) \n ) \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- Relapsed Clients \n select distinct person_id \n from obs \n where concept_id = 3785 and value_coded = 1084 \n and ob.value_datetime >= CAST(:startDate AS DATE) \n and ob.value_datetime <= CAST(:endDate AS DATE) \n ) \n ) \n \n \n \n AND o.person_id not in ( \n select distinct os.person_id \n from obs os \n -- Client must not be a transfer in \n where os.concept_id = 3772 and os.value_coded =2095 \n AND os.obs_datetime >= CAST(:startDate AS DATE) \n and os.obs_datetime <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND os.voided = 0 \n ) \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages') AS RELAPSE_TB_CLIENTS \n ORDER BY RELAPSE_TB_CLIENTS.Age) \n) AS NewRelapsed)\n','2023-03-27 17:21:48',4,'2023-03-28 01:59:53',4,0,NULL,NULL,NULL,'7f8a23bd-eec0-40a6-8181-cda3d0aab0bd'),(1824,'Pulmonary Bacteriologically Confirmed Relapse','Pulmonary Bacteriologically Confirmed Relapse','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Pulmonary Bacteriologically Confirmed Relapse\n Pulmonary Bacteriologically Confirmed Relapse\n \n 2023-03-27 12:10:01 UTC\n \n 2023-03-29 16:45:37 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1824\n select o.person_id \n from obs o \ninner join location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \nWHERE (o.location_id =:location or parent_location =:location) \nAND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n -- TB Start Date \n where ob.concept_id = 2237 \n and ob.value_datetime >= :startDate \n and ob.value_datetime <= :endDate \n ) \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- Relapsed Clients \n select distinct person_id \n from obs \n where concept_id = 3785 and value_coded = 1084 \n and ob.value_datetime >= :startDate \n and ob.value_datetime <= :endDate \n ) \n ) \n \n \n \n AND o.person_id not in ( \n select distinct os.person_id \n from obs os \n -- Client must not be a transfer in \n where os.concept_id = 3772 and os.value_coded =2095 \n AND os.obs_datetime >= :startDate \n and os.obs_datetime <= :endDate \n AND patient.voided = 0 AND os.voided = 0 \n )\n','2023-03-27 14:10:01',4,'2023-03-29 18:45:37',4,0,NULL,NULL,NULL,'e495a330-c538-4fa2-9279-e0c03ec69b51'),(1825,'Pulmonary Bacteriologically Confirmed Excluding Relapse','Pulmonary Bacteriologically Confirmed Excluding Relapse','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Pulmonary Bacteriologically Confirmed Excluding Relapse\n Pulmonary Bacteriologically Confirmed Excluding Relapse\n \n 2023-03-27 17:01:52 UTC\n \n 2023-03-29 16:38:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1825\n select distinct o.person_id \n from obs o \ninner join location l on o.location_id = l.location_id \n \n -- Relapsed TB Client \nWHERE (o.location_id =:location or parent_location =:location) \n AND o.concept_id = 3785 and o.value_coded in (3786,1037) \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n -- TB Start Date \n where ob.concept_id = 2237 \n and ob.value_datetime >= :startDate \n and ob.value_datetime <= :endDate \n ) \n \n AND o.person_id not in ( \n select distinct os.person_id \n from obs os \n -- Client must not be a transfer in \n where os.concept_id = 3772 and os.value_coded = 3786 \n AND os.obs_datetime >= :startDate \n and os.obs_datetime <= :endDate \n AND os.voided = 0) \n\n','2023-03-27 19:01:52',4,'2023-03-29 18:38:41',4,0,NULL,NULL,NULL,'23ba6606-91b7-4f7c-9142-73d6a43769a3'),(1826,'New and Relapse with document HIV Status','New and Relapse patients with document HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n New and Relapse with document HIV Status\n New and Relapse patients with document HIV Status\n \n 2023-03-27 19:38:11 UTC\n \n 2023-03-27 21:21:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1826\n SELECT DISTINCT o.person_id \n from obs o \n -- New and Relapse with Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3785 and ob.value_coded in (1034, 1084) -- New and Relapse \n and ob.voided = 0 \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE)\n','2023-03-28 01:08:11',4,'2023-03-28 02:51:39',4,0,NULL,NULL,NULL,'ee4e2170-5dd7-423e-bc84-f0c13c3a9b4f'),(1827,'Retreatment with documented HIV status','Retreatment Excl. Relapse client with documented HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Retreatment with documented HIV status\n Retreatment Excl. Relapse client with documented HIV Status\n \n 2023-03-27 19:50:19 UTC\n \n 2023-03-27 19:53:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1827\n SELECT DISTINCT o.person_id \n from obs o \n -- New and Relapse with Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3785 and ob.value_coded in (3786, 1037) -- Retreatmentafter LTFU/Failure \n and ob.voided = 0 \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 01:20:19',4,'2023-03-28 01:23:28',4,0,NULL,NULL,NULL,'17edcc8f-3d38-49dd-a6f4-a5384cdb7245'),(1828,'Children < 15 with Documented HIV Status','Children (0 - 14) with documented HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children < 15 with Documented HIV Status\n Children (0 - 14) with documented HIV Status\n \n 2023-03-27 20:10:47 UTC\n \n 2023-03-27 20:11:20 UTC\n \n \n endDate\n \n java.util.Date\n true\n \n \n startDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1828\n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Documented HIV, Status \n inner join location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 \n AND o.voided = 0 \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n having Age < 15\n','2023-03-28 01:40:47',4,'2023-03-28 01:41:20',4,0,NULL,NULL,NULL,'ca5b1d37-8229-474d-8125-2486520685fd'),(1829,'Pulmonary Clinically Diagnosed New','Pulmonary Clinically Diagnosed New','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Pulmonary Clinically Diagnosed New\n Pulmonary Clinically Diagnosed New\n \n 2023-03-27 20:39:34 UTC\n \n 2023-03-28 08:18:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1829\n select distinct o.person_id \n FROM obs o \ninner join location l on o.location_id = l.location_id \n -- Clinical Diagnosis X-Ray \n and o.concept_id = 4673 and o.value_coded = 4171 \nAND o.person_id in ( \nselect o.person_id from obs o \nwhere o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n -- TB Start Date \n where ob.concept_id = 2237 \n and ob.value_datetime >= :startDate \n and ob.value_datetime <= :endDate \n and ob.voided = 0 \n ) \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- New Clients \n select distinct person_id \n from obs \n where concept_id = 3785 and value_coded = 1034 \n and obs_datetime >= :startDate \n and obs_datetime <= :endDate \n ) \n ) \n \n \n AND o.person_id not in ( \n select distinct os.person_id \n from obs os \n -- Patient must not be a tranfer in \n where os.concept_id = 3772 and os.value_coded =2095 \n AND (os.obs_datetime BETWEEN :startDate AND :endDate) \n and os.voided = 0 \n ) \n \n) \n and o.obs_datetime >= :startDate \n and o.obs_datetime <= :endDate \n and o.voided = 0 \n and o.person_id in ( \n select ob.person_id \n FROM obs ob \n -- Pulmonary TB \n where ob.concept_id = 3788 and ob.value_coded = 1018 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.voided = 0 \n ) \n or o.person_id in ( \n select ob.person_id \n FROM obs ob \n -- Pulmonary TB, Clinically Diagnosed \n where ob.concept_id = 2236 and ob.value_coded = 2235 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.voided = 0 \n )\n','2023-03-28 02:09:34',4,'2023-03-28 13:48:26',4,0,NULL,NULL,NULL,'34bcf70d-0178-4dcc-ab38-9046e4bcedd1'),(1830,'Miners with Documented HIV Status','High risk population of miners with documented HIV','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Miners with Documented HIV Status\n High risk population of miners with documented HIV\n \n 2023-03-27 20:45:17 UTC\n \n 2023-03-27 20:46:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1830\n select distinct o.person_id \n from obs o \n -- Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded = 3667 -- Population (Miner) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 02:15:17',4,'2023-03-28 02:16:08',4,0,NULL,NULL,NULL,'001d7c51-fa6b-45d5-9690-cc6dce14a608'),(1831,'Ex-Miners with Documented HIV Status','High risk population of Ex Miners with Documented HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Ex-Miners with Documented HIV Status\n High risk population of Ex Miners with Documented HIV Status\n \n 2023-03-27 20:47:57 UTC\n \n 2023-03-28 09:17:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1831\n select distinct o.person_id \n from obs o \n -- Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded = 3668 -- Population (Ex-Miner) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 02:17:57',4,'2023-03-28 14:47:41',4,0,NULL,NULL,NULL,'10248e4b-2f29-447e-814a-6d5b10398656'),(1832,'Factory Workers with Documented HIV Status','High risk population of Factory Workers with Documented HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Factory Workers with Documented HIV Status\n High risk population of Factory Workers with Documented HIV Status\n \n 2023-03-27 20:54:48 UTC\n \n 2023-03-27 20:55:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1832\n select distinct o.person_id \n from obs o \n -- Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded = 3669 -- Population (Factory Workers) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 02:24:48',4,'2023-03-28 02:25:05',4,0,NULL,NULL,NULL,'bb934645-58c2-4c19-bbd7-0ebf35fa3f7a'),(1833,'Public transport operators with Documented HIV Status','High risk population of Public transport operators with Documented HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Public transport operators with Documented HIV Status\n High risk population of Public transport operators with Documented HIV Status\n \n 2023-03-27 20:58:19 UTC\n \n 2023-03-28 20:14:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1833\n select distinct o.person_id \n from obs o \n -- Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded = 4654 -- Population (Public transport operators) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 02:28:19',4,'2023-03-29 01:44:32',4,0,NULL,NULL,NULL,'0c91b258-01ae-4928-be76-91201cadad93'),(1834,'Health workers with Documented HIV Status','High risk population of Health workers with Documented HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Health workers with Documented HIV Status\n High risk population of Health workers with Documented HIV Status\n \n 2023-03-27 21:04:15 UTC\n \n 2023-03-27 21:04:38 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1834\n select distinct o.person_id \n from obs o \n -- Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded = 4670 -- Population (Health workers) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 02:34:15',4,'2023-03-28 02:34:38',4,0,NULL,NULL,NULL,'7736630e-9da2-4ec0-b131-fe9e2ef01e00'),(1835,'Correctional Staff and inmates with Documented HIV Status','High risk population of Correctional Staff and inmates with Documented HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Correctional Staff and inmates with Documented HIV Status\n High risk population of Correctional Staff and inmates with Documented HIV Status\n \n 2023-03-27 21:06:32 UTC\n \n 2023-03-27 21:10:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1835\n select distinct o.person_id \n from obs o \n -- Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded in (3779, 3671) -- Population (Correctional Staff and inmates) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 02:36:32',4,'2023-03-28 02:40:03',4,0,NULL,NULL,NULL,'58ac8a09-0a12-4ab0-acb4-1fe8d1d81b77'),(1836,'RetreatmentExRelapse_Tb_Treatment_History','Retreatment Exclusive Relapse Tb Treatment History','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n RetreatmentExRelapse_Tb_Treatment_History\n Retreatment Exclusive Relapse Tb Treatment History\n \n 2023-03-27 21:07:51 UTC\n \n 2023-03-27 21:12:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1836\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(SELECT Id \nFROM \n((SELECT distinct Id, patientIdentifier AS "Patient_Identifier", patientName AS "Patient_Name" \n FROM \n \n (select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n person.gender AS Gender, \n observed_age_group.name AS age_group, \n observed_age_group.sort_order AS sort_order \n \n from obs o \n -- TB Retreatment Exclusive Relapse \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- TB Retreatment Exclusive Relapse \n select distinct person_id \n from obs \n where concept_id = 3785 and value_coded in (3786,1037) \n and obs_datetime >= CAST(:startDate AS DATE) \n and obs_datetime <= CAST(:endDate AS DATE) \n ) \n ) \n \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages') AS NEW_TB_CLIENTS \n ORDER BY NEW_TB_CLIENTS.Age) \n \n) AS RetreatmentExRelapse)\n','2023-03-28 02:37:51',4,'2023-03-28 02:42:07',4,0,NULL,NULL,NULL,'7263505b-34d2-4167-9d3f-4cdae66218f8'),(1837,'NewRelapse_Tb_Treatment_History','NewRelapse_Tb_Treatment_History','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n NewRelapse_Tb_Treatment_History\n NewRelapse_Tb_Treatment_History\n \n 2023-03-27 21:17:20 UTC\n \n 2023-03-27 21:20:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1837\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-28 02:47:20',4,'2023-03-28 02:50:31',4,0,NULL,NULL,NULL,'20879b46-ecbd-4ff9-818a-3c761bcf5ebd'),(1838,'New and Relapse with Positive HIV Status','New and Relapse with Positive HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n New and Relapse with Positive HIV Status\n New and Relapse with Positive HIV Status\n \n 2023-03-27 21:20:17 UTC\n \n 2023-03-29 20:36:19 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1838\n SELECT DISTINCT o.person_id \n from obs o \n -- New and Relapse with Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3785 and ob.value_coded in (1034, 1084) -- New/Relapse with HIV Status \n and ob.voided = 0 \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-27 23:20:17',4,'2023-03-29 22:36:19',4,0,NULL,NULL,NULL,'02c505a1-b724-422b-8c31-69440e233a0d'),(1839,'RetreatmentExRelapse_Tb_Treatment_History','Retreatment Exclusive Relapse - Tb Treatment History','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n RetreatmentExRelapse_Tb_Treatment_History\n Retreatment Exclusive Relapse - Tb Treatment History\n \n 2023-03-27 21:25:15 UTC\n \n 2023-03-27 21:26:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1839\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-28 02:55:15',4,'2023-03-28 02:56:10',4,0,NULL,NULL,NULL,'f901b38b-95e7-4bcc-ace1-ce86030ba88e'),(1840,'TB Notification - Block 2','TB Notification - Block 2','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Notification - Block 2\n TB Notification - Block 2\n \n 2023-03-27 21:45:01 UTC\n \n 2023-03-27 21:45:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1840\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-03-28 03:15:01',4,'2023-03-28 03:15:21',4,0,NULL,NULL,NULL,'8ab1160e-aca4-4d59-bd02-0269e8a3889a'),(1841,'TB Notification - Block 2 Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Notification - Block 2 Data Set\n \n 2023-03-27 21:45:21 UTC\n \n 2023-04-04 21:49:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1841\n \n \n DM_Sex\n \n \n \n \n \n \n DM_TB_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n NwRlpsF1-4\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_TB_Age\n 01-04yrs\n \n \n \n \n \n NwRlpsF5-9\n \n \n \n \n DM_Sex\n Females\n \n \n DM_TB_Age\n 05-09yrs\n \n \n \n \n \n NwRlpsM1-4\n \n \n \n \n DM_Sex\n Males\n \n \n DM_TB_Age\n 01-04yrs\n \n \n \n \n \n NwRlpsM5-9\n \n \n \n \n DM_Sex\n Males\n \n \n DM_TB_Age\n 05-09yrs\n \n \n \n \n \n NwRlpseF<1\n \n \n \n \n DM_Sex\n Females\n \n \n DM_TB_Age\n Under1yr\n \n \n \n \n \n NwRlpseM<1\n \n \n \n \n DM_Sex\n Males\n \n \n DM_TB_Age\n Under1yr\n \n \n \n \n \n NwRsF10-14\n \n \n \n \n DM_Sex\n Females\n \n \n DM_TB_Age\n 10-14yrs\n \n \n \n \n \n NwRsF15-19\n \n \n \n \n DM_Sex\n Females\n \n \n DM_TB_Age\n 15-19yrs\n \n \n \n \n \n NwRsF20-24\n \n \n \n \n DM_Sex\n Females\n \n \n DM_TB_Age\n 20-24yrs\n \n \n \n \n \n NwRsF25-34\n \n \n \n \n DM_Sex\n Females\n \n \n DM_TB_Age\n 25-34yrs\n \n \n \n \n \n NwRsF35-44\n \n \n \n \n DM_Sex\n Females\n \n \n DM_TB_Age\n 35-44yrs\n \n \n \n \n \n NwRsF45-49\n \n \n \n \n DM_Sex\n Females\n \n \n DM_TB_Age\n 45-49yrs\n \n \n \n \n \n NwRsF50-54\n \n \n \n \n DM_Sex\n Females\n \n \n DM_TB_Age\n 50-54yrs\n \n \n \n \n \n NwRsF55-64\n \n \n \n \n DM_Sex\n Females\n \n \n DM_TB_Age\n 55-64yrs\n \n \n \n \n \n NwRsF65+\n \n \n \n \n DM_Sex\n Females\n \n \n DM_TB_Age\n 65Plus\n \n \n \n \n \n NwRsM10-14\n \n \n \n \n DM_Sex\n Males\n \n \n DM_TB_Age\n 10-14yrs\n \n \n \n \n \n NwRsM15-19\n \n \n \n \n DM_Sex\n Males\n \n \n DM_TB_Age\n 15-19yrs\n \n \n \n \n \n NwRsM20-24\n \n \n \n \n DM_Sex\n Males\n \n \n DM_TB_Age\n 20-24yrs\n \n \n \n \n \n NwRsM25-34\n \n \n \n \n DM_Sex\n Males\n \n \n DM_TB_Age\n 25-34yrs\n \n \n \n \n \n NwRsM35-44\n \n \n \n \n DM_Sex\n Males\n \n \n DM_TB_Age\n 35-44yrs\n \n \n \n \n \n NwRsM45-49\n \n \n \n \n DM_Sex\n Males\n \n \n DM_TB_Age\n 45-49yrs\n \n \n \n \n \n NwRsM50-54\n \n \n \n \n DM_Sex\n Males\n \n \n DM_TB_Age\n 50-54yrs\n \n \n \n \n \n NwRsM55-64\n \n \n \n \n DM_Sex\n Males\n \n \n DM_TB_Age\n 55-64yrs\n \n \n \n \n \n NwRsM65+\n \n \n \n \n DM_Sex\n Males\n \n \n DM_TB_Age\n 65Plus\n \n \n \n \n \n RetreatF<1\n \n \n \n \n \n \n \n \n \n RetreatM<1\n \n \n \n \n \n \n RetrtF1-4\n \n \n \n \n \n \n RetrtF5-9\n \n \n \n \n \n \n RetrtM1-4\n \n \n \n \n \n \n RetrtM5-9\n \n \n \n \n \n \n RtrtF10-14\n \n \n \n \n \n \n RtrtF15-19\n \n \n \n \n \n \n RtrtF20-24\n \n \n \n \n \n \n RtrtF25-34\n \n \n \n \n \n \n RtrtF35-44\n \n \n \n \n \n \n RtrtF45-49\n \n \n \n \n \n \n RtrtF50-54\n \n \n \n \n \n \n RtrtF55-64\n \n \n \n \n \n \n RtrtF65+\n \n \n \n \n \n \n RtrtM10-14\n \n \n \n \n \n \n RtrtM15-19\n \n \n \n \n \n \n RtrtM20-24\n \n \n \n \n \n \n RtrtM25-34\n \n \n \n \n \n \n RtrtM35-44\n \n \n \n \n \n \n RtrtM45-49\n \n \n \n \n \n \n RtrtM50-54\n \n \n \n \n \n \n RtrtM55-64\n \n \n \n \n \n \n RtrtM65+\n \n \n \n \n \n \n','2023-03-28 03:15:21',4,'2023-04-05 03:19:58',4,0,NULL,NULL,NULL,'68f0aaca-a6a0-4cb5-aebb-e57d5ce5b2cd'),(1844,'Retreatment with Positive HIV status','Retreatment Excl. Relapse with Positive HIV status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Retreatment with Positive HIV status\n Retreatment Excl. Relapse with Positive HIV status\n \n 2023-03-28 08:28:56 UTC\n \n 2023-03-28 08:30:38 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1844\n SELECT DISTINCT o.person_id \n from obs o \n -- New and Relapse with Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3785 and ob.value_coded in (3786, 1037) -- Retreatmentafter LTFU/Failure with HIV Status \n and ob.voided = 0 \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 13:58:56',4,'2023-03-28 14:00:38',4,0,NULL,NULL,NULL,'d48e3545-1e4d-4d7a-a812-5fb7111cbf72'),(1845,'Pulmonary Clinically Diagnosed Relapse','Pulmonary Clinically Diagnosed Relapse','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Pulmonary Clinically Diagnosed Relapse\n Pulmonary Clinically Diagnosed Relapse\n \n 2023-03-28 08:30:26 UTC\n \n 2023-03-28 09:14:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1845\n select distinct o.person_id \n FROM obs o \n \n where o.concept_id = 4673 and o.value_coded = 4171 \n and o.obs_datetime >= :startDate \n and o.obs_datetime <= :endDate \n and o.person_id in ( \n select distinct o.person_id \n from obs o \n -- Relapsed TB Client \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n -- TB Start Date \n where ob.concept_id = 2237 \n and ob.value_datetime >= :startDate \n and ob.value_datetime <= :endDate \n ) \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- Relapsed Clients \n select distinct person_id \n from obs \n where concept_id = 3785 and value_coded = 1084 \n and ob.value_datetime >= :startDate \n and ob.value_datetime <= :endDate \n ) \n ) \n \n \n \n AND o.person_id not in ( \n select distinct os.person_id \n from obs os \n -- Client must not be a transfer in \n where os.concept_id = 3772 and os.value_coded =2095 \n AND os.obs_datetime >= :startDate \n and os.obs_datetime <= :endDate \n and os.voided = 0 \n ) \n ) \n \n and o.voided = 0 \n and o.person_id in ( \n select ob.person_id \n FROM obs ob \n -- Pulmonary TB \n where ob.concept_id = 3788 and ob.value_coded = 1018 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.voided = 0 \n ) \n or o.person_id in ( \n select ob.person_id \n FROM obs ob \n -- Pulmonary TB, Clinically Diagnosed \n where ob.concept_id = 2236 and ob.value_coded = 2235 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.voided = 0 \n ) \n \n \n','2023-03-28 14:00:26',4,'2023-03-28 14:44:26',4,0,NULL,NULL,NULL,'5d45f128-1037-42d6-939d-3ae6929bfd6c'),(1846,'DM_TB_Age','DM_TB_Age','org.openmrs.module.reporting.indicator.dimension.Dimension','org.openmrs.module.reporting.indicator.dimension.CohortDefinitionDimension','org.openmrs.module.reporting.serializer.ReportingSerializer','\n DM_TB_Age\n DM_TB_Age\n \n 2023-03-28 08:34:09 UTC\n \n 2023-03-28 09:12:59 UTC\n \n \n endDate\n \n java.util.Date\n true\n \n \n 1846\n \n \n 01-04yrs\n \n \n \n \n maxAge\n 4\n \n \n minAge\n 1\n \n \n effectiveDate\n ${endDate}\n \n \n \n \n \n 05-09yrs\n \n \n \n \n maxAge\n 9\n \n \n minAge\n 5\n \n \n effectiveDate\n ${endDate}\n \n \n \n \n \n 10-14yrs\n \n \n \n \n maxAge\n 14\n \n \n minAge\n 10\n \n \n effectiveDate\n ${endDate}\n \n \n \n \n \n 15-19yrs\n \n \n \n \n maxAge\n 19\n \n \n minAge\n 15\n \n \n effectiveDate\n ${endDate}\n \n \n \n \n \n 20-24yrs\n \n \n \n \n maxAge\n 24\n \n \n minAge\n 20\n \n \n effectiveDate\n ${endDate}\n \n \n \n \n \n 25-34yrs\n \n \n \n \n maxAge\n 34\n \n \n minAge\n 25\n \n \n effectiveDate\n ${endDate}\n \n \n \n \n \n 35-44yrs\n \n \n \n \n maxAge\n 44\n \n \n minAge\n 35\n \n \n effectiveDate\n ${endDate}\n \n \n \n \n \n 45-49yrs\n \n \n \n \n maxAge\n 49\n \n \n minAge\n 45\n \n \n effectiveDate\n ${endDate}\n \n \n \n \n \n 50-54yrs\n \n \n \n \n maxAge\n 54\n \n \n minAge\n 50\n \n \n effectiveDate\n ${endDate}\n \n \n \n \n \n 55-64yrs\n \n \n \n \n maxAge\n 64\n \n \n minAge\n 55\n \n \n effectiveDate\n ${endDate}\n \n \n \n \n \n 65Plus\n \n \n \n \n maxAge\n 120\n \n \n minAge\n 65\n \n \n effectiveDate\n ${endDate}\n \n \n \n \n \n Under1yr\n \n \n \n \n maxAge\n 0\n \n \n minAge\n 0\n \n \n effectiveDate\n ${endDate}\n \n \n \n \n \n','2023-03-28 14:04:09',4,'2023-03-28 14:42:59',4,0,NULL,NULL,NULL,'68d03856-4b9b-4d8d-ba8f-bc698222c9f2'),(1847,'Children < 15 with Positive HIV Status','High risk population for Children < 15 with Positive HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children < 15 with Positive HIV Status\n High risk population for Children < 15 with Positive HIV Status\n \n 2023-03-28 08:43:51 UTC\n \n 2023-03-28 08:54:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1847\n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- HIV PositiveStatus \n inner join location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n having Age < 15\n','2023-03-28 14:13:51',4,'2023-03-28 14:24:04',4,0,NULL,NULL,NULL,'63b6abab-6261-4d20-9601-74454ea10cd6'),(1848,'Miners with Positive HIV Status','High risk population of miners with Positive HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Miners with Positive HIV Status\n High risk population of miners with Positive HIV Status\n \n 2023-03-28 08:58:19 UTC\n \n 2023-03-28 09:01:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1848\n select distinct o.person_id \n from obs o \n -- Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded = 3667 -- Population (Miner) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 14:28:19',4,'2023-03-28 14:31:36',4,0,NULL,NULL,NULL,'d4d85343-09fc-473b-a650-50f444deee3e'),(1849,'Ex-Miners with Positive HIV Status',' High risk population of Ex Miners with Positive HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Ex-Miners with Positive HIV Status\n High risk population of Ex Miners with Positive HIV Status\n \n 2023-03-28 09:10:47 UTC\n \n 2023-03-28 09:17:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1849\n select distinct o.person_id \n from obs o \n -- Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded = 3668 -- Population (Ex-Miner) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 14:40:47',4,'2023-03-28 14:47:26',4,0,NULL,NULL,NULL,'33fa2a02-6cb8-4850-8d80-18d86f0516a8'),(1850,'Pulmonary Clinically Diagnosed Excluding Relapse','Pulmonary Clinically Diagnosed Excluding Relapse','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Pulmonary Clinically Diagnosed Excluding Relapse\n Pulmonary Clinically Diagnosed Excluding Relapse\n \n 2023-03-28 09:16:40 UTC\n \n 2023-03-28 09:55:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1850\n select distinct o.person_id \n FROM obs o \n \n where o.obs_datetime >= :startDate \n and o.obs_datetime <= :endDate \n AND o.concept_id = 3785 and o.value_coded in (3786,1037) \n and o.voided = 0 \n and o.person_id in ( \n select ob.person_id \n FROM obs ob \n -- Pulmonary TB \n where ob.concept_id = 3788 and ob.value_coded = 1018 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.voided = 0 \n ) \n or o.person_id in ( \n select ob.person_id \n FROM obs ob \n -- Pulmonary TB, Clinically Diagnosed \n where ob.concept_id = 2236 and ob.value_coded = 2235 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.voided = 0 \n ) \n \n \n','2023-03-28 14:46:40',4,'2023-03-28 15:25:11',4,0,NULL,NULL,NULL,'8a1f3d92-c5ec-4892-920b-5bae45020424'),(1851,'Factory Workers with Positive HIV Status','High risk population of Factory Workers with Positive HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Factory Workers with Positive HIV Status\n High risk population of Factory Workers with Positive HIV Status\n \n 2023-03-28 09:22:07 UTC\n \n 2023-03-28 09:23:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1851\n select distinct o.person_id \n from obs o \n -- Positive HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded = 3669 -- Population (Factory Workers) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 14:52:07',4,'2023-03-28 14:53:45',4,0,NULL,NULL,NULL,'e7f0599c-bb8c-4d2d-94a7-4b99e0f1f7af'),(1852,'Public transport with Positive HIV Status','High risk population of Public transport operators with Positive HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Public transport with Positive HIV Status\n High risk population of Public transport operators with Positive HIV Status\n \n 2023-03-28 09:26:12 UTC\n \n 2023-03-28 09:28:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1852\n select distinct o.person_id \n from obs o \n -- Positive HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded = 4654 -- Population (Public transport operators) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 14:56:12',4,'2023-03-28 14:58:18',4,0,NULL,NULL,NULL,'17f9486c-aefe-4a21-b3ad-d5c685280640'),(1853,'Health workers with Positive HIV Status',' High risk population of Health workers with Positive HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Health workers with Positive HIV Status\n High risk population of Health workers with Positive HIV Status\n \n 2023-03-28 09:31:54 UTC\n \n 2023-03-28 09:32:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1853\n select distinct o.person_id \n from obs o \n -- Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded = 4670 -- Population (Health workers) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 15:01:54',4,'2023-03-28 15:02:36',4,0,NULL,NULL,NULL,'e071852e-15c9-4eb6-92a9-c1c8157db41d'),(1854,'Correctional Staff and inmates with Positive HIV Status','High risk population of Correctional Staff and inmates with Positive HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Correctional Staff and inmates with Positive HIV Status\n High risk population of Correctional Staff and inmates with Positive HIV Status\n \n 2023-03-28 09:35:03 UTC\n \n 2023-03-28 09:35:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1854\n select distinct o.person_id \n from obs o \n -- Positive HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded in (3779, 3671) -- Population (Correctional Staff and inmates) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 15:05:03',4,'2023-03-28 15:05:43',4,0,NULL,NULL,NULL,'d6df7665-4e94-4ae6-886e-c1fb05a4a0b1'),(1855,'Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - New','Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - New','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - New\n Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - New\n \n 2023-03-28 10:05:40 UTC\n \n 2023-03-29 16:14:16 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1855\n select distinct ob.person_id \n FROM obs ob \ninner join location l on ob.location_id = l.location_id \n \n where ob.concept_id = 3788 and ob.value_coded = 2233 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.person_id in \n ( \n select distinct o.person_id \n \n from obs o \n -- New TB Patient \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n -- TB Start Date \n where ob.concept_id = 2237 \n and ob.value_datetime >= :startDate \n and ob.value_datetime <= :endDate \n and ob.voided = 0 \n ) \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- New Clients \n select distinct person_id \n from obs \n where concept_id = 3785 and value_coded = 1034 \n and obs_datetime >= :startDate \n and obs_datetime <= :endDate \n ) \n ) \n \n \n AND o.person_id not in ( \n select distinct os.person_id \n from obs os \n -- Patient must not be a tranfer in \n where os.concept_id = 3772 and os.value_coded =2095 \n AND (os.obs_datetime BETWEEN :startDate AND :endDate) \n ) \n ) \n and ob.voided = 0 \n or ob.person_id in ( \n select ob.person_id \n FROM obs ob \n -- Extra Pulmonary TB in ART Intake \n where ob.concept_id = 2236 and ob.value_coded = 2233 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.voided = 0 \n ) \n \n','2023-03-28 12:05:40',4,'2023-03-29 18:14:16',4,0,NULL,NULL,NULL,'155d4939-e304-4aa0-a2d4-efc18644affa'),(1856,'HHCM with Documented HIV Status','High risk population of HHCM with Documented HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM with Documented HIV Status\n High risk population of HHCM with Documented HIV Status\n \n 2023-03-28 10:39:40 UTC\n \n 2023-03-28 10:42:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1856\n select distinct o.person_id \n from obs o \n -- Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded =3777 -- Population (Household member of current miner) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 16:09:40',4,'2023-03-28 16:12:42',4,0,NULL,NULL,NULL,'6584ebef-9d17-4b53-80ba-7396b170919f'),(1857,'HHXM with Documented HIV Status','High risk population of HHXM with Documented HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM with Documented HIV Status\n High risk population of HHXM with Documented HIV Status\n \n 2023-03-28 10:46:20 UTC\n \n 2023-03-28 10:48:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1857\n select distinct o.person_id \n from obs o \n -- Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded =3778 -- Population (Household member of Ex miner) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 16:16:20',4,'2023-03-28 16:18:26',4,0,NULL,NULL,NULL,'f06272eb-e3f7-4d7e-82d1-1e3a391a8b9e'),(1858,'HHCM with Positive HIV Status','High risk population of HHCM with Positive HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM with Positive HIV Status\n High risk population of HHCM with Positive HIV Status\n \n 2023-03-28 10:54:07 UTC\n \n 2023-03-28 10:59:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1858\n select distinct o.person_id \n from obs o \n -- Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded =3777 -- Population (Household member of current miner) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 16:24:07',4,'2023-03-28 16:29:14',4,0,NULL,NULL,NULL,'2b06bd4f-a633-48d8-9a9a-12ae5f84001b'),(1859,'HHXM with Positive HIV Status','High risk population of HHXM with Positive HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM with Positive HIV Status\n High risk population of HHXM with Positive HIV Status\n \n 2023-03-28 11:03:32 UTC\n \n 2023-03-28 11:08:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1859\n select distinct o.person_id \n from obs o \n -- Positive, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded =3778 -- Population (Household member of Ex miner) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 16:33:32',4,'2023-03-28 16:38:06',4,0,NULL,NULL,NULL,'46bd9d48-49d2-4fd5-b433-f1123f217588'),(1860,'Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - Relapse','Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - Relapse','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - Relapse\n Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - Relapse\n \n 2023-03-28 11:42:29 UTC\n \n 2023-03-29 16:33:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1860\n select distinct ob.person_id \n FROM obs ob \ninner join location l on ob.location_id = l.location_id \n \n where ob.concept_id = 3788 and ob.value_coded = 2233 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.person_id in \n ( \n select distinct o.person_id \n \n from obs o \n -- New TB Patient \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n -- TB Start Date \n where ob.concept_id = 2237 \n and ob.value_datetime >= :startDate \n and ob.value_datetime <= :endDate \n and ob.voided = 0 \n ) \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- New Clients \n select distinct person_id \n from obs \n where concept_id = 3785 and value_coded = 1034 \n and obs_datetime >= :startDate \n and obs_datetime <= :endDate \n ) \n ) \n \n \n AND o.person_id not in ( \n select distinct os.person_id \n from obs os \n -- Patient must not be a tranfer in \n where os.concept_id = 3772 and os.value_coded =2095 \n AND (os.obs_datetime BETWEEN :startDate AND :endDate) \n ) \n ) \n and ob.voided = 0 \n or ob.person_id in ( \n select ob.person_id \n FROM obs ob \n -- Extra Pulmonary TB in ART Intake \n where ob.concept_id = 2236 and ob.value_coded = 2233 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.voided = 0 \n ) \n \n','2023-03-28 13:42:29',4,'2023-03-29 18:33:58',4,0,NULL,NULL,NULL,'b2905cf9-63d5-4b7b-9a72-0f76caf70da3'),(1861,'HHXM with HIV Positive on CPT/Dapzone','High risk population of HHXM with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM with HIV Positive on CPT/Dapzone\n High risk population of HHXM with HIV Positive on CPT/Dapzone\n \n 2023-03-28 13:51:41 UTC\n \n 2023-03-28 13:52:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1861\n select distinct o.person_id \n from obs o \n -- Positive, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded =3778 -- Population (Household member of Ex miner) \n AND ob.voided = 0 \n \n ) \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 5415 and ob.value_coded in (2330,4619) -- On Dapsone/CPT AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 19:21:41',4,'2023-03-28 19:22:17',4,0,NULL,NULL,NULL,'0133ee85-0abd-494a-86b7-6818670bd37b'),(1862,'Extra-pulmonary (bacteriologically confirmed or clinically diagnosed) - Exlude relapse','Extra-pulmonary (bacteriologically confirmed or clinically diagnosed) - Exlude relapse','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Extra-pulmonary (bacteriologically confirmed or clinically diagnosed) - Exlude relapse\n Extra-pulmonary (bacteriologically confirmed or clinically diagnosed) - Exlude relapse\n \n 2023-03-28 14:29:38 UTC\n \n 2023-03-29 16:36:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1862\n select distinct ob.person_id \n FROM obs ob \n \ninner join location l on ob.location_id = l.location_id \n \n -- Relapsed TB Client \nWHERE (ob.location_id =:location or parent_location =:location) \nand ob.concept_id = 3788 and ob.value_coded = 2233 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.person_id in \n ( \n select o.person_id \n from obs o \n where o.concept_id = 3785 and o.value_coded in (3786,1037) \n and o.obs_datetime >= :startDate \n and o.obs_datetime <= :endDate \n ) \n and ob.voided = 0 \n or ob.person_id in ( \n select ob.person_id \n FROM obs ob \n -- Extra Pulmonary TB in ART Intake \n where ob.concept_id = 2236 and ob.value_coded = 2233 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.voided = 0 \n ) \n \n','2023-03-28 16:29:38',4,'2023-03-29 18:36:39',4,0,NULL,NULL,NULL,'5023a0c3-15b8-4d16-ac54-09a77d01648d'),(1863,'HHCM with HIV Positive on CPT/Dapzone','High risk population of HHCM with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM with HIV Positive on CPT/Dapzone\n High risk population of HHCM with HIV Positive on CPT/Dapzone\n \n 2023-03-28 15:05:16 UTC\n \n 2023-03-28 15:09:54 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1863\n select distinct o.person_id \n from obs o \n -- Positive, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded =3777 -- Population (Household member of miner) \n AND ob.voided = 0 \n \n ) \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 5415 and ob.value_coded in (2330,4619) -- On Dapsone/CPT AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 20:35:16',4,'2023-03-28 20:39:54',4,0,NULL,NULL,NULL,'6365d73a-6fde-4e27-a75b-b5010023ddea'),(1864,'New and Relapse with HIV Positive on CPT/Dapzone','High risk population of New and Relapse with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n New and Relapse with HIV Positive on CPT/Dapzone\n High risk population of New and Relapse with HIV Positive on CPT/Dapzone\n \n 2023-03-28 15:14:37 UTC\n \n 2023-03-28 15:16:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1864\n select distinct o.person_id \n from obs o \n -- Positive, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded in (1034, 1084) -- Population (New and Relapse) \n AND ob.voided = 0 \n \n ) \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 5415 and ob.value_coded in (2330,4619) -- On Dapsone/CPT AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 20:44:37',4,'2023-03-28 20:46:55',4,0,NULL,NULL,NULL,'14343630-0c58-4f34-8bb5-1744e1618c31'),(1865,'Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : New','Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : New','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : New\n Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : New\n \n 2023-03-28 15:16:26 UTC\n \n 2023-03-29 16:47:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1865\n select distinct o.person_id \n FROM obs o \ninner join location l on o.location_id = l.location_id \n -- Bacteriologically confirmed Genotypic test results and Phenotypic test results \n where (o.location_id =:location or parent_location =:location) \n and o.concept_id in (3814, 3815) \n and o.obs_datetime >= :startDate \n and o.obs_datetime <= :endDate \n and o.voided = 0 \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- New Clients \n select distinct person_id \n from obs \n where concept_id = 3785 and value_coded = 1034 \n and obs_datetime >= :startDate \n and obs_datetime <= :endDate \n ) \n ) \n and o.person_id in ( \n select person_id \n from obs where concept_id = 3789 and value_coded= 3791 \n and obs_datetime >= :startDate \n and obs_datetime <= :endDate \n ) \n and o.person_id in ( \n select ob.person_id \n FROM obs ob \n -- Pulmonary TB \n where ob.concept_id = 3788 and ob.value_coded = 1018 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.voided = 0 \n ) \n or o.person_id in ( \n select ob.person_id \n FROM obs ob \n -- Pulmonary TB, Bacteriologically Confirmed \n where ob.concept_id = 2236 and ob.value_coded = 2234 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.voided = 0 \n )\n','2023-03-28 17:16:26',4,'2023-03-29 18:47:04',4,0,NULL,NULL,NULL,'273f38fa-7a41-4323-ac9d-24fd27c0c4cf'),(1866,'Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : Relapse','Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : Relapse','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : Relapse\n Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : Relapse\n \n 2023-03-28 15:21:59 UTC\n \n 2023-03-29 16:47:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1866\n select distinct o.person_id \n FROM obs o \n \ninner join location l on o.location_id = l.location_id \nWHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (3814, 3815) \n and o.obs_datetime >= :startDate \n and o.obs_datetime <= :endDate \n and o.voided = 0 \n AND o.person_id in \n ( \n \n -- Relapsed Clients \n select distinct oo.person_id \n from obs oo \n where oo.concept_id = 3785 and oo.value_coded = 1084 \n and oo.obs_datetime >= :startDate \n and oo.obs_datetime <= :endDate \n ) \n and o.person_id in ( \n select person_id \n from obs where concept_id = 3789 and value_coded= 3791 \n and obs_datetime >= :startDate \n and obs_datetime <= :endDate \n ) \n and o.person_id in ( \n select ob.person_id \n FROM obs ob \n -- Pulmonary TB \n where ob.concept_id = 3788 and ob.value_coded = 1018 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.voided = 0 \n ) \n or o.person_id in ( \n select ob.person_id \n FROM obs ob \n -- Pulmonary TB, Bacteriologically Confirmed \n where ob.concept_id = 2236 and ob.value_coded = 2234 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.voided = 0 \n )\n','2023-03-28 17:21:59',4,'2023-03-29 18:47:31',4,0,NULL,NULL,NULL,'300b2de6-1987-4ae2-a742-c2907f6bc2b7'),(1867,'Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : Excluding Relapse','Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : Excluding Relapse','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : Excluding Relapse\n Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : Excluding Relapse\n \n 2023-03-28 15:25:40 UTC\n \n 2023-03-30 15:34:09 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1867\n select distinct o.person_id \n FROM obs o \ninner join location l on o.location_id = l.location_id \nWHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (3814, 3815) \n and o.obs_datetime >= :startDate \n and o.obs_datetime <= :endDate \n and o.voided = 0 \n AND o.person_id in ( \n select person_id from obs \n where concept_id = 3788 and value_coded = 2233 \n and obs_datetime >= :startDate \n and obs_datetime <= :endDate \n \n ) \n AND o.person_id not in \n ( \n \n -- Relapsed Clients \n select distinct person_id \n from obs \n where concept_id = 3785 and value_coded = 1084 \n and obs_datetime >= :startDate \n and obs_datetime <= :endDate \n ) \n and o.person_id in ( \n select person_id \n from obs where concept_id = 3789 and value_coded= 3791 \n and obs_datetime >= :startDate \n and obs_datetime <= :endDate \n ) \n and o.person_id in ( \n select ob.person_id \n FROM obs ob \n -- Pulmonary TB \n where ob.concept_id = 3788 and ob.value_coded = 1018 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.voided = 0 \n ) \n or o.person_id in ( \n select ob.person_id \n FROM obs ob \n -- Pulmonary TB, Bacteriologically Confirmed \n where ob.concept_id = 2236 and ob.value_coded = 2234 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.voided = 0 \n )\n','2023-03-28 17:25:40',4,'2023-03-30 17:34:09',4,0,NULL,NULL,NULL,'fc1f07c9-e4d5-4d2f-97fb-98b26e6f66d0'),(1868,'Retreatment with HIV Positive on CPT/Dapzone','Retreatment Excl. Relapse with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Retreatment with HIV Positive on CPT/Dapzone\n Retreatment Excl. Relapse with HIV Positive on CPT/Dapzone\n \n 2023-03-28 15:28:13 UTC\n \n 2023-03-28 15:30:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1868\n select distinct o.person_id \n from obs o \n -- Positive, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded in (3786, 1037) -- Population (Retreatment Excl. Relapse) \n AND ob.voided = 0 \n \n ) \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 5415 and ob.value_coded in (2330,4619) -- On Dapsone/CPT AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 20:58:13',4,'2023-03-28 21:00:05',4,0,NULL,NULL,NULL,'fc64e900-ad46-45b3-9514-3d9aaefbd2cf'),(1869,'Children < 15 with Positive HIV on CPT/Dapzone','Children < 15 with Positive HIV on CPT/Dapzone','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children < 15 with Positive HIV on CPT/Dapzone\n Children < 15 with Positive HIV on CPT/Dapzone\n \n 2023-03-28 15:51:27 UTC\n \n 2023-03-29 21:44:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1869\n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- HIV Positive Status \n inner join location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 5415 and ob.value_coded in (2330,4619) -- On Dapsone/CPT AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n having Age < 15\n','2023-03-28 17:51:27',4,'2023-03-29 23:44:53',4,0,NULL,NULL,NULL,'36fe954a-f05e-431b-9037-4772a4b28383'),(1870,'Miners with HIV Positive on CPT/Dapzone','High risk population Miners with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Miners with HIV Positive on CPT/Dapzone\n High risk population Miners with HIV Positive on CPT/Dapzone\n \n 2023-03-28 15:55:23 UTC\n \n 2023-03-28 15:56:49 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1870\n select distinct o.person_id \n from obs o \n -- Positive, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded =3667 -- Population (miner) \n AND ob.voided = 0 \n \n ) \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 5415 and ob.value_coded in (2330,4619) -- On Dapsone/CPT AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 21:25:23',4,'2023-03-28 21:26:49',4,0,NULL,NULL,NULL,'354da83b-27c3-4124-9198-d1902fefb417'),(1871,'Ex Miner with HIV Positive on CPT/Dapzone',' High risk population of Ex Miner with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Ex Miner with HIV Positive on CPT/Dapzone\n High risk population of Ex Miner with HIV Positive on CPT/Dapzone\n \n 2023-03-28 16:02:40 UTC\n \n 2023-03-28 16:06:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1871\n select distinct o.person_id \n from obs o \n -- Positive, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded =3668 -- Population (Ex miner) \n AND ob.voided = 0 \n \n ) \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 5415 and ob.value_coded in (2330,4619) -- On Dapsone/CPT AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 21:32:40',4,'2023-03-28 21:36:28',4,0,NULL,NULL,NULL,'ff703f75-36cc-4487-afab-65df0ccbff68'),(1872,'Factory Workers with HIV Positive on CPT/Dapzone','High risk population of Factory Workers with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Factory Workers with HIV Positive on CPT/Dapzone\n High risk population of Factory Workers with HIV Positive on CPT/Dapzone\n \n 2023-03-28 16:08:16 UTC\n \n 2023-03-28 16:09:25 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1872\n select distinct o.person_id \n from obs o \n -- Positive, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded =3770 -- Population (Factory Workers) \n AND ob.voided = 0 \n \n ) \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 5415 and ob.value_coded in (2330,4619) -- On Dapsone/CPT AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 21:38:16',4,'2023-03-28 21:39:25',4,0,NULL,NULL,NULL,'ff030c28-e12b-45ed-80b0-330e353fdd29'),(1873,'Public transport operators with HIV Positive on CPT/Dapzone','High risk population of Public transport operators with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Public transport operators with HIV Positive on CPT/Dapzone\n High risk population of Public transport operators with HIV Positive on CPT/Dapzone\n \n 2023-03-28 16:14:01 UTC\n \n 2023-03-28 16:14:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1873\n select distinct o.person_id \n from obs o \n -- Positive, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded =4654 -- Population (Public transport operators) \n AND ob.voided = 0 \n \n ) \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 5415 and ob.value_coded in (2330,4619) -- On Dapsone/CPT AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 21:44:01',4,'2023-03-28 21:44:45',4,0,NULL,NULL,NULL,'b116d4a0-174f-49a7-be0f-3d5f79581b05'),(1874,'Health workers with HIV Positive on CPT/Dapzone',' High risk population of Health workers with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Health workers with HIV Positive on CPT/Dapzone\n High risk population of Health workers with HIV Positive on CPT/Dapzone\n \n 2023-03-28 16:16:21 UTC\n \n 2023-03-28 16:17:38 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1874\n select distinct o.person_id \n from obs o \n -- Positive, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded =3470 -- Population (Health workers) \n AND ob.voided = 0 \n \n ) \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 5415 and ob.value_coded in (2330,4619) -- On Dapsone/CPT AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 21:46:21',4,'2023-03-28 21:47:38',4,0,NULL,NULL,NULL,'4c4aa324-1728-4001-a94e-e857574126b1'),(1875,'Correctional Staff and inmates with HIV Positive on CPT/Dapzone','High risk population of Correctional Staff and inmates with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Correctional Staff and inmates with HIV Positive on CPT/Dapzone\n High risk population of Correctional Staff and inmates with HIV Positive on CPT/Dapzone\n \n 2023-03-28 16:20:31 UTC\n \n 2023-03-28 16:27:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1875\n select distinct o.person_id \n from obs o \n -- Positive, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded in (3779, 3671) -- Population (Correctional Staff and inmates) \n AND ob.voided = 0 \n \n ) \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 5415 and ob.value_coded in (2330,4619) -- On Dapsone/CPT AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 21:50:31',4,'2023-03-28 21:57:26',4,0,NULL,NULL,NULL,'423a7240-f359-41a2-929d-7b1cd7010807'),(1876,'TB among Miners','TB among Key Population Group Miners','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB among Miners\n TB among Key Population Group Miners\n \n 2023-03-28 17:11:27 UTC\n \n 2023-03-28 17:34:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1876\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in( \nSELECT Id \nFROM \n((SELECT distinct Id, patientIdentifier AS "Patient_Identifier", patientName AS "Patient_Name" \n FROM \n \n (select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n person.gender AS Gender, \n observed_age_group.name AS age_group, \n observed_age_group.sort_order AS sort_order \n \n from obs o \n -- Miners \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- Miners \n select distinct person_id \n from obs \n where concept_id = 3776 and value_coded = 3667 \n and obs_datetime >= CAST(:startDate AS DATE) \n and obs_datetime <= CAST(:endDate AS DATE) \n ) \n ) \n \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages') AS NEW_TB_CLIENTS \n ORDER BY NEW_TB_CLIENTS.Age) \n \n) AS Miner \n)\n','2023-03-28 22:41:27',4,'2023-03-28 23:04:23',4,0,NULL,NULL,NULL,'273e3515-f928-4164-be82-fc5235d66188'),(1877,'TB among Exminers','TB among Key Population Group Exminers','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB among Exminers\n TB among Key Population Group Exminers\n \n 2023-03-28 17:40:01 UTC\n \n 2023-03-28 17:41:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1877\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in( \nSELECT Id \nFROM \n((SELECT distinct Id, patientIdentifier AS "Patient_Identifier", patientName AS "Patient_Name" \n FROM \n \n (select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n person.gender AS Gender, \n observed_age_group.name AS age_group, \n observed_age_group.sort_order AS sort_order \n \n from obs o \n -- Exminers \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- Exminers \n select distinct person_id \n from obs \n where concept_id = 3776 and value_coded = 3668 \n and obs_datetime >= CAST(:startDate AS DATE) \n and obs_datetime <= CAST(:endDate AS DATE) \n ) \n ) \n \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages') AS NEW_TB_CLIENTS \n ORDER BY NEW_TB_CLIENTS.Age) \n \n) AS Exminer \n)\n','2023-03-28 23:10:01',4,'2023-03-28 23:11:15',4,0,NULL,NULL,NULL,'ecb47cb2-6af4-4932-8fee-076ba40afa87'),(1878,'TB among HHCM','TB among Key Population Group HHCM','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB among HHCM\n TB among Key Population Group HHCM\n \n 2023-03-28 19:19:59 UTC\n \n 2023-03-28 19:26:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1878\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in( \nSELECT Id \nFROM \n((SELECT distinct Id, patientIdentifier AS "Patient_Identifier", patientName AS "Patient_Name" \n FROM \n \n (select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n person.gender AS Gender, \n observed_age_group.name AS age_group, \n observed_age_group.sort_order AS sort_order \n \n from obs o \n -- HHCM \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- HHCM \n select distinct person_id \n from obs \n where concept_id = 3776 and value_coded = 3777 \n and obs_datetime >= CAST(:startDate AS DATE) \n and obs_datetime <= CAST(:endDate AS DATE) \n ) \n ) \n \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages') AS NEW_TB_CLIENTS \n ORDER BY NEW_TB_CLIENTS.Age) \n \n) As HHCM \n)\n','2023-03-29 00:49:59',4,'2023-03-29 00:56:17',4,0,NULL,NULL,NULL,'0da939c1-ae87-45c8-80ed-e56b82e5a62e'),(1879,'Correctional Staff and inmates on HIV Positive on ART','High risk population of Correctional Staff and inmates on HIV Positive on ART','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Correctional Staff and inmates on HIV Positive on ART\n High risk population of Correctional Staff and inmates on HIV Positive on ART\n \n 2023-03-28 19:25:59 UTC\n \n 2023-03-29 20:58:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1879\n select distinct o.person_id \n from obs o \n -- On ART \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4667 and o.value_coded in (4670, 4669) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded in (3779, 3671) -- Population (Correctional Staff and inmates) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \nAND o.obs_datetime >= CAST(:endDate AS DATE) \n\n','2023-03-28 21:25:59',4,'2023-03-29 22:58:43',4,0,NULL,NULL,NULL,'a6ebd7a8-631b-4e0e-bdfb-8be1b9fb9eec'),(1880,'New and Relapse with HIV Positive on ART','High risk population of New and Relapse with HIV Positive on ART','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n New and Relapse with HIV Positive on ART\n High risk population of New and Relapse with HIV Positive on ART\n \n 2023-03-28 19:29:52 UTC\n \n 2023-03-28 19:32:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1880\n SELECT DISTINCT o.person_id \n from obs o \n -- New and Relapse On ART \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4667 and o.value_coded in (4670, 4669) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3785 and ob.value_coded in (1034, 1084) -- New and Relapse \n and ob.voided = 0 \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE)\n','2023-03-29 00:59:52',4,'2023-03-29 01:02:02',4,0,NULL,NULL,NULL,'8067c849-4c81-475a-a26e-68a2e58b8067'),(1882,'Retreatment with HIV Positive on ART','High risk population of Retreatment Excl. Relapse HIV Positive on ART','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Retreatment with HIV Positive on ART\n High risk population of Retreatment Excl. Relapse HIV Positive on ART\n \n 2023-03-28 19:34:51 UTC\n \n 2023-03-28 19:45:46 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1882\n SELECT DISTINCT o.person_id \n from obs o \n -- Retreatmentafter LTFU/Failure on ART \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4667 and o.value_coded in (4670, 4669) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3785 and ob.value_coded in (3786, 1037) -- Retreatmentafter LTFU/Failure \n and ob.voided = 0 \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-29 01:04:51',4,'2023-03-29 01:15:46',4,0,NULL,NULL,NULL,'fe4f73c9-4b24-4458-9ae1-9d3fcad9f9cb'),(1883,'TB among HHXM','TB among Key Population Group HHXM','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB among HHXM\n TB among Key Population Group HHXM\n \n 2023-03-28 19:35:03 UTC\n \n 2023-03-28 19:37:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1883\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in( \nSELECT Id \nFROM \n((SELECT distinct Id, patientIdentifier AS "Patient_Identifier", patientName AS "Patient_Name" \n FROM \n \n (select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n person.gender AS Gender, \n observed_age_group.name AS age_group, \n observed_age_group.sort_order AS sort_order \n \n from obs o \n -- HHXM \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- HHXM \n select distinct person_id \n from obs \n where concept_id = 3776 and value_coded = 3778 \n and obs_datetime >= CAST(:startDate AS DATE) \n and obs_datetime <= CAST(:endDate AS DATE) \n ) \n ) \n \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages') AS NEW_TB_CLIENTS \n ORDER BY NEW_TB_CLIENTS.Age) \n \n) AS HHXM \n)\n','2023-03-29 01:05:03',4,'2023-03-29 01:07:06',4,0,NULL,NULL,NULL,'4715bb07-7b64-4001-b5cb-ea555b425a07'),(1884,'TB among Factory Workers','TB among Key Population Group Factory Workers','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB among Factory Workers\n TB among Key Population Group Factory Workers\n \n 2023-03-28 19:43:14 UTC\n \n 2023-03-28 19:45:00 UTC\n \n \n endDate\n \n java.util.Date\n true\n \n \n startDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1884\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in( \nSELECT Id \nFROM \n((SELECT distinct Id, patientIdentifier AS "Patient_Identifier", patientName AS "Patient_Name" \n FROM \n \n (select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n person.gender AS Gender, \n observed_age_group.name AS age_group, \n observed_age_group.sort_order AS sort_order \n \n from obs o \n -- FactoryWorkers \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- FactoryWorkers \n select distinct person_id \n from obs \n where concept_id = 3776 and value_coded = 3669 \n and obs_datetime >= CAST(:startDate AS DATE) \n and obs_datetime <= CAST(:endDate AS DATE) \n ) \n ) \n \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages') AS NEW_TB_CLIENTS \n ORDER BY NEW_TB_CLIENTS.Age) \n \n) AS FactoryWorkers \n)\n','2023-03-29 01:13:14',4,'2023-03-29 01:15:01',4,0,NULL,NULL,NULL,'6bed2c03-ba40-477b-9a9a-67f3fcd50ea3'),(1885,'TB among Correctional Staff & Inmates','TB among Key Population Group Correctional Staff & Inmates','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB among Correctional Staff & Inmates\n TB among Key Population Group Correctional Staff & Inmates\n \n 2023-03-28 19:47:06 UTC\n \n 2023-03-28 19:49:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1885\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in( \nSELECT Id \nFROM \n((SELECT distinct Id, patientIdentifier AS "Patient_Identifier", patientName AS "Patient_Name" \n FROM \n \n (select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n person.gender AS Gender, \n observed_age_group.name AS age_group, \n observed_age_group.sort_order AS sort_order \n \n from obs o \n -- Correctional Staff & Inmates \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- Correctional Staff & Inmates \n select distinct person_id \n from obs \n where concept_id = 3776 and value_coded in (3779,3671) \n and obs_datetime >= CAST(:startDate AS DATE) \n and obs_datetime <= CAST(:endDate AS DATE) \n ) \n ) \n \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages') AS NEW_TB_CLIENTS \n ORDER BY NEW_TB_CLIENTS.Age) \n \n) AS Correctional \n)\n','2023-03-29 01:17:06',4,'2023-03-29 01:19:30',4,0,NULL,NULL,NULL,'9016d0ef-4556-49e7-99bd-2bf2e7f5188f'),(1886,'Children < 15 with HIV Positive on ART','High risk population for Children < 15 with HIV Positive on ART','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children < 15 with HIV Positive on ART\n High risk population for Children < 15 with HIV Positive on ART\n \n 2023-03-28 19:47:46 UTC\n \n 2023-03-28 19:50:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1886\n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- HIV Positive on ART \n inner join location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4667 and o.value_coded in (4670, 4669) \n AND o.voided = 0 \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n having Age < 15\n','2023-03-29 01:17:46',4,'2023-03-29 01:20:02',4,0,NULL,NULL,NULL,'e724e30e-b9e1-4a19-afa9-d19aa8dc42f4'),(1887,'TB among Public Transport Operators ','TB among Key Population Group Public Transport Operators','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB among Public Transport Operators \n TB among Key Population Group Public Transport Operators\n \n 2023-03-28 19:51:36 UTC\n \n 2023-03-28 19:53:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1887\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in( \nSELECT Id \nFROM \n((SELECT distinct Id, patientIdentifier AS "Patient_Identifier", patientName AS "Patient_Name" \n FROM \n \n (select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n person.gender AS Gender, \n observed_age_group.name AS age_group, \n observed_age_group.sort_order AS sort_order \n \n from obs o \n -- Transport \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- Transport \n select distinct person_id \n from obs \n where concept_id = 3776 and value_coded = 4654 \n and obs_datetime >= CAST(:startDate AS DATE) \n and obs_datetime <= CAST(:endDate AS DATE) \n ) \n ) \n \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages') AS NEW_TB_CLIENTS \n ORDER BY NEW_TB_CLIENTS.Age) \n \n) AS Transport \n)\n','2023-03-29 01:21:36',4,'2023-03-29 01:23:32',4,0,NULL,NULL,NULL,'4aac5017-e28a-4f36-8805-0812476a9d7b'),(1888,'Miners with HIV Positive on ART','High risk population of Miners with HIV Positive on ART','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Miners with HIV Positive on ART\n High risk population of Miners with HIV Positive on ART\n \n 2023-03-28 19:55:27 UTC\n \n 2023-03-28 19:56:16 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1888\n select distinct o.person_id \n from obs o \n -- HIV Positive on ART \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded = 3667 -- Population (Miner) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-29 01:25:27',4,'2023-03-29 01:26:16',4,0,NULL,NULL,NULL,'a37a95b7-1365-4d73-8d21-28dd2e77196e'),(1889,'TB among Health Workers','TB among Key Population Group Health Workers','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB among Health Workers\n TB among Key Population Group Health Workers\n \n 2023-03-28 19:55:49 UTC\n \n 2023-03-28 19:57:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1889\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in( \nSELECT Id \nFROM \n((SELECT distinct Id, patientIdentifier AS "Patient_Identifier", patientName AS "Patient_Name" \n FROM \n \n (select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n person.gender AS Gender, \n observed_age_group.name AS age_group, \n observed_age_group.sort_order AS sort_order \n \n from obs o \n -- HealthWorkers \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- HealthWorkers \n select distinct person_id \n from obs \n where concept_id = 3776 and value_coded = 3670 \n and obs_datetime >= CAST(:startDate AS DATE) \n and obs_datetime <= CAST(:endDate AS DATE) \n ) \n ) \n \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages') AS NEW_TB_CLIENTS \n ORDER BY NEW_TB_CLIENTS.Age) \n \n) AS HealthWorkers \n)\n','2023-03-29 01:25:49',4,'2023-03-29 01:27:20',4,0,NULL,NULL,NULL,'04590a3f-4e59-45fe-a5c3-f5ae76ef805b'),(1890,'Ex Miner with with HIV Positive on ART','High risk population of Ex Miner with with HIV Positive on ART','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Ex Miner with with HIV Positive on ART\n High risk population of Ex Miner with with HIV Positive on ART\n \n 2023-03-28 19:58:00 UTC\n \n 2023-03-28 19:59:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1890\n select distinct o.person_id \n from obs o \n -- HIV Positive on ART \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4667 and o.value_coded in (4670, 4669) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded = 3668 -- Population (Ex-Miner) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-29 01:28:00',4,'2023-03-29 01:29:01',4,0,NULL,NULL,NULL,'1edf0f21-2fad-48c7-a24a-e21367f334c1'),(1891,'HHCM with with HIV Positive on ART','High risk population of HHCM with with HIV Positive on ART','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM with with HIV Positive on ART\n High risk population of HHCM with with HIV Positive on ART\n \n 2023-03-28 20:00:28 UTC\n \n 2023-03-28 20:03:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1891\n select distinct o.person_id \n from obs o \n -- HIV Positive on ART \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4667 and o.value_coded in (4670, 4669) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded =3777 -- Population (Household member of current miner) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-29 01:30:28',4,'2023-03-29 01:33:58',4,0,NULL,NULL,NULL,'14b8879f-49ef-492c-aeb0-fdd62fde084a'),(1892,'TB among Miners','TB among Key Population Group Miners','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB among Miners\n TB among Key Population Group Miners\n \n 2023-03-28 20:05:03 UTC\n \n 2023-03-28 20:12:22 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1892\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 01:35:03',4,'2023-03-29 01:42:22',4,0,NULL,NULL,NULL,'526100b3-2b2a-4f15-862e-4be06d73bdb3'),(1893,'HHXM with HIV Positive on ART','High risk population of HHXM with HIV Positive on ART','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM with HIV Positive on ART\n High risk population of HHXM with HIV Positive on ART\n \n 2023-03-28 20:05:19 UTC\n \n 2023-03-28 20:08:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1893\n select distinct o.person_id \n from obs o \n -- Positive, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4667 and o.value_coded in (4670, 4669) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded =3778 -- Population (Household member of Ex miner) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-29 01:35:19',4,'2023-03-29 01:38:02',4,0,NULL,NULL,NULL,'0d7e9652-b8fa-4264-859b-0b681452c462'),(1894,'Factory Workers with HIV Positive on ART','High risk population of Factory Workers with HIV Positive on ART','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Factory Workers with HIV Positive on ART\n High risk population of Factory Workers with HIV Positive on ART\n \n 2023-03-28 20:09:30 UTC\n \n 2023-03-28 20:10:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1894\n select distinct o.person_id \n from obs o \n -- Positive HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4667 and o.value_coded in (4670, 4669) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded = 3669 -- Population (Factory Workers) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-29 01:39:30',4,'2023-03-29 01:40:27',4,0,NULL,NULL,NULL,'67233a82-27bf-4615-948b-28fad7ad6322'),(1895,'Public transport operators with HIV Positive on ART','High risk population of Public transport operators with HIV Positive on ART','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Public transport operators with HIV Positive on ART\n High risk population of Public transport operators with HIV Positive on ART\n \n 2023-03-28 20:12:15 UTC\n \n 2023-03-28 20:14:34 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1895\n select distinct o.person_id \n from obs o \n -- Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded = 4654 -- Population (Public transport operators) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-29 01:42:15',4,'2023-03-29 01:44:34',4,0,NULL,NULL,NULL,'63418340-29fe-4106-83ad-a09538397f5f'),(1896,'TB among Exminers','TB among Key Population Group Ex Miners','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB among Exminers\n TB among Key Population Group Ex Miners\n \n 2023-03-28 20:13:33 UTC\n \n 2023-03-28 20:18:09 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1896\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 01:43:33',4,'2023-03-29 01:48:09',4,0,NULL,NULL,NULL,'2dcbfff3-70b6-4ed5-b727-a51fea71b8aa'),(1897,'Health workers with HIV Positive on ART','High risk population of Health workers with HIV Positive on ART','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Health workers with HIV Positive on ART\n High risk population of Health workers with HIV Positive on ART\n \n 2023-03-28 20:18:06 UTC\n \n 2023-03-28 20:18:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1897\n select distinct o.person_id \n from obs o \n -- Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4667 and o.value_coded in (4670, 4669) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded = 4670 -- Population (Health workers) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-29 01:48:06',4,'2023-03-29 01:48:39',4,0,NULL,NULL,NULL,'1340548d-896a-4473-ae26-4c8960dec630'),(1898,'TB among HHCM','TB among Key Population Group HHCM','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB among HHCM\n TB among Key Population Group HHCM\n \n 2023-03-28 20:19:17 UTC\n \n 2023-03-28 20:20:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1898\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 01:49:17',4,'2023-03-29 01:50:21',4,0,NULL,NULL,NULL,'dd0ada55-f903-426e-a60e-f83ceeb15cab'),(1899,'TB among HHXM','TB among Key Population Group HHXM','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB among HHXM\n TB among Key Population Group HHXM\n \n 2023-03-28 20:21:08 UTC\n \n 2023-03-28 20:23:24 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1899\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 01:51:08',4,'2023-03-29 01:53:24',4,0,NULL,NULL,NULL,'9558eb96-47f5-4cdd-ad4f-d07257529259'),(1900,'Pulmonary Bacteriologically Confirmed - Exlude Relapse','Pulmonary Bacteriologically Confirmed - Exlude Relapse','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Pulmonary Bacteriologically Confirmed - Exlude Relapse\n Pulmonary Bacteriologically Confirmed - Exlude Relapse\n \n 2023-03-29 03:39:55 UTC\n \n 2023-03-29 17:21:25 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1900\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 05:39:55',4,'2023-03-29 19:21:25',4,0,NULL,NULL,NULL,'8315a536-5b6e-4da8-bcf7-860b6b6bd8aa'),(1902,'Pulmonary Bacteriologically Confirmed New','Pulmonary Bacteriologically Confirmed New','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Pulmonary Bacteriologically Confirmed New\n Pulmonary Bacteriologically Confirmed New\n \n 2023-03-29 04:12:11 UTC\n \n 2023-03-29 05:37:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1902\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 09:42:11',4,'2023-03-29 11:07:28',4,0,NULL,NULL,NULL,'15e06979-0f27-4aba-87fb-bc5a6dc28da4'),(1903,'Pulmonary Clinically Diagnosed Excluding Relapse','Pulmonary Clinically Diagnosed Excluding Relapse','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Pulmonary Clinically Diagnosed Excluding Relapse\n Pulmonary Clinically Diagnosed Excluding Relapse\n \n 2023-03-29 06:06:35 UTC\n \n 2023-03-29 08:12:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1903\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 11:36:35',4,'2023-03-29 13:42:28',4,0,NULL,NULL,NULL,'b0ff3ba5-25df-46e4-8eae-bfca7d86b9dd'),(1904,'Pulmonary Bacteriologically Confirmed Relapse','Pulmonary Bacteriologically Confirmed Relapse','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Pulmonary Bacteriologically Confirmed Relapse\n Pulmonary Bacteriologically Confirmed Relapse\n \n 2023-03-29 06:08:27 UTC\n \n 2023-03-29 08:11:19 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1904\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 11:38:27',4,'2023-03-29 13:41:19',4,0,NULL,NULL,NULL,'f6797c59-e7e3-4492-ad5f-a67bf5e683bc'),(1905,'Pulmonary Clinically Diagnosed New','Pulmonary Clinically Diagnosed New','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Pulmonary Clinically Diagnosed New\n Pulmonary Clinically Diagnosed New\n \n 2023-03-29 08:14:51 UTC\n \n 2023-03-29 08:17:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1905\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 13:44:51',4,'2023-03-29 13:47:31',4,0,NULL,NULL,NULL,'63333694-f766-4047-830b-087496f8e5a8'),(1906,'Pulmonary Clinically Diagnosed Relapse','Pulmonary Clinically Diagnosed Relapse','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Pulmonary Clinically Diagnosed Relapse\n Pulmonary Clinically Diagnosed Relapse\n \n 2023-03-29 08:15:08 UTC\n \n 2023-03-29 08:18:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1906\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 13:45:08',4,'2023-03-29 13:48:31',4,0,NULL,NULL,NULL,'2ff007c1-993d-48fc-8df6-9ed7c66b42d3'),(1907,'Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - New','Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - New','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - New\n Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - New\n \n 2023-03-29 08:25:10 UTC\n \n 2023-03-29 08:49:47 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1907\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 13:55:10',4,'2023-03-29 14:19:47',4,0,NULL,NULL,NULL,'d1ce1a2c-338a-4926-a1d4-f7f79ac2b875'),(1908,'TB among Factory Workers','TB among Key Population Group Factory Workers','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB among Factory Workers\n TB among Key Population Group Factory Workers\n \n 2023-03-29 08:26:00 UTC\n \n 2023-03-29 08:52:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1908\n COUNT\n \n \n \n \n endDate\n ${startDate}\n \n \n location\n ${location}\n \n \n startDate\n ${endDate}\n \n \n \n','2023-03-29 13:56:00',4,'2023-03-29 14:22:40',4,0,NULL,NULL,NULL,'071a7d7a-f944-4965-978c-bfe740051b9a'),(1909,'Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - Relapse','Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - Relapse','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - Relapse\n Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - Relapse\n \n 2023-03-29 08:52:39 UTC\n \n 2023-03-29 08:54:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1909\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 14:22:39',4,'2023-03-29 14:24:28',4,0,NULL,NULL,NULL,'20c9a6fc-f845-4569-b018-b5f59c39948c'),(1910,'Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - Excluging Relapse','Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - Excluging Relapse','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - Excluging Relapse\n Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - Excluging Relapse\n \n 2023-03-29 08:53:19 UTC\n \n 2023-03-29 08:54:54 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1910\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 14:23:19',4,'2023-03-29 14:24:54',4,0,NULL,NULL,NULL,'422afe85-5763-4700-8a8b-bf17328901a8'),(1911,'TB among Correctional Staff & Inmates','TB among Key Population Group Correctional Staff & Inmates','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB among Correctional Staff & Inmates\n TB among Key Population Group Correctional Staff & Inmates\n \n 2023-03-29 08:53:58 UTC\n \n 2023-03-29 08:56:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1911\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 14:23:58',4,'2023-03-29 14:26:06',4,0,NULL,NULL,NULL,'8ac11f64-421a-4f48-9ac3-048ee6912eda'),(1912,'Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : Excluding Relapse','Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : Excluding Relapse','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : Excluding Relapse\n Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : Excluding Relapse\n \n 2023-03-29 08:55:36 UTC\n \n 2023-03-29 09:04:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1912\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 14:25:36',4,'2023-03-29 14:34:23',4,0,NULL,NULL,NULL,'83125cb9-0324-4e21-8f4d-b9fd51049909'),(1913,'TB among Public Transport Operators ','TB among Key Population Group Public Transport Operators','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB among Public Transport Operators \n TB among Key Population Group Public Transport Operators\n \n 2023-03-29 08:57:05 UTC\n \n 2023-03-29 08:59:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1913\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 14:27:05',4,'2023-03-29 14:29:07',4,0,NULL,NULL,NULL,'f3aabc74-880c-4502-94af-ff9fd0b95906'),(1914,'Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : New','Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : New','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : New\n Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : New\n \n 2023-03-29 08:59:37 UTC\n \n 2023-03-29 09:04:54 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1914\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 14:29:37',4,'2023-03-29 14:34:54',4,0,NULL,NULL,NULL,'c5e34544-e98f-42ce-82d1-3708ce5e5b80'),(1915,'TB among Health Workers','TB among Key Population Group Health Workers','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB among Health Workers\n TB among Key Population Group Health Workers\n \n 2023-03-29 09:02:15 UTC\n \n 2023-03-29 09:04:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1915\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 14:32:15',4,'2023-03-29 14:34:59',4,0,NULL,NULL,NULL,'76adf56b-486f-4a4c-b309-5c43372d94eb'),(1916,'TB Notification - Block 3','TB Notification - Block 3','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Notification - Block 3\n TB Notification - Block 3\n \n 2023-03-29 09:08:01 UTC\n \n 2023-03-29 09:08:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1916\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-03-29 14:38:01',4,'2023-03-29 14:38:31',4,0,NULL,NULL,NULL,'5a51f412-3b6f-4808-ae32-ed90141bb7e2'),(1917,'TB Notification - Block 3 Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Notification - Block 3 Data Set\n \n 2023-03-29 09:08:31 UTC\n \n 2023-03-29 10:08:22 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1917\n \n \n \n TB-HHCM\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n \n \n TB-HHXM\n \n \n \n \n \n \n \n \n \n TBExMiners\n \n \n \n \n \n \n \n \n \n TBFactoryW\n \n \n \n \n \n \n \n \n \n TBHealthW\n \n \n \n \n \n \n \n \n \n TBInmates\n \n \n \n \n \n \n \n \n \n TBMiners\n \n \n \n \n \n \n \n \n \n TBTrans\n \n \n \n \n \n \n \n \n \n','2023-03-29 14:38:31',4,'2023-03-29 15:38:22',4,0,NULL,NULL,NULL,'4e91ef91-ad5f-4717-b782-9ac61d52dc40'),(1919,'Block 1: All TB Patients diagnosed with TB during the current quarter, by history of treatment and anatomic site of disease Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Block 1: All TB Patients diagnosed with TB during the current quarter, by history of treatment and anatomic site of disease Data Set\n \n 2023-03-29 09:46:48 UTC\n \n 2023-03-29 15:30:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1919\n \n \n \n died1\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n \n \n died2\n \n \n \n \n \n \n \n \n \n died3\n \n \n \n \n \n \n \n \n \n extra1\n \n \n \n \n \n \n \n \n \n extra2\n \n \n \n \n \n \n \n \n \n extra3\n \n \n \n \n \n \n \n \n \n pul_ExPulm\n \n \n \n \n \n \n \n \n \n pul_clin1\n \n \n \n \n \n \n \n \n \n pul_diag2\n \n \n \n \n \n \n \n \n \n pul_new \n \n \n \n \n \n \n \n \n \n pul_newex\n \n \n \n \n \n \n \n \n \n pul_relaps\n \n \n \n \n \n \n \n \n \n','2023-03-29 11:46:48',4,'2023-03-29 17:30:32',4,0,NULL,NULL,NULL,'b7c3203a-888a-4139-9c3f-e9a8939bc811'),(1920,'New and Relapse with document HIV Status','','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n New and Relapse with document HIV Status\n \n \n 2023-03-29 14:22:45 UTC\n \n 2023-03-29 14:30:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1920\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 19:52:45',4,'2023-03-29 20:00:02',4,0,NULL,NULL,NULL,'18152a92-ded2-4f5a-af93-5dd01b51c839'),(1921,'Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : Relapse','Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : Relapse','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : Relapse\n Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : Relapse\n \n 2023-03-29 15:26:50 UTC\n \n 2023-03-29 15:28:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1921\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 17:26:50',4,'2023-03-29 17:28:11',4,0,NULL,NULL,NULL,'61cb2cc7-ee32-4da9-9c82-7bbc85f3e43c'),(1922,'TB Notification - Block 1 ','TB Notification - Block 1 ','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Notification - Block 1 \n TB Notification - Block 1 \n \n 2023-03-29 17:06:10 UTC\n \n 2023-03-29 17:06:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1922\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-03-29 19:06:10',4,'2023-03-29 19:06:58',4,0,NULL,NULL,NULL,'c7604f80-13cf-4773-abf5-b95f35fa1c92'),(1923,'TB Notification - Block 1 Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Notification - Block 1 Data Set\n \n 2023-03-29 17:06:58 UTC\n \n 2023-03-29 17:37:54 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1923\n \n \n \n died1\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n \n \n died2\n \n \n \n \n \n \n \n \n \n died3\n \n \n \n \n \n \n \n \n \n extra1\n \n \n \n \n \n \n \n \n \n extra2\n \n \n \n \n \n \n \n \n \n extra3\n \n \n \n \n \n \n \n \n \n pul1\n \n \n \n \n \n \n \n \n \n pul2\n \n \n \n \n \n \n \n \n \n pul3\n \n \n \n \n \n \n \n \n \n','2023-03-29 19:06:58',4,'2023-03-29 19:37:54',4,0,NULL,NULL,NULL,'d74aa49a-aa20-49e1-939a-5f1fb0c78d81'),(1924,'Children < 15 with Documented HIV Status','Children (0 - 14) with documented HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children < 15 with Documented HIV Status\n Children (0 - 14) with documented HIV Status\n \n 2023-03-29 17:07:40 UTC\n \n 2023-03-29 17:08:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1924\n COUNT\n \n \n \n \n endDate\n ${startDate}\n \n \n location\n ${location}\n \n \n startDate\n ${endDate}\n \n \n \n','2023-03-29 19:07:40',4,'2023-03-29 19:08:45',4,0,NULL,NULL,NULL,'777854f8-1e75-4b4c-9eb5-2b2a23acd1fd'),(1925,'Correctional Staff and inmates with Documented HIV Status','High risk population of Correctional Staff and inmates with Documented HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Correctional Staff and inmates with Documented HIV Status\n High risk population of Correctional Staff and inmates with Documented HIV Status\n \n 2023-03-29 17:11:52 UTC\n \n 2023-03-29 17:16:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1925\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 19:11:52',4,'2023-03-29 19:16:20',4,0,NULL,NULL,NULL,'8e2ae589-9a13-4aa5-bf9d-3cf376a59bf6'),(1926,'Ex-Miners with Documented HIV Status','High risk population of Ex Miners with Documented HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Ex-Miners with Documented HIV Status\n High risk population of Ex Miners with Documented HIV Status\n \n 2023-03-29 17:20:28 UTC\n \n 2023-03-29 17:23:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1926\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 19:20:28',4,'2023-03-29 19:23:06',4,0,NULL,NULL,NULL,'b2541e20-b6b8-4985-bd4a-9a980ee5ebf8'),(1927,'Factory Workers with Documented HIV Status','High risk population of Factory Workers with Documented HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Factory Workers with Documented HIV Status\n High risk population of Factory Workers with Documented HIV Status\n \n 2023-03-29 17:25:11 UTC\n \n 2023-03-29 17:29:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1927\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 19:25:11',4,'2023-03-29 19:29:17',4,0,NULL,NULL,NULL,'e95e9d48-01d5-4826-ab2c-82dbd2dfce44'),(1928,'Health workers with Documented HIV Status','High risk population of Health workers with Documented HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Health workers with Documented HIV Status\n High risk population of Health workers with Documented HIV Status\n \n 2023-03-29 17:31:28 UTC\n \n 2023-03-29 17:33:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1928\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 19:31:28',4,'2023-03-29 19:33:36',4,0,NULL,NULL,NULL,'38dd8693-21f8-40c2-ba3a-9f5d1a63959c'),(1929,'HHCM with Documented HIV Status','High risk population of HHCM with Documented HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM with Documented HIV Status\n High risk population of HHCM with Documented HIV Status\n \n 2023-03-29 17:34:59 UTC\n \n 2023-03-29 17:36:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1929\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 19:34:59',4,'2023-03-29 19:36:32',4,0,NULL,NULL,NULL,'12a86c02-9e39-4d69-8082-ecff9269d106'),(1930,'Miners with Documented HIV Status','High risk population of miners with documented HIV','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Miners with Documented HIV Status\n High risk population of miners with documented HIV\n \n 2023-03-29 17:39:04 UTC\n \n 2023-03-29 17:42:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1930\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 19:39:04',4,'2023-03-29 19:42:27',4,0,NULL,NULL,NULL,'625cc3fd-4dc5-4aee-9fba-2559b31470c8'),(1931,'Public transport operators with Documented HIV Status','High risk population of Public transport operators with Documented HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Public transport operators with Documented HIV Status\n High risk population of Public transport operators with Documented HIV Status\n \n 2023-03-29 19:32:07 UTC\n \n 2023-03-29 19:33:35 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1931\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 21:32:07',4,'2023-03-29 21:33:35',4,0,NULL,NULL,NULL,'9e48b5ef-99df-44e7-8946-2728727e08a1'),(1932,'Retreatment with documented HIV status','Retreatment Excl. Relapse client with documented HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Retreatment with documented HIV status\n Retreatment Excl. Relapse client with documented HIV Status\n \n 2023-03-29 19:35:36 UTC\n \n 2023-03-29 19:36:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1932\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 21:35:36',4,'2023-03-29 21:36:55',4,0,NULL,NULL,NULL,'5cc834ec-7c90-4063-b684-2c9da8ddc83e'),(1933,'Children < 15 with Positive HIV Status','High risk population for Children < 15 with Positive HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children < 15 with Positive HIV Status\n High risk population for Children < 15 with Positive HIV Status\n \n 2023-03-29 19:40:57 UTC\n \n 2023-03-29 19:42:25 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1933\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 21:40:57',4,'2023-03-29 21:42:25',4,0,NULL,NULL,NULL,'9ceb1ec0-0b28-49d8-a6ba-90297cae2968'),(1934,'Correctional Staff and inmates with Positive HIV Status',' High risk population of Correctional Staff and inmates with Positive HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Correctional Staff and inmates with Positive HIV Status\n High risk population of Correctional Staff and inmates with Positive HIV Status\n \n 2023-03-29 19:44:28 UTC\n \n 2023-03-29 19:45:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1934\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 21:44:28',4,'2023-03-29 21:45:44',4,0,NULL,NULL,NULL,'c9be5185-942d-41ae-8e15-c3ddea7bb22f'),(1935,'Ex-Miners with Positive HIV Status','High risk population of Ex Miners with Positive HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Ex-Miners with Positive HIV Status\n High risk population of Ex Miners with Positive HIV Status\n \n 2023-03-29 19:47:14 UTC\n \n 2023-03-29 19:50:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1935\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 21:47:14',4,'2023-03-29 21:50:01',4,0,NULL,NULL,NULL,'51933c5f-9020-417a-91fe-77cb0412d9ee'),(1936,'Factory Workers with Positive HIV Status','High risk population of Factory Workers with Positive HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Factory Workers with Positive HIV Status\n High risk population of Factory Workers with Positive HIV Status\n \n 2023-03-29 19:52:48 UTC\n \n 2023-03-29 19:56:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1936\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 21:52:48',4,'2023-03-29 21:56:43',4,0,NULL,NULL,NULL,'a72725b5-eac8-4f97-b285-3a9db174ab39'),(1937,'Health workers with Positive HIV Status',' High risk population of Health workers with Positive HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Health workers with Positive HIV Status\n High risk population of Health workers with Positive HIV Status\n \n 2023-03-29 19:59:20 UTC\n \n 2023-03-29 20:04:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1937\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 21:59:20',4,'2023-03-29 22:04:12',4,0,NULL,NULL,NULL,'317c0cce-c0d7-44da-9272-62cc9279a76c'),(1938,'HHCM with Positive HIV Status',' High risk population of HHCM with Positive HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM with Positive HIV Status\n High risk population of HHCM with Positive HIV Status\n \n 2023-03-29 20:05:19 UTC\n \n 2023-03-29 20:09:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1938\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 22:05:19',4,'2023-03-29 22:09:51',4,0,NULL,NULL,NULL,'7a7dee7e-a318-4819-96e9-a1c8fe3e0a4f'),(1939,'HHXM with Positive HIV Status','High risk population of HHXM with Positive HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM with Positive HIV Status\n High risk population of HHXM with Positive HIV Status\n \n 2023-03-29 20:10:54 UTC\n \n 2023-03-29 20:11:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1939\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 22:10:54',4,'2023-03-29 22:11:59',4,0,NULL,NULL,NULL,'4a4bc063-3233-4b3f-9776-8949a2a3104c'),(1940,'Miners with Positive HIV Status','High risk population of miners with Positive HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Miners with Positive HIV Status\n High risk population of miners with Positive HIV Status\n \n 2023-03-29 20:13:09 UTC\n \n 2023-03-29 20:15:52 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1940\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 22:13:09',4,'2023-03-29 22:15:52',4,0,NULL,NULL,NULL,'a555cd0b-41bf-4ba0-bc0a-bb84952305d7'),(1941,'New and Relapse with Positive HIV Status','New and Relapse with Positive HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n New and Relapse with Positive HIV Status\n New and Relapse with Positive HIV Status\n \n 2023-03-29 20:17:12 UTC\n \n 2023-03-29 20:37:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1941\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 22:17:12',4,'2023-03-29 22:37:39',4,0,NULL,NULL,NULL,'5212b24d-abdf-416a-812e-72b4f64b342d'),(1942,'Public transport with Positive HIV Status','High risk population of Public transport operators with Positive HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Public transport with Positive HIV Status\n High risk population of Public transport operators with Positive HIV Status\n \n 2023-03-29 20:38:50 UTC\n \n 2023-03-29 20:39:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1942\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 22:38:50',4,'2023-03-29 22:39:44',4,0,NULL,NULL,NULL,'3ada2309-e8f6-4301-ae89-63837fb6f36b'),(1943,'Retreatment with Positive HIV status','Retreatment Excl. Relapse with Positive HIV status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Retreatment with Positive HIV status\n Retreatment Excl. Relapse with Positive HIV status\n \n 2023-03-29 20:41:12 UTC\n \n 2023-03-29 20:42:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1943\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 22:41:12',4,'2023-03-29 22:42:06',4,0,NULL,NULL,NULL,'ee1b5901-9777-44c1-affd-37e3aba4746a'),(1944,'Children < 15 with HIV Positive on ART','High risk population for Children < 15 with HIV Positive on ART','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children < 15 with HIV Positive on ART\n High risk population for Children < 15 with HIV Positive on ART\n \n 2023-03-29 20:43:47 UTC\n \n 2023-03-29 20:55:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1944\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 22:43:47',4,'2023-03-29 22:55:26',4,0,NULL,NULL,NULL,'f636be9d-0527-4054-9822-6ab005267560'),(1945,'Correctional Staff and inmates on HIV Positive on ART','High risk population of Correctional Staff and inmates on HIV Positive on ART','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Correctional Staff and inmates on HIV Positive on ART\n High risk population of Correctional Staff and inmates on HIV Positive on ART\n \n 2023-03-29 20:56:54 UTC\n \n 2023-03-29 20:59:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1945\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 22:56:54',4,'2023-03-29 22:59:44',4,0,NULL,NULL,NULL,'2c07cd7e-cc23-4974-9964-602e576ef80d'),(1946,'Ex Miner with with HIV Positive on ART','High risk population of Ex Miner with with HIV Positive on ART','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Ex Miner with with HIV Positive on ART\n High risk population of Ex Miner with with HIV Positive on ART\n \n 2023-03-29 21:01:08 UTC\n \n 2023-03-29 21:05:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1946\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 23:01:08',4,'2023-03-29 23:05:53',4,0,NULL,NULL,NULL,'8df71093-9cb8-4d1d-9885-fb4415f8c1b2'),(1947,'Factory Workers with HIV Positive on ART','High risk population of Factory Workers with HIV Positive on ART','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Factory Workers with HIV Positive on ART\n High risk population of Factory Workers with HIV Positive on ART\n \n 2023-03-29 21:07:39 UTC\n \n 2023-03-29 21:11:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1947\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 23:07:39',4,'2023-03-29 23:11:51',4,0,NULL,NULL,NULL,'6d1a75ee-e860-483d-ad80-4308d1009c22'),(1948,'Health workers with HIV Positive on ART',' High risk population of Health workers with HIV Positive on ART','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Health workers with HIV Positive on ART\n High risk population of Health workers with HIV Positive on ART\n \n 2023-03-29 21:13:26 UTC\n \n 2023-03-29 21:17:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1948\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 23:13:26',4,'2023-03-29 23:17:08',4,0,NULL,NULL,NULL,'b3813228-7114-4e37-b997-6acebccd724a'),(1949,'HHCM with with HIV Positive on ART','High risk population of HHCM with with HIV Positive on ART','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM with with HIV Positive on ART\n High risk population of HHCM with with HIV Positive on ART\n \n 2023-03-29 21:18:20 UTC\n \n 2023-03-29 21:19:22 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1949\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 23:18:20',4,'2023-03-29 23:19:22',4,0,NULL,NULL,NULL,'360494e1-ccad-4e72-bf80-c564f2cfe18b'),(1950,'HHXM with HIV Positive on ART','High risk population of HHXM with HIV Positive on ART','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM with HIV Positive on ART\n High risk population of HHXM with HIV Positive on ART\n \n 2023-03-29 21:20:51 UTC\n \n 2023-03-29 21:25:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1950\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 23:20:51',4,'2023-03-29 23:25:50',4,0,NULL,NULL,NULL,'ce4eaae7-7985-4e89-ab65-3b0c1686f80e'),(1951,'Miners with HIV Positive on ART','High risk population of Miners with HIV Positive on ART','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Miners with HIV Positive on ART\n High risk population of Miners with HIV Positive on ART\n \n 2023-03-29 21:27:27 UTC\n \n 2023-03-29 21:30:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1951\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 23:27:27',4,'2023-03-29 23:30:27',4,0,NULL,NULL,NULL,'19d13a38-7625-4136-b870-a7facc92ecb3'),(1952,'New and Relapse with HIV Positive on ART','High risk population of New and Relapse with HIV Positive on ART','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n New and Relapse with HIV Positive on ART\n High risk population of New and Relapse with HIV Positive on ART\n \n 2023-03-29 21:33:41 UTC\n \n 2023-03-29 21:36:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1952\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 23:33:41',4,'2023-03-29 23:36:00',4,0,NULL,NULL,NULL,'86db5b09-049a-4be4-a35f-f02f9de644f6'),(1953,'Public transport operators with HIV Positive on ART','High risk population of Public transport operators with HIV Positive on ART','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Public transport operators with HIV Positive on ART\n High risk population of Public transport operators with HIV Positive on ART\n \n 2023-03-29 21:37:07 UTC\n \n 2023-03-29 21:38:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1953\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 23:37:07',4,'2023-03-29 23:38:05',4,0,NULL,NULL,NULL,'ebbb00b2-3779-47b8-8265-c8afea8a5ac1'),(1954,'Retreatment with HIV Positive on ART','High risk population of Retreatment Excl. Relapse HIV Positive on ART','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Retreatment with HIV Positive on ART\n High risk population of Retreatment Excl. Relapse HIV Positive on ART\n \n 2023-03-29 21:39:16 UTC\n \n 2023-03-29 21:40:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1954\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 23:39:16',4,'2023-03-29 23:40:08',4,0,NULL,NULL,NULL,'2ffdb12c-d02b-4e9a-a1dc-6e4974093b5a'),(1955,'Children < 15 with Positive HIV on CPT/Dapzone','Children < 15 with Positive HIV on CPT/Dapzone','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children < 15 with Positive HIV on CPT/Dapzone\n Children < 15 with Positive HIV on CPT/Dapzone\n \n 2023-03-29 21:44:42 UTC\n \n 2023-03-29 21:47:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1955\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 23:44:42',4,'2023-03-29 23:47:53',4,0,NULL,NULL,NULL,'78313782-541c-4568-956c-9fb7bf92c08b'),(1956,'Correctional Staff and inmates with HIV Positive on CPT/Dapzone','High risk population of Correctional Staff and inmates with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Correctional Staff and inmates with HIV Positive on CPT/Dapzone\n High risk population of Correctional Staff and inmates with HIV Positive on CPT/Dapzone\n \n 2023-03-29 21:54:08 UTC\n \n 2023-03-29 21:56:48 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1956\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 23:54:08',4,'2023-03-29 23:56:48',4,0,NULL,NULL,NULL,'46e76f2a-4fc0-40cf-be9d-61565edbe566'),(1957,'Ex Miner with HIV Positive on CPT/Dapzone','High risk population of Ex Miner with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Ex Miner with HIV Positive on CPT/Dapzone\n High risk population of Ex Miner with HIV Positive on CPT/Dapzone\n \n 2023-03-29 21:58:20 UTC\n \n 2023-03-29 21:59:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1957\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 23:58:20',4,'2023-03-29 23:59:20',4,0,NULL,NULL,NULL,'348df991-95e1-4724-8df6-e4d905d67b11'),(1958,'Factory Workers with HIV Positive on CPT/Dapzone','High risk population of Factory Workers with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Factory Workers with HIV Positive on CPT/Dapzone\n High risk population of Factory Workers with HIV Positive on CPT/Dapzone\n \n 2023-03-29 22:00:58 UTC\n \n 2023-03-29 22:02:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1958\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-30 00:00:58',4,'2023-03-30 00:02:05',4,0,NULL,NULL,NULL,'5ce50877-ee92-48de-bfa7-a863b735975e'),(1959,'Health workers with HIV Positive on CPT/Dapzone','High risk population of Health workers with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Health workers with HIV Positive on CPT/Dapzone\n High risk population of Health workers with HIV Positive on CPT/Dapzone\n \n 2023-03-29 22:03:33 UTC\n \n 2023-03-29 22:06:16 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1959\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-30 00:03:33',4,'2023-03-30 00:06:16',4,0,NULL,NULL,NULL,'e47447de-6a64-422f-abe3-c281d2b4431c'),(1960,'HHCM with HIV Positive on CPT/Dapzone','High risk population of HHCM with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM with HIV Positive on CPT/Dapzone\n High risk population of HHCM with HIV Positive on CPT/Dapzone\n \n 2023-03-29 22:08:00 UTC\n \n 2023-03-29 22:09:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1960\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-30 00:08:00',4,'2023-03-30 00:09:04',4,0,NULL,NULL,NULL,'02d9a185-dc0e-4852-8176-c4da69705d5d'),(1961,'HHXM with HIV Positive on CPT/Dapzone','High risk population of HHXM with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM with HIV Positive on CPT/Dapzone\n High risk population of HHXM with HIV Positive on CPT/Dapzone\n \n 2023-03-29 22:10:38 UTC\n \n 2023-03-29 22:11:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1961\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-30 00:10:38',4,'2023-03-30 00:11:51',4,0,NULL,NULL,NULL,'c86cc664-d513-4afe-97b9-8163b4bb39d1'),(1962,'Miners with HIV Positive on CPT/Dapzone','High risk population Miners with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Miners with HIV Positive on CPT/Dapzone\n High risk population Miners with HIV Positive on CPT/Dapzone\n \n 2023-03-29 22:13:17 UTC\n \n 2023-03-29 22:15:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1962\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-30 00:13:17',4,'2023-03-30 00:15:15',4,0,NULL,NULL,NULL,'7751e110-9e34-453e-bd9f-792272cbd895'),(1963,'New and Relapse with HIV Positive on CPT/Dapzone','High risk population of New and Relapse with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n New and Relapse with HIV Positive on CPT/Dapzone\n High risk population of New and Relapse with HIV Positive on CPT/Dapzone\n \n 2023-03-29 22:16:42 UTC\n \n 2023-03-29 22:18:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1963\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-30 00:16:42',4,'2023-03-30 00:18:40',4,0,NULL,NULL,NULL,'2ebc8503-89e4-41f4-bdaf-e9e1d041a147'),(1964,'Public transport operators with HIV Positive on CPT/Dapzone','High risk population of Public transport operators with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Public transport operators with HIV Positive on CPT/Dapzone\n High risk population of Public transport operators with HIV Positive on CPT/Dapzone\n \n 2023-03-30 08:39:11 UTC\n \n 2023-03-30 08:40:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1964\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-30 10:39:11',4,'2023-03-30 10:40:29',4,0,NULL,NULL,NULL,'575068b5-f0ca-4d5b-8181-663b5feded65'),(1965,'Retreatment with HIV Positive on CPT/Dapzone','Retreatment Excl. Relapse with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Retreatment with HIV Positive on CPT/Dapzone\n Retreatment Excl. Relapse with HIV Positive on CPT/Dapzone\n \n 2023-03-30 08:41:45 UTC\n \n 2023-03-30 08:48:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1965\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-30 10:41:45',4,'2023-03-30 10:48:08',4,0,NULL,NULL,NULL,'22dbd0dd-a4ca-42a5-986e-6c0012eb55b1'),(1966,'HHXM with Documented HIV Status','High risk population of HHXM with Documented HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM with Documented HIV Status\n High risk population of HHXM with Documented HIV Status\n \n 2023-03-30 09:03:54 UTC\n \n 2023-03-30 09:06:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1966\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-30 11:03:54',4,'2023-03-30 11:06:14',4,0,NULL,NULL,NULL,'e5de47f6-aa7a-4b2d-bd72-83e5458977d6'),(1967,'TB Notification - Block 4','TB Notification - Block 4','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Notification - Block 4\n TB Notification - Block 4\n \n 2023-03-30 09:18:19 UTC\n \n 2023-03-30 20:54:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1967\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-03-30 11:18:19',4,'2023-03-30 22:54:40',4,0,NULL,NULL,NULL,'0b9affca-ad93-42fb-bd49-57380f721a08'),(1968,'TBNotification - Block 4 Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TBNotification - Block 4 Data Set\n \n 2023-03-30 09:18:47 UTC\n \n 2023-03-30 20:50:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1968\n \n \n DM_Sex\n \n \n \n \n \n \n \n \n ARTChild_F\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n \n \n \n ARTChild_M\n \n \n \n \n DM_Sex\n Males\n \n \n \n \n \n ARTCo&In_F\n \n \n \n \n \n \n \n \n \n ARTCo&In_M\n \n \n \n \n \n \n ARTFacW_F\n \n \n \n \n \n \n \n \n \n ARTFacW_M\n \n \n \n \n \n \n ARTHHCM_F\n \n \n \n \n \n \n \n \n \n ARTHHCM_M\n \n \n \n \n \n \n ARTHHXM_F\n \n \n \n \n \n \n \n \n \n ARTHHXM_M\n \n \n \n \n \n \n ARTHeaW_F\n \n \n \n \n \n \n \n \n \n ARTHeaW_M\n \n \n \n \n \n \n ARTMiner_F\n \n \n \n \n \n \n \n \n \n ARTMiner_M\n \n \n \n \n \n \n ARTNw&Rl_F\n \n \n \n \n \n \n \n \n \n ARTNw&Rl_M\n \n \n \n \n \n \n ARTRetr_F\n \n \n \n \n \n \n \n \n \n ARTRetr_M\n \n \n \n \n \n \n ARTTrans_F\n \n \n \n \n \n \n \n \n \n ARTTrans_M\n \n \n \n \n \n \n ARTXMine_F\n \n \n \n \n \n \n \n \n \n ARTXMine_M\n \n \n \n \n \n \n DapChild_F\n \n \n \n \n \n \n \n \n \n DapChild_M\n \n \n \n \n \n \n DapCo&In_F\n \n \n \n \n \n \n \n \n \n DapCo&In_M\n \n \n \n \n \n \n DapFacW_F\n \n \n \n \n \n \n \n \n \n DapFacW_M\n \n \n \n \n \n \n DapHHCM_F\n \n \n \n \n \n \n \n \n \n DapHHCM_M\n \n \n \n \n \n \n DapHHXM_F\n \n \n \n \n \n \n \n \n \n DapHHXM_M\n \n \n \n \n \n \n DapHeaW_F\n \n \n \n \n \n \n \n \n \n DapHeaW_M\n \n \n \n \n \n \n DapMiner_F\n \n \n \n \n \n \n \n \n \n DapMiner_M\n \n \n \n \n \n \n DapNw&Rl_F\n \n \n \n \n \n \n \n \n \n DapNw&Rl_M\n \n \n \n \n \n \n DapRetre_F\n \n \n \n \n \n \n \n \n \n DapRetre_M\n \n \n \n \n \n \n DapTrans_F\n \n \n \n \n \n \n \n \n \n DapTrans_M\n \n \n \n \n \n \n DapXMine_F\n \n \n \n \n \n \n \n \n \n DapXMine_M\n \n \n \n \n \n \n PosChild_F\n \n \n \n \n \n \n \n \n \n PosChild_M\n \n \n \n \n \n \n PosCo&In_F\n \n \n \n \n \n \n \n \n \n PosCo&In_M\n \n \n \n \n \n \n PosFacW_F\n \n \n \n \n \n \n \n \n \n PosFacW_M\n \n \n \n \n \n \n PosHHCM_F\n \n \n \n \n \n \n \n \n \n PosHHCM_M\n \n \n \n \n \n \n PosHHXM_F\n \n \n \n \n \n \n \n \n \n PosHHXM_M\n \n \n \n \n \n \n PosHeaW_F\n \n \n \n \n \n \n \n \n \n PosHeaW_M\n \n \n \n \n \n \n PosMiner_F\n \n \n \n \n \n \n \n \n \n PosMiner_M\n \n \n \n \n \n \n PosNw&Rs_F\n \n \n \n \n \n \n \n \n \n PosNw&Rs_M\n \n \n \n \n \n \n PosRetr_F\n \n \n \n \n \n \n \n \n \n PosRetr_M\n \n \n \n \n \n \n PosTrans_F\n \n \n \n \n \n \n \n \n \n PosTrans_M\n \n \n \n \n \n \n PosXMine_F\n \n \n \n \n \n \n \n \n \n PosXMine_M\n \n \n \n \n \n \n StsChild_F\n \n \n \n \n \n \n \n \n \n StsChild_M\n \n \n \n \n \n \n StsCo&In_F\n \n \n \n \n \n \n \n \n \n StsCo&In_M\n \n \n \n \n \n \n StsFacW_F\n \n \n \n \n \n \n \n \n \n StsFacW_M\n \n \n \n \n \n \n StsHHCM_F\n \n \n \n \n \n \n \n \n \n StsHHCM_M\n \n \n \n \n \n \n StsHHXM_F\n \n \n \n \n \n \n \n \n \n StsHHXM_M\n \n \n \n \n \n \n StsHeaW_F\n \n \n \n \n \n \n \n \n \n StsHeaW_M\n \n \n \n \n \n \n StsMin_F\n \n \n \n \n \n \n \n \n \n StsMin_M\n \n \n \n \n \n \n StsNw&Rs_F\n \n \n \n \n \n \n \n \n \n StsNw&Rs_M\n \n \n \n \n \n \n StsRetre_F\n \n \n \n \n \n \n \n \n \n StsRetre_M\n \n \n \n \n \n \n StsTrans_F\n \n \n \n \n \n \n \n \n \n StsTrans_M\n \n \n \n \n \n \n StsXMin_F\n \n \n \n \n \n \n \n \n \n StsXMin_M\n \n \n \n \n \n \n','2023-03-30 11:18:47',4,'2023-03-30 22:50:08',4,0,NULL,NULL,NULL,'e08d273c-ba6d-4085-bf72-b7f6737396bf'),(1969,'TB_OUTCOMES','TB Outcomes','org.openmrs.module.reporting.indicator.dimension.Dimension','org.openmrs.module.reporting.indicator.dimension.CohortDefinitionDimension','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB_OUTCOMES\n TB Outcomes\n \n 2023-03-30 13:48:45 UTC\n \n 2023-03-30 14:06:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1969\n \n \n Competed\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-03-30 15:48:45',4,'2023-03-30 16:06:44',4,0,NULL,NULL,NULL,'2244b6f7-5dd0-4c8a-8a9e-67bac3fe7d9b'),(1970,'test','test','org.openmrs.module.reporting.indicator.dimension.Dimension','org.openmrs.module.reporting.indicator.dimension.CohortDefinitionDimension','org.openmrs.module.reporting.serializer.ReportingSerializer','\n test\n test\n \n 2023-03-30 14:06:01 UTC\n \n \n','2023-03-30 16:06:01',4,NULL,NULL,0,NULL,NULL,NULL,'a572d104-f644-42bb-ae58-7c83ac0747ad'),(1971,'TB New and Relapse Completed','TB New and Relapse Completed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB New and Relapse Completed\n TB New and Relapse Completed\n \n 2023-03-30 14:58:43 UTC\n \n 2023-03-30 14:59:47 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1971\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- TB History of previous treatment \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3785 and o.value_coded in (1034,1084) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 2242 and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 16:58:43',4,'2023-03-30 16:59:47',4,0,NULL,NULL,NULL,'1540870d-551a-4e11-baad-70ed9b13289a'),(1972,'TB New and Relapse Cured','TB New and Relapse Cured','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB New and Relapse Cured\n TB New and Relapse Cured\n \n 2023-03-30 15:04:42 UTC\n \n 2023-03-30 15:06:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1972\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- TB History of previous treatment(New AND Relapse) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3785 and o.value_coded in (1034,1084) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 1068 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 17:04:42',4,'2023-03-30 17:06:17',4,0,NULL,NULL,NULL,'22e1906b-16cd-4109-b529-a043e43ff3d4'),(1973,'TB New and Relapse Died','TB New and Relapse Died','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB New and Relapse Died\n TB New and Relapse Died\n \n 2023-03-30 15:08:32 UTC\n \n 2023-03-30 15:09:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1973\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- TB History of previous treatment(New AND Relapse) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3785 and o.value_coded in (1034,1084) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3650 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 17:08:32',4,'2023-03-30 17:09:15',4,0,NULL,NULL,NULL,'19636929-afd0-4ba0-acfa-bbe325e1f002'),(1974,'TB New and Relapse Lost to Follow-up','TB New and Relapse Lost to Follow-up','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB New and Relapse Lost to Follow-up\n TB New and Relapse Lost to Follow-up\n \n 2023-03-30 15:10:23 UTC\n \n 2023-03-30 15:10:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1974\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- TB History of previous treatment(New AND Relapse) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3785 and o.value_coded in (1034,1084) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 2302 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 17:10:23',4,'2023-03-30 17:10:58',4,0,NULL,NULL,NULL,'87260731-779f-4244-9480-f75169dd2fbf'),(1975,'TB New and Relapse Failed (Susceptible)','TB New and Relapse Failed (Susceptible)','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB New and Relapse Failed (Susceptible)\n TB New and Relapse Failed (Susceptible)\n \n 2023-03-30 15:11:55 UTC\n \n 2023-03-30 15:31:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1975\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- TB History of previous treatment(New AND Relapse) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3785 and o.value_coded in (1034,1084) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3793 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 17:11:55',4,'2023-03-30 17:31:39',4,0,NULL,NULL,NULL,'53aec520-fab0-4871-b46f-209c32b921c1'),(1976,'TB New and Relapse Not Evaluated','TB New and Relapse Not Evaluated','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB New and Relapse Not Evaluated\n TB New and Relapse Not Evaluated\n \n 2023-03-30 15:13:29 UTC\n \n 2023-03-30 16:05:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1976\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- TB History of previous treatment(New AND Relapse) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3785 and o.value_coded in (1034,1084) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id not in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded in (1068,2242,3650,2302,3793,3794) \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 17:13:29',4,'2023-03-30 18:05:12',4,0,NULL,NULL,NULL,'0af163fd-0d3c-4b6a-a84e-1648cd9bb042'),(1977,'exMiner_cured','Ex miner cured','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n exMiner_cured\n Ex miner cured\n \n 2023-03-30 15:21:40 UTC\n \n 2023-03-30 15:47:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1977\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3668 \n and ob.voided = 0 \n ) \n and o.person_id in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded = 1068 \n and b.voided = 0 \n ) \n\n','2023-03-30 17:21:40',4,'2023-03-30 17:47:23',4,0,NULL,NULL,NULL,'4c2c88ec-ee4e-4bad-962d-229983982f12'),(1978,'exMiner_completed','Ex miner completed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n exMiner_completed\n Ex miner completed\n \n 2023-03-30 15:24:54 UTC\n \n 2023-03-30 15:45:56 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1978\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3668 \n and ob.voided = 0 \n ) \n and o.person_id in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded = 2242 \n and b.voided = 0 \n ) \n\n','2023-03-30 17:24:54',4,'2023-03-30 17:45:56',4,0,NULL,NULL,NULL,'37afe774-0ef1-4152-8ab9-fe702f175f36'),(1979,'exMiner_died','Ex Miner died','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n exMiner_died\n Ex Miner died\n \n 2023-03-30 15:28:17 UTC\n \n 2023-04-03 07:35:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1979\n select distinct o.person_id \n \n \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3668 \n and ob.voided = 0 \n ) \n and o.person_id in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded = 3650 and b.voided = 0 \n ) \n\n','2023-03-30 17:28:17',4,'2023-04-03 09:35:05',4,0,NULL,NULL,NULL,'d08b3fb0-d1c2-455d-89a6-f3c9a1469a3e'),(1980,'TB New and Relapse Completed Moved to second line treatment','TB New and Relapse Completed Moved to second line treatment','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB New and Relapse Completed Moved to second line treatment\n TB New and Relapse Completed Moved to second line treatment\n \n 2023-03-30 15:33:00 UTC\n \n 2023-03-30 15:33:47 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1980\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- TB History of previous treatment(New AND Relapse) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3785 and o.value_coded in (1034,1084) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3794 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 17:33:00',4,'2023-03-30 17:33:47',4,0,NULL,NULL,NULL,'d2ff18e1-1cf3-4bff-9796-e35aaf019b40'),(1981,'exMiner_failedSusceptive','Ex miner failed suceptive','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n exMiner_failedSusceptive\n Ex miner failed suceptive\n \n 2023-03-30 15:40:13 UTC\n \n 2023-04-03 10:56:48 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1981\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3668 \n and ob.voided = 0 \n ) \n and o.person_id in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded = 3793 \n and b.voided = 0 \n ) \n\n','2023-03-30 17:40:13',4,'2023-04-03 12:56:48',4,0,NULL,NULL,NULL,'8c7c6720-c1aa-492a-be1b-47edc57cfd55'),(1982,'exMiner_lost','Ex miner lost','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n exMiner_lost\n Ex miner lost\n \n 2023-03-30 15:42:32 UTC\n \n 2023-03-30 15:49:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1982\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3668 \n and ob.voided = 0 \n ) \n and o.person_id in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded = 2302 \n and b.voided = 0 \n ) \n\n','2023-03-30 17:42:32',4,'2023-03-30 17:49:29',4,0,NULL,NULL,NULL,'cb57dd5b-22ae-42d9-a86a-6927e9aae9cb'),(1983,'TB Retreatment excluding Relapse and Completed','TB Retreatment excluding Relapse and Completed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Retreatment excluding Relapse and Completed\n TB Retreatment excluding Relapse and Completed\n \n 2023-03-30 15:43:38 UTC\n \n 2023-03-30 15:44:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1983\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- TB History of previous treatment(Retreatment Excluding Relapse) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3785 and o.value_coded in (3786,1037) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 2242 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 17:43:38',4,'2023-03-30 17:44:32',4,0,NULL,NULL,NULL,'93eefc43-0eba-4a27-8d7e-72958dc0b2f1'),(1984,'exMiner_movedSecondLIne','Ex miner moved to second line','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n exMiner_movedSecondLIne\n Ex miner moved to second line\n \n 2023-03-30 15:44:13 UTC\n \n 2023-03-30 15:44:34 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1984\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3668 \n and ob.voided = 0 \n ) \n and o.person_id in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded = 3794 \n and b.voided = 0 \n ) \n\n','2023-03-30 17:44:13',4,'2023-03-30 17:44:34',4,0,NULL,NULL,NULL,'846e0252-747b-4457-b0f4-6f23ed244706'),(1985,'TB Retreatment excluding Relapse and Cured','TB Retreatment excluding Relapse and Cured','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Retreatment excluding Relapse and Cured\n TB Retreatment excluding Relapse and Cured\n \n 2023-03-30 15:45:00 UTC\n \n 2023-03-30 15:45:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1985\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- TB History of previous treatment(Retreatment Excluding Relapse) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3785 and o.value_coded in (3786,1037) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 1068 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 17:45:00',4,'2023-03-30 17:45:29',4,0,NULL,NULL,NULL,'1cd8596a-21ba-4a7b-b3c6-c82fb756bf8f'),(1986,'TB Retreatment excluding Relapse and Died','TB Retreatment excluding Relapse and Died','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Retreatment excluding Relapse and Died\n TB Retreatment excluding Relapse and Died\n \n 2023-03-30 15:45:57 UTC\n \n 2023-03-30 15:46:22 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1986\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- TB History of previous treatment(Retreatment Excluding Relapse) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3785 and o.value_coded in (3786,1037) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3650 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 17:45:57',4,'2023-03-30 17:46:22',4,0,NULL,NULL,NULL,'50001a13-545a-4de2-9617-86c8b262eb9d'),(1987,'TB Retreatment excluding Relapse and Lost to Follow up','TB Retreatment excluding Relapse and Lost to Follow up','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Retreatment excluding Relapse and Lost to Follow up\n TB Retreatment excluding Relapse and Lost to Follow up\n \n 2023-03-30 15:47:18 UTC\n \n 2023-03-30 15:47:57 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1987\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- TB History of previous treatment(Retreatment Excluding Relapse) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3785 and o.value_coded in (3786,1037) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 2302 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 17:47:18',4,'2023-03-30 17:47:57',4,0,NULL,NULL,NULL,'46fbbe80-0f0e-4cf5-8f4d-04444b70d3bc'),(1988,'TB Retreatment excluding Relapse and Failed (Susceptible)','TB Retreatment excluding Relapse and Failed (Susceptible)','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Retreatment excluding Relapse and Failed (Susceptible)\n TB Retreatment excluding Relapse and Failed (Susceptible)\n \n 2023-03-30 15:49:14 UTC\n \n 2023-03-30 15:49:46 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1988\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- TB History of previous treatment(Retreatment Excluding Relapse) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3785 and o.value_coded in (3786,1037) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3793 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 17:49:14',4,'2023-03-30 17:49:46',4,0,NULL,NULL,NULL,'0b97c9a2-f4f0-460c-9a6a-943f0d0b9bac'),(1989,'TB Retreatment excluding Relapse and Not Evaluated','TB Retreatment excluding Relapse and Not Evaluated','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Retreatment excluding Relapse and Not Evaluated\n TB Retreatment excluding Relapse and Not Evaluated\n \n 2023-03-30 15:51:27 UTC\n \n 2023-03-30 16:03:56 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1989\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- TB History of previous treatment(Retreatment Excluding Relapse) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3785 and o.value_coded in (3786,1037) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id not in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded in (1068,2242,3650,2302,3793,3794) \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 17:51:27',4,'2023-03-30 18:03:56',4,0,NULL,NULL,NULL,'36e8a6f3-f70c-4d36-ab76-87fba12b426b'),(1990,'exMiner_notEvaluated','Ex miner not evaluated','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n exMiner_notEvaluated\n Ex miner not evaluated\n \n 2023-03-30 15:53:42 UTC\n \n 2023-03-30 16:13:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1990\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3668 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2302,1068,2242,3650,3793,3794) \n and b.voided = 0 \n ) \n\n','2023-03-30 17:53:42',4,'2023-03-30 18:13:01',4,0,NULL,NULL,NULL,'af666d60-a3d1-4f0f-8ac2-1ea8fddbf8cd'),(1991,'FactoryWorker_notEvaluated','Factory worker not evaluated ','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n FactoryWorker_notEvaluated\n Factory worker not evaluated \n \n 2023-03-30 16:17:17 UTC\n \n 2023-03-30 16:18:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1991\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3669 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2302,1068,2242,3650,3793,3794) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:17:17',4,'2023-03-30 18:18:05',4,0,NULL,NULL,NULL,'83566c8a-550c-447e-9745-0df04c89de07'),(1992,'FactoryWorker_curred','Factory worker curred','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n FactoryWorker_curred\n Factory worker curred\n \n 2023-03-30 16:18:46 UTC\n \n 2023-03-30 16:19:13 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1992\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3669 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (1068) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:18:46',4,'2023-03-30 18:19:13',4,0,NULL,NULL,NULL,'40dd9f46-8d30-4426-bffd-0eb772046374'),(1993,'All TB HIV Pos and Completed ','All TB HIV Pos and Completed ','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Pos and Completed \n All TB HIV Pos and Completed \n \n 2023-03-30 16:19:51 UTC\n \n 2023-03-30 16:20:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1993\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All HIV Positives \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 4666 and o.value_coded in (4323,4664) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 2242 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:19:51',4,'2023-03-30 18:20:08',4,0,NULL,NULL,NULL,'6b7c8fdf-00e6-4f52-b0fe-fab2cd9cc15e'),(1994,'FactoryWorker_completed','Factory worker copleted','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n FactoryWorker_completed\n Factory worker copleted\n \n 2023-03-30 16:19:51 UTC\n \n 2023-03-30 16:20:13 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1994\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3669 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2242) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:19:51',4,'2023-03-30 18:20:13',4,0,NULL,NULL,NULL,'4fb972d7-5378-4413-8faf-e9dfc9454cd6'),(1995,'All TB HIV Pos and Cured','All TB HIV Pos and Cured','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Pos and Cured\n All TB HIV Pos and Cured\n \n 2023-03-30 16:20:26 UTC\n \n 2023-03-30 16:20:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1995\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All HIV Positives \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 4666 and o.value_coded in (4323,4664) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 1068 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:20:26',4,'2023-03-30 18:20:55',4,0,NULL,NULL,NULL,'5bd61f52-4224-4de9-82cd-2c6334f665b1'),(1996,'FactoryWorker_died','Factory worker died','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n FactoryWorker_died\n Factory worker died\n \n 2023-03-30 16:21:09 UTC\n \n 2023-03-30 16:21:24 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1996\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3669 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3650) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:21:09',4,'2023-03-30 18:21:24',4,0,NULL,NULL,NULL,'f4cf99eb-4bb4-45c0-a403-086fd4b51c44'),(1997,'All TB HIV Pos and Died','All TB HIV Pos and Died','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Pos and Died\n All TB HIV Pos and Died\n \n 2023-03-30 16:21:20 UTC\n \n 2023-03-30 16:21:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1997\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All HIV Positives \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 4666 and o.value_coded in (4323,4664) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3650 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:21:20',4,'2023-03-30 18:21:50',4,0,NULL,NULL,NULL,'b41362c1-57e7-48a0-99ed-a6241cd9fb3d'),(1998,'FactoryWorker_lost','Factort worker lost to follow up','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n FactoryWorker_lost\n Factort worker lost to follow up\n \n 2023-03-30 16:22:18 UTC\n \n 2023-03-30 16:22:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1998\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3669 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2302) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:22:18',4,'2023-03-30 18:22:39',4,0,NULL,NULL,NULL,'f915f74e-1e06-4639-9070-6d1fa301b432'),(1999,'All TB HIV Pos and Lost to Follow up','All TB HIV Pos and Lost to Follow up','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Pos and Lost to Follow up\n All TB HIV Pos and Lost to Follow up\n \n 2023-03-30 16:22:31 UTC\n \n 2023-03-30 16:22:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1999\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All HIV Positives \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 4666 and o.value_coded in (4323,4664) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 2302 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:22:31',4,'2023-03-30 18:22:58',4,0,NULL,NULL,NULL,'16efd94d-da75-4a5c-8ca9-6364f2fc8396'),(2000,'All TB HIV Pos and Failed (Susceptible)','All TB HIV Pos and Failed (Susceptible)','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Pos and Failed (Susceptible)\n All TB HIV Pos and Failed (Susceptible)\n \n 2023-03-30 16:23:33 UTC\n \n 2023-03-30 16:24:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2000\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All HIV Positives \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 4666 and o.value_coded in (4323,4664) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3793 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:23:33',4,'2023-03-30 18:24:00',4,0,NULL,NULL,NULL,'4dc42500-c285-4548-92ff-842d1b357342'),(2001,'prison_worker_lost','Prison worker lost','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n prison_worker_lost\n Prison worker lost\n \n 2023-03-30 16:24:03 UTC\n \n 2023-03-30 16:24:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2001\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3779 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2302) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:24:03',4,'2023-03-30 18:24:36',4,0,NULL,NULL,NULL,'624478ae-cc98-4b93-b138-4e619755b41a'),(2002,'All TB HIV Pos and Not Evaluated','All TB HIV Pos and Not Evaluated','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Pos and Not Evaluated\n All TB HIV Pos and Not Evaluated\n \n 2023-03-30 16:24:48 UTC\n \n 2023-03-30 16:26:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2002\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All HIV Positives \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 4666 and o.value_coded in (4323,4664) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id not in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded in (1068,2242,3650,2302,3793,3794) \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:24:48',4,'2023-03-30 18:26:26',4,0,NULL,NULL,NULL,'4fe00951-413a-468e-ac7e-016dcf41bed6'),(2003,'FactoryWorker_moved','Facotory worker moved to second line','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n FactoryWorker_moved\n Facotory worker moved to second line\n \n 2023-03-30 16:26:31 UTC\n \n 2023-03-30 16:34:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2003\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3669 \n and ob.voided = 0 \n ) \n and o.person_id in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3794) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:26:31',4,'2023-03-30 18:34:39',4,0,NULL,NULL,NULL,'1a7a972b-4113-414d-8810-46c8df8137e7'),(2004,'All TB HIV Pos and Moved to Secondline','All TB HIV Pos and Moved to Secondline','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Pos and Moved to Secondline\n All TB HIV Pos and Moved to Secondline\n \n 2023-03-30 16:27:16 UTC\n \n 2023-03-30 16:27:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2004\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All HIV Positives \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 4666 and o.value_coded in (4323,4664) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3794 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:27:16',4,'2023-03-30 18:27:43',4,0,NULL,NULL,NULL,'57ddf49d-b53d-48ce-a67d-3ce6398f3e2c'),(2005,'All TB HIV Neg and Completed','All TB HIV Neg and Completed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Neg and Completed\n All TB HIV Neg and Completed\n \n 2023-03-30 16:29:02 UTC\n \n 2023-03-30 16:30:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2005\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All HIV Negatives \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 4666 and o.value_coded in (4324,4665) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 2242 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:29:02',4,'2023-03-30 18:30:27',4,0,NULL,NULL,NULL,'63a92814-2f34-4018-b7d0-47659892369d'),(2006,'All TB HIV Neg and Cured','All TB HIV Neg and Cured','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Neg and Cured\n All TB HIV Neg and Cured\n \n 2023-03-30 16:30:51 UTC\n \n 2023-03-30 16:31:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2006\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All HIV Negatives \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 4666 and o.value_coded in (4324,4665) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 1068 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:30:51',4,'2023-03-30 18:31:17',4,0,NULL,NULL,NULL,'8e552272-4654-43bb-b1af-20affab2de14'),(2007,'All TB HIV Neg and Died','All TB HIV Neg and Died','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Neg and Died\n All TB HIV Neg and Died\n \n 2023-03-30 16:31:44 UTC\n \n 2023-03-30 16:32:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2007\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All HIV Negatives \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 4666 and o.value_coded in (4324,4665) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3650 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:31:44',4,'2023-03-30 18:32:11',4,0,NULL,NULL,NULL,'3463adc8-19aa-4cc0-9daf-32ea09e0c1f0'),(2008,'All TB HIV Neg and Lost to Follow up','All TB HIV Neg and Lost to Follow up','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Neg and Lost to Follow up\n All TB HIV Neg and Lost to Follow up\n \n 2023-03-30 16:32:59 UTC\n \n 2023-03-30 16:33:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2008\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All HIV Negatives \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 4666 and o.value_coded in (4324,4665) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 2302 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:32:59',4,'2023-03-30 18:33:27',4,0,NULL,NULL,NULL,'06a5ff53-1949-444e-80b5-f4c99b38d5b1'),(2009,'All TB HIV Neg and Failed (Susceptible)','All TB HIV Neg and Failed (Susceptible)','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Neg and Failed (Susceptible)\n All TB HIV Neg and Failed (Susceptible)\n \n 2023-03-30 16:34:17 UTC\n \n 2023-03-30 16:35:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2009\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All HIV Negatives \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 4666 and o.value_coded in (4324,4665) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3793 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:34:17',4,'2023-03-30 18:35:01',4,0,NULL,NULL,NULL,'2ac7e18e-061b-4b34-bb63-63a2ec622a2b'),(2010,'All TB HIV Neg and Not Evaluated','All TB HIV Neg and Not Evaluated','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Neg and Not Evaluated\n All TB HIV Neg and Not Evaluated\n \n 2023-03-30 16:35:36 UTC\n \n 2023-03-30 16:37:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2010\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All HIV Negatives \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 4666 and o.value_coded in (4324,4665) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id not in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded in (1068,2242,3650,2302,3793,3794) \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:35:36',4,'2023-03-30 18:37:02',4,0,NULL,NULL,NULL,'c78c5a10-a320-43ce-b943-f9286e22ad1e'),(2011,'prison_worker_moved','Prison worker moved to second line','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n prison_worker_moved\n Prison worker moved to second line\n \n 2023-03-30 16:35:49 UTC\n \n 2023-03-30 16:36:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2011\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3779 \n and ob.voided = 0 \n ) \n and o.person_id in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3794) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:35:49',4,'2023-03-30 18:36:29',4,0,NULL,NULL,NULL,'76d5be40-a7e3-4f4f-968a-0346d0bd6513'),(2012,'prison_worker_died','Prison worker died','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n prison_worker_died\n Prison worker died\n \n 2023-03-30 16:37:07 UTC\n \n 2023-03-30 16:37:38 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2012\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3776 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3650) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:37:07',4,'2023-03-30 18:37:38',4,0,NULL,NULL,NULL,'c9a54e7c-34d1-4a1b-9214-0b9fa6eb6976'),(2013,'All TB HIV Neg and Moved to Secondline Treatment','All TB HIV Neg and Moved to Secondline Treatment','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Neg and Moved to Secondline Treatment\n All TB HIV Neg and Moved to Secondline Treatment\n \n 2023-03-30 16:37:41 UTC\n \n 2023-03-30 16:38:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2013\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All HIV Negatives \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 4666 and o.value_coded in (4324,4665) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3794 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:37:41',4,'2023-03-30 18:38:53',4,0,NULL,NULL,NULL,'2de9ce1c-6a79-43fe-ab19-1b9c9d2865d4'),(2014,'prison_worker_completed','Prison worker completed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n prison_worker_completed\n Prison worker completed\n \n 2023-03-30 16:38:29 UTC\n \n 2023-03-30 16:38:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2014\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3776 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2242) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:38:29',4,'2023-03-30 18:38:53',4,0,NULL,NULL,NULL,'9e174142-2794-43fc-95dd-9f3f92e4b379'),(2015,'prison_worker_curred','Prion worker curred','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n prison_worker_curred\n Prion worker curred\n \n 2023-03-30 16:40:22 UTC\n \n 2023-03-30 16:43:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2015\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3776 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (1068) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:40:22',4,'2023-03-30 18:43:23',4,0,NULL,NULL,NULL,'91f85b53-7dca-4730-a391-5198293d1cf9'),(2016,'All Childred and Completed','All Childred and Completed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All Childred and Completed\n All Childred and Completed\n \n 2023-03-30 16:43:19 UTC\n \n 2023-03-30 16:46:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2016\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All Children \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) < 15 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 2242 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:43:19',4,'2023-03-30 18:46:26',4,0,NULL,NULL,NULL,'f300ef4e-70b5-4c81-b993-7d45d23f299e'),(2017,'prison_worker_notEvaluated','Prison worker not evaluated','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n prison_worker_notEvaluated\n Prison worker not evaluated\n \n 2023-03-30 16:46:21 UTC\n \n 2023-03-30 16:46:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2017\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3776 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2302,1068,2242,3650,3793,3794) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:46:21',4,'2023-03-30 18:46:41',4,0,NULL,NULL,NULL,'1c0c7eab-e438-4787-982a-bfb448fe7455'),(2018,'All Childred and Cured','All Childred and Cured','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All Childred and Cured\n All Childred and Cured\n \n 2023-03-30 16:46:51 UTC\n \n 2023-03-30 16:47:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2018\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All Children \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) < 15 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 1068 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:46:51',4,'2023-03-30 18:47:08',4,0,NULL,NULL,NULL,'1f8f36b9-85d6-4e32-b078-6c7e098974b1'),(2019,'All Childred and Died','All Childred and Died','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All Childred and Died\n All Childred and Died\n \n 2023-03-30 16:47:31 UTC\n \n 2023-03-30 16:48:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2019\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All Children \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) < 15 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3650 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:47:31',4,'2023-03-30 18:48:00',4,0,NULL,NULL,NULL,'dd4822a7-86eb-4579-acda-bf0ff242eef5'),(2020,'health_worker_notEvaluated','Health worker not evaluated','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n health_worker_notEvaluated\n Health worker not evaluated\n \n 2023-03-30 16:47:35 UTC\n \n 2023-03-30 16:48:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2020\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3667 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2302,1068,2242,3650,3793,3794) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:47:35',4,'2023-03-30 18:48:03',4,0,NULL,NULL,NULL,'5d8bdedf-fc1e-46f8-b417-908519f3e645'),(2021,'All Childred and Lost to Follow up','All Childred and Lost to Follow up','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All Childred and Lost to Follow up\n All Childred and Lost to Follow up\n \n 2023-03-30 16:48:38 UTC\n \n 2023-03-30 16:49:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2021\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All Children \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) < 15 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 2302 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:48:38',4,'2023-03-30 18:49:04',4,0,NULL,NULL,NULL,'2665ef1b-edbd-4c9d-b9f6-3d2d2cc3b0ad'),(2022,'health_worker_curred','Health worker curred','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n health_worker_curred\n Health worker curred\n \n 2023-03-30 16:48:53 UTC\n \n 2023-03-30 16:49:19 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2022\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3667 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (1068) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:48:53',4,'2023-03-30 18:49:19',4,0,NULL,NULL,NULL,'63064b04-2cce-4944-b53d-ddb2cdce8a2d'),(2023,'All Childred and Failed (Susceptible)','All Childred and Failed (Susceptible)','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All Childred and Failed (Susceptible)\n All Childred and Failed (Susceptible)\n \n 2023-03-30 16:49:34 UTC\n \n 2023-03-30 16:50:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2023\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All Children \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) < 15 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3793 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:49:34',4,'2023-03-30 18:50:01',4,0,NULL,NULL,NULL,'1b710ad4-75b5-4b64-b916-1806dca0013d'),(2024,'health_worker_completed','Health worker completed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n health_worker_completed\n Health worker completed\n \n 2023-03-30 16:49:56 UTC\n \n 2023-04-03 20:37:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2024\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3667 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2242) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:49:56',4,'2023-04-03 22:37:45',4,0,NULL,NULL,NULL,'6555808c-1103-4a6d-b13f-fd0fad7ff09f'),(2025,'All Childred and Not evaluated','All Childred and Not evaluated','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All Childred and Not evaluated\n All Childred and Not evaluated\n \n 2023-03-30 16:50:30 UTC\n \n 2023-03-30 16:51:54 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2025\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All Children \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) < 15 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id not in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded in (1068,2242,3650,2302,3794,3793) \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:50:30',4,'2023-03-30 18:51:54',4,0,NULL,NULL,NULL,'1b9b16cf-f254-43b5-b952-4d54f431ae49'),(2026,'health_worker_died','Healh worker died','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n health_worker_died\n Healh worker died\n \n 2023-03-30 16:50:46 UTC\n \n 2023-03-30 16:51:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2026\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3667 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3650) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:50:46',4,'2023-03-30 18:51:00',4,0,NULL,NULL,NULL,'e9c9f85f-123c-4b2f-9951-7b8c2be340af'),(2027,'health_worker_lost','Health worker lost','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n health_worker_lost\n Health worker lost\n \n 2023-03-30 16:51:39 UTC\n \n 2023-03-30 16:51:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2027\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3667 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2302) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:51:39',4,'2023-03-30 18:51:55',4,0,NULL,NULL,NULL,'8b70ced1-8219-4206-b7ec-10c0242808c4'),(2028,'All Childred and Moved to Secondline Treatment','All Childred and Moved to Secondline Treatment','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All Childred and Moved to Secondline Treatment\n All Childred and Moved to Secondline Treatment\n \n 2023-03-30 16:52:27 UTC\n \n 2023-03-30 16:53:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2028\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All Children \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) < 15 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3794 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:52:27',4,'2023-03-30 18:53:11',4,0,NULL,NULL,NULL,'143c95e1-ae28-460c-92c2-3807e30dc704'),(2029,'health_worker_moved','Health worker moved to second line','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n health_worker_moved\n Health worker moved to second line\n \n 2023-03-30 16:52:49 UTC\n \n 2023-03-30 16:55:13 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2029\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3667 \n and ob.voided = 0 \n ) \n and o.person_id in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3794) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:52:49',4,'2023-03-30 18:55:13',4,0,NULL,NULL,NULL,'3a04d202-b320-463e-a233-40887022bfea'),(2030,'All TB Adolescent (10-19 yrs) and Completed ','All TB Adolescent (10-19 yrs) and Completed ','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Adolescent (10-19 yrs) and Completed \n All TB Adolescent (10-19 yrs) and Completed \n \n 2023-03-30 16:55:50 UTC\n \n 2023-03-30 16:56:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2030\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All Adolescent (10-19 yrs) \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) < 20 \n and floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) > 9 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 2242 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:55:50',4,'2023-03-30 18:56:27',4,0,NULL,NULL,NULL,'788061f8-b372-4d67-b493-c20b96b948bf'),(2031,'public_transport_Moved','Public Transport move to second line','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n public_transport_Moved\n Public Transport move to second line\n \n 2023-03-30 16:55:50 UTC\n \n 2023-03-30 16:56:22 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2031\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 4654 \n and ob.voided = 0 \n ) \n and o.person_id in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3794) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:55:50',4,'2023-03-30 18:56:22',4,0,NULL,NULL,NULL,'c2e7a54e-80e6-4535-a09f-32d93e8ce902'),(2032,'All TB Adolescent (10-19 yrs) and cured','All TB Adolescent (10-19 yrs) and cured','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Adolescent (10-19 yrs) and cured\n All TB Adolescent (10-19 yrs) and cured\n \n 2023-03-30 16:56:54 UTC\n \n 2023-03-30 16:57:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2032\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All Adolescent (10-19 yrs) \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) < 20 \n and floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) > 9 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 1068 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:56:54',4,'2023-03-30 18:57:31',4,0,NULL,NULL,NULL,'e620cd1b-bbe2-4c3d-93bb-fcbdc8b34d84'),(2033,'public_transport_lost','Public transport Lost','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n public_transport_lost\n Public transport Lost\n \n 2023-03-30 16:57:13 UTC\n \n 2023-03-30 16:57:37 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2033\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 4654 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2302) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:57:13',4,'2023-03-30 18:57:37',4,0,NULL,NULL,NULL,'0cc2e2d8-4cab-45c7-9b04-67c8bfd1bbfa'),(2034,'All TB Adolescent (10-19 yrs) and Died','All TB Adolescent (10-19 yrs) and Died','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Adolescent (10-19 yrs) and Died\n All TB Adolescent (10-19 yrs) and Died\n \n 2023-03-30 16:57:52 UTC\n \n 2023-03-30 16:58:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2034\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All Adolescent (10-19 yrs) \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) < 20 \n and floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) > 9 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3650 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:57:52',4,'2023-03-30 18:58:21',4,0,NULL,NULL,NULL,'53ef1628-fe11-4b21-bab5-897e27196e04'),(2035,'public_transport_died','Public transport died','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n public_transport_died\n Public transport died\n \n 2023-03-30 16:58:17 UTC\n \n 2023-03-30 16:58:34 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2035\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 4654 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3650) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:58:17',4,'2023-03-30 18:58:34',4,0,NULL,NULL,NULL,'bbc25dd6-f8ff-4c55-84e8-efd76d0ac281'),(2036,'All TB Adolescent (10-19 yrs) and Lost to Follow up','All TB Adolescent (10-19 yrs) and Lost to Follow up','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Adolescent (10-19 yrs) and Lost to Follow up\n All TB Adolescent (10-19 yrs) and Lost to Follow up\n \n 2023-03-30 16:58:49 UTC\n \n 2023-03-30 16:59:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2036\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All Adolescent (10-19 yrs) \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) < 20 \n and floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) > 9 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 2302 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:58:49',4,'2023-03-30 18:59:12',4,0,NULL,NULL,NULL,'509944d6-5988-405c-8aee-8a9329e1e141'),(2037,'public_transport_completed','Public transport completed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n public_transport_completed\n Public transport completed\n \n 2023-03-30 16:59:27 UTC\n \n 2023-03-30 17:00:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2037\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 4654 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2242) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:59:27',4,'2023-03-30 19:00:28',4,0,NULL,NULL,NULL,'d9a7884a-eabd-43cc-9757-64ae74a3cb9c'),(2038,'All TB Adolescent (10-19 yrs) and Failed (Susceptible)','All TB Adolescent (10-19 yrs) and Failed (Susceptible)','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Adolescent (10-19 yrs) and Failed (Susceptible)\n All TB Adolescent (10-19 yrs) and Failed (Susceptible)\n \n 2023-03-30 16:59:52 UTC\n \n 2023-03-30 17:00:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2038\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All Adolescent (10-19 yrs) \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) < 20 \n and floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) > 9 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3793 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:59:52',4,'2023-03-30 19:00:27',4,0,NULL,NULL,NULL,'dd3ac915-529a-44c4-b086-fe9e21bc7553'),(2039,'All TB Adolescent (10-19 yrs) and Moved to Secondline treatment','All TB Adolescent (10-19 yrs) and Moved to Secondline treatment','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Adolescent (10-19 yrs) and Moved to Secondline treatment\n All TB Adolescent (10-19 yrs) and Moved to Secondline treatment\n \n 2023-03-30 17:01:19 UTC\n \n 2023-03-30 17:01:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2039\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All Adolescent (10-19 yrs) \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) < 20 \n and floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) > 9 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3794 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 19:01:19',4,'2023-03-30 19:01:41',4,0,NULL,NULL,NULL,'216e1e3c-eed7-4802-96bb-fe3256161a08'),(2040,'public_transport_curred','Public transport curred','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n public_transport_curred\n Public transport curred\n \n 2023-03-30 17:01:20 UTC\n \n 2023-03-30 17:01:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2040\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 4654 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (1068) \n and b.voided = 0 \n ) \n\n','2023-03-30 19:01:20',4,'2023-03-30 19:01:41',4,0,NULL,NULL,NULL,'faf660cd-1ef3-48a9-86d5-805f14b23465'); -INSERT INTO `serialized_object` VALUES (2041,'All TB Adolescent (10-19 yrs) and Not Evaluated','All TB Adolescent (10-19 yrs) and Not Evaluated','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Adolescent (10-19 yrs) and Not Evaluated\n All TB Adolescent (10-19 yrs) and Not Evaluated\n \n 2023-03-30 17:02:10 UTC\n \n 2023-03-30 17:03:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2041\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All Adolescent (10-19 yrs) \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) < 20 \n and floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) > 9 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id not in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded in (1068,2242,3650,2302,3794,3793) \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 19:02:10',4,'2023-03-30 19:03:44',4,0,NULL,NULL,NULL,'8fcd3cec-a879-4240-888f-42575228b47d'),(2042,'public_transport_notEvaluated','Public transport note evaluated','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n public_transport_notEvaluated\n Public transport note evaluated\n \n 2023-03-30 17:02:53 UTC\n \n 2023-03-30 17:03:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2042\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 4654 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2302,1068,2242,3650,3793,3794) \n and b.voided = 0 \n ) \n\n','2023-03-30 19:02:53',4,'2023-03-30 19:03:45',4,0,NULL,NULL,NULL,'7037beac-7eba-4b7f-a3b7-6636d1d435bd'),(2043,'TB Females and Completed','TB Females and Completed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Females and Completed\n TB Females and Completed\n \n 2023-03-30 17:07:55 UTC\n \n 2023-03-30 17:08:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2043\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- Female \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where person.gender = 'F' \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 2242 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 19:07:55',4,'2023-03-30 19:08:14',4,0,NULL,NULL,NULL,'82abec75-7c2a-4607-b3b1-b3ef5c6c4361'),(2044,'TB Females and Cured','TB Females and Cured','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Females and Cured\n TB Females and Cured\n \n 2023-03-30 17:08:50 UTC\n \n 2023-03-30 17:09:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2044\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- Female \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where person.gender = 'F' \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 1068 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 19:08:50',4,'2023-03-30 19:09:12',4,0,NULL,NULL,NULL,'f746ec4b-a949-4b53-86c8-4e1a71843d72'),(2045,'HHCM_notEvaluated','HHCM Note Evaluated','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM_notEvaluated\n HHCM Note Evaluated\n \n 2023-03-30 17:09:07 UTC\n \n 2023-03-30 17:09:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2045\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3777 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2302,1068,2242,3650,3793,3794) \n and b.voided = 0 \n ) \n\n','2023-03-30 19:09:07',4,'2023-03-30 19:09:44',4,0,NULL,NULL,NULL,'d8caa7dd-326a-46f7-97ee-f7205689bfda'),(2046,'HHCM_curred','HHCM Curred','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM_curred\n HHCM Curred\n \n 2023-03-30 17:10:16 UTC\n \n 2023-03-30 17:10:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2046\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3777 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (1068) \n and b.voided = 0 \n ) \n\n','2023-03-30 19:10:16',4,'2023-03-30 19:10:39',4,0,NULL,NULL,NULL,'ea1cc81f-9ccc-4401-80e9-57a84da98f58'),(2047,'TB Females and Died','TB Females and Died','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Females and Died\n TB Females and Died\n \n 2023-03-30 17:11:17 UTC\n \n 2023-03-30 17:11:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2047\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- Female \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where person.gender = 'F' \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3650 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 19:11:17',4,'2023-03-30 19:11:45',4,0,NULL,NULL,NULL,'f55690e5-8b8d-43ce-b797-f0f8707d1222'),(2048,'HHCM_completed','HHCM Completed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM_completed\n HHCM Completed\n \n 2023-03-30 17:12:02 UTC\n \n 2023-03-30 17:12:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2048\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3777 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2242) \n and b.voided = 0 \n ) \n\n','2023-03-30 19:12:02',4,'2023-03-30 19:12:21',4,0,NULL,NULL,NULL,'7dbf3689-913d-4883-ae4b-5be2aee4ba37'),(2049,'TB Females and Lost to Follow up','TB Females and Lost to Follow up','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Females and Lost to Follow up\n TB Females and Lost to Follow up\n \n 2023-03-30 17:12:17 UTC\n \n 2023-03-30 17:13:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2049\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- Female \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where person.gender = 'F' \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 2302 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 19:12:17',4,'2023-03-30 19:13:14',4,0,NULL,NULL,NULL,'71a12f10-af92-4eba-88f2-176a2cb3ae14'),(2050,'HHCM_died','HHCM Died','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM_died\n HHCM Died\n \n 2023-03-30 17:12:43 UTC\n \n 2023-03-30 17:13:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2050\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3777 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3650) \n and b.voided = 0 \n ) \n\n','2023-03-30 19:12:43',4,'2023-03-30 19:13:08',4,0,NULL,NULL,NULL,'87c6de2e-d87a-430b-a15e-d5de45e36410'),(2051,'HHCM_lost','HHCM Lost','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM_lost\n HHCM Lost\n \n 2023-03-30 17:13:35 UTC\n \n 2023-03-30 17:14:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2051\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3777 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2302) \n and b.voided = 0 \n ) \n\n','2023-03-30 19:13:35',4,'2023-03-30 19:14:00',4,0,NULL,NULL,NULL,'543f25df-61ec-4cec-847f-816fec3268ec'),(2052,'TB Females and Failed (Susceptible)','TB Females and Failed (Susceptible)','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Females and Failed (Susceptible)\n TB Females and Failed (Susceptible)\n \n 2023-03-30 17:14:08 UTC\n \n 2023-03-30 17:14:24 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2052\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- Female \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where person.gender = 'F' \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3793 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 19:14:08',4,'2023-03-30 19:14:24',4,0,NULL,NULL,NULL,'d1085653-8aca-440b-ae5c-d899217ef3b5'),(2053,'HHCM_moved','HHCM Moved','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM_moved\n HHCM Moved\n \n 2023-03-30 17:14:34 UTC\n \n 2023-03-30 17:14:52 UTC\n \n \n endDate\n \n java.util.Date\n true\n \n \n startDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2053\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3777 \n and ob.voided = 0 \n ) \n and o.person_id in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3794) \n and b.voided = 0 \n ) \n\n','2023-03-30 19:14:34',4,'2023-03-30 19:14:52',4,0,NULL,NULL,NULL,'43bc5260-c525-4968-a427-01e7febdfef1'),(2054,'TB Females and Moved to SecondLine','TB Females and Moved to SecondLine','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Females and Moved to SecondLine\n TB Females and Moved to SecondLine\n \n 2023-03-30 17:14:53 UTC\n \n 2023-03-30 17:15:09 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2054\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- Female \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where person.gender = 'F' \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3794 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 19:14:53',4,'2023-03-30 19:15:09',4,0,NULL,NULL,NULL,'56836385-8ef8-49a4-bdc7-e7ac24baadb9'),(2055,'TB Females and Not Evaluated','TB Females and Not Evaluated','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Females and Not Evaluated\n TB Females and Not Evaluated\n \n 2023-03-30 17:15:40 UTC\n \n 2023-03-30 17:16:46 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2055\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- Female \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where person.gender = 'F' \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id not in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded in (1068,2242,3650,2302,3793,3794) \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 19:15:40',4,'2023-03-30 19:16:46',4,0,NULL,NULL,NULL,'d1ccfc19-7910-4d71-8ba4-1b31cfbc17b7'),(2056,'FactoryWorker_failed','Factory worker failed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n FactoryWorker_failed\n Factory worker failed\n \n 2023-04-03 07:36:11 UTC\n \n 2023-04-03 07:53:38 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2056\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3669 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3793) \n and b.voided = 0 \n ) \n\n','2023-04-03 09:36:11',4,'2023-04-03 09:53:38',4,0,NULL,NULL,NULL,'43e35844-a8eb-4cc5-a3cd-445a052316c2'),(2057,'prison_worker_failed','Prison worker failed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n prison_worker_failed\n Prison worker failed\n \n 2023-04-03 07:55:07 UTC\n \n 2023-04-03 07:56:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2057\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3779 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3793) \n and b.voided = 0 \n ) \n\n','2023-04-03 09:55:07',4,'2023-04-03 09:56:27',4,0,NULL,NULL,NULL,'a4dd9267-3676-4a8b-b56b-65b8683f1ba6'),(2058,'health_worker_failed','Health Worker Failed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n health_worker_failed\n Health Worker Failed\n \n 2023-04-03 07:57:33 UTC\n \n 2023-04-03 07:58:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2058\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3670 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3793) \n and b.voided = 0 \n ) \n\n','2023-04-03 09:57:33',4,'2023-04-03 09:58:07',4,0,NULL,NULL,NULL,'da9db0e3-0d78-489c-bd35-eb7c68e345d0'),(2059,'public_transport_failed','Public Transport Failed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n public_transport_failed\n Public Transport Failed\n \n 2023-04-03 07:58:45 UTC\n \n 2023-04-03 07:59:38 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2059\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 4654 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3793) \n and b.voided = 0 \n ) \n\n','2023-04-03 09:58:45',4,'2023-04-03 09:59:38',4,0,NULL,NULL,NULL,'33f5b01b-0001-4fbd-8d76-43b6616c4824'),(2060,'HHCM_failed','HHCM Failed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM_failed\n HHCM Failed\n \n 2023-04-03 09:18:29 UTC\n \n 2023-04-03 09:19:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2060\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3777 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3793) \n and b.voided = 0 \n ) \n\n','2023-04-03 11:18:29',4,'2023-04-03 11:19:51',4,0,NULL,NULL,NULL,'60d6cef7-079a-4825-b6e1-cb4eb655b864'),(2061,'Mine Workers Cured','Mine Workers Cured','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Mine Workers Cured\n Mine Workers Cured\n \n 2023-04-03 09:18:52 UTC\n \n 2023-04-04 12:32:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2061\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- Mine Worker \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3776 and o.value_coded = 3667 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 1068 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-04-03 11:18:52',4,'2023-04-04 14:32:36',4,0,NULL,NULL,NULL,'9fffbcb9-e2f8-43d2-b6ae-b257c80ff52c'),(2062,'Mine Workers Completed','Mine Workers Completed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Mine Workers Completed\n Mine Workers Completed\n \n 2023-04-03 09:20:24 UTC\n \n 2023-04-04 12:31:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2062\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- Mine Worker \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3776 and o.value_coded = 3667 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 2242 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-04-03 11:20:24',4,'2023-04-04 14:31:40',4,0,NULL,NULL,NULL,'22a95602-7db7-453f-8af1-d3314651365b'),(2063,'HHXM_completed','HHXM Completed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM_completed\n HHXM Completed\n \n 2023-04-03 09:20:26 UTC\n \n 2023-04-03 09:21:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2063\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3778 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2242) \n and b.voided = 0 \n ) \n\n','2023-04-03 11:20:26',4,'2023-04-03 11:21:05',4,0,NULL,NULL,NULL,'bc440ff8-a03c-42b4-b082-393873e19cc5'),(2064,'HHXM_failed','HHXM Failed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM_failed\n HHXM Failed\n \n 2023-04-03 09:21:50 UTC\n \n 2023-04-03 22:08:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2064\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3778 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3793) \n and b.voided = 0 \n ) \n\n','2023-04-03 11:21:50',4,'2023-04-04 00:08:02',4,0,NULL,NULL,NULL,'168f05ac-dc2e-4c53-a38b-0d1ac6bc3f4c'),(2065,'Mine Workers Died','Mine Workers Died','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Mine Workers Died\n Mine Workers Died\n \n 2023-04-03 09:22:05 UTC\n \n 2023-04-04 12:33:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2065\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- Mine Worker \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3776 and o.value_coded = 3667 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3650 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-04-03 11:22:05',4,'2023-04-04 14:33:00',4,0,NULL,NULL,NULL,'75e3ca1f-9e04-4d1c-91ae-f79f18f650ee'),(2066,'HHXM_cured','HHXM Curred\r\n','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM_cured\n HHXM Curred \n\n \n 2023-04-03 09:22:14 UTC\n \n 2023-04-03 09:22:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2066\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3778 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (1068) \n and b.voided = 0 \n ) \n\n','2023-04-03 11:22:14',4,'2023-04-03 11:22:50',4,0,NULL,NULL,NULL,'1895c8dd-bf2c-4bd3-a48f-08770e349ffe'),(2067,'HHXM_moved','HHXM Moved','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM_moved\n HHXM Moved\n \n 2023-04-03 09:24:40 UTC\n \n 2023-04-03 09:27:22 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2067\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3778 \n and ob.voided = 0 \n ) \n and o.person_id in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3794) \n and b.voided = 0 \n ) \n\n','2023-04-03 11:24:40',4,'2023-04-03 11:27:22',4,0,NULL,NULL,NULL,'458408ac-2fc6-45e2-a884-8b8a75cf1d94'),(2068,'HHXM_lost','HHXM Lost','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM_lost\n HHXM Lost\n \n 2023-04-03 09:26:54 UTC\n \n 2023-04-03 09:27:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2068\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3778 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2302) \n and b.voided = 0 \n ) \n\n','2023-04-03 11:26:54',4,'2023-04-03 11:27:10',4,0,NULL,NULL,NULL,'20694047-0786-4ce8-922b-df3b23f39c56'),(2069,'Mine Workers Lost to Follow up','Mine Workers Lost to Follow up','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Mine Workers Lost to Follow up\n Mine Workers Lost to Follow up\n \n 2023-04-03 09:26:54 UTC\n \n 2023-04-04 12:33:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2069\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- Mine Worker \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3776 and o.value_coded = 3667 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 2302 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-04-03 11:26:54',4,'2023-04-04 14:33:39',4,0,NULL,NULL,NULL,'9406df9e-8673-48f0-81eb-21b60a5ded97'),(2070,'hhxm_notEvaluated','HHXm Not Evaluated','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n hhxm_notEvaluated\n HHXm Not Evaluated\n \n 2023-04-03 09:28:30 UTC\n \n 2023-04-03 09:29:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2070\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3778 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2302,1068,2242,3650,3793,3794) \n and b.voided = 0 \n ) \n\n','2023-04-03 11:28:30',4,'2023-04-03 11:29:51',4,0,NULL,NULL,NULL,'0bd16759-6ff9-4cbf-a0b0-8e9fd1efd1be'),(2071,'Mine Workers Failed (Susceptible)','Mine Workers Failed (Susceptible)','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Mine Workers Failed (Susceptible)\n Mine Workers Failed (Susceptible)\n \n 2023-04-03 09:33:26 UTC\n \n 2023-04-04 12:33:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2071\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- Mine Worker \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3776 and o.value_coded = 3667 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3793 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-04-03 11:33:26',4,'2023-04-04 14:33:18',4,0,NULL,NULL,NULL,'4bba1fe8-13ad-4c18-b549-f0aff1e6bc3f'),(2072,'hhxm_died','HHXM Died','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n hhxm_died\n HHXM Died\n \n 2023-04-03 09:34:30 UTC\n \n 2023-04-03 10:13:34 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2072\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3778 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3650) \n and b.voided = 0 \n ) \n\n','2023-04-03 11:34:30',4,'2023-04-03 12:13:34',4,0,NULL,NULL,NULL,'173bca27-99d3-497c-b83f-902bd3502875'),(2073,'Mine Workers Moved to Secondline Treatment','Mine Workers Moved to Secondline Treatment','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Mine Workers Moved to Secondline Treatment\n Mine Workers Moved to Secondline Treatment\n \n 2023-04-03 09:36:03 UTC\n \n 2023-04-04 12:29:57 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2073\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- Mine Worker \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3776 and o.value_coded = 3667 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3794 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-04-03 11:36:03',4,'2023-04-04 14:29:57',4,0,NULL,NULL,NULL,'7f349b74-1609-4786-a666-6f26b3e0934c'),(2074,'Mine Workers Not Evaluated','Mine Workers Not Evaluated','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Mine Workers Not Evaluated\n Mine Workers Not Evaluated\n \n 2023-04-03 09:39:03 UTC\n \n 2023-04-03 09:39:38 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2074\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- Mine Worker \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3776 and o.value_coded = 3667 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id not in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded in (1068,2302,3650,3793,2242,3794) \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-04-03 11:39:03',4,'2023-04-03 11:39:38',4,0,NULL,NULL,NULL,'3f20bdd4-03b5-48eb-be2e-3e7d96d9608f'),(2075,'New and Relapse Completed','New and Relapse Completed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n New and Relapse Completed\n New and Relapse Completed\n \n 2023-04-03 09:46:12 UTC\n \n 2023-04-03 09:50:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2075\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 11:46:12',4,'2023-04-03 11:50:04',4,0,NULL,NULL,NULL,'bf8fffec-423b-4d4f-9082-a61937680e08'),(2076,'TB New and Relapse Cured','TB New and Relapse Cured','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB New and Relapse Cured\n TB New and Relapse Cured\n \n 2023-04-03 09:54:54 UTC\n \n 2023-04-03 10:09:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2076\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 11:54:54',4,'2023-04-03 12:09:07',4,0,NULL,NULL,NULL,'cc3e6b66-c906-4723-bf8b-f1e3bd9a4f48'),(2077,'TB New and Relapse Died','TB New and Relapse Died','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB New and Relapse Died\n TB New and Relapse Died\n \n 2023-04-03 10:09:39 UTC\n \n 2023-04-03 10:26:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2077\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 12:09:39',4,'2023-04-03 12:26:07',4,0,NULL,NULL,NULL,'cdd51d3f-4922-459d-a23e-a62718354d0f'),(2078,'TB New and Relapse Lost to Follow-up','TB New and Relapse Lost to Follow-up','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB New and Relapse Lost to Follow-up\n TB New and Relapse Lost to Follow-up\n \n 2023-04-03 10:13:30 UTC\n \n 2023-04-03 10:22:25 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2078\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 12:13:30',4,'2023-04-03 12:22:25',4,0,NULL,NULL,NULL,'e63623be-d56c-4e8a-9fb8-fcbfd651b326'),(2079,'Ex Miner - Died','Ex Miner Died','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Ex Miner - Died\n Ex Miner Died\n \n 2023-04-03 10:15:01 UTC\n \n 2023-04-03 10:18:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2079\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 12:15:01',4,'2023-04-03 12:18:31',4,0,NULL,NULL,NULL,'4c0567b3-bc02-4b62-be5b-4e348a8a17d5'),(2080,'Ex Miner - Lost','Ex Miner Lost','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Ex Miner - Lost\n Ex Miner Lost\n \n 2023-04-03 10:15:38 UTC\n \n 2023-04-03 10:20:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2080\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 12:15:38',4,'2023-04-03 12:20:44',4,0,NULL,NULL,NULL,'1001e669-922a-43ba-be6c-4e909e4d7f30'),(2081,'Ex Miner - Not Evaluated','Ex Miner Not Evaluated','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Ex Miner - Not Evaluated\n Ex Miner Not Evaluated\n \n 2023-04-03 10:16:26 UTC\n \n 2023-04-03 10:25:22 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2081\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 12:16:26',4,'2023-04-03 12:25:22',4,0,NULL,NULL,NULL,'95297d99-247c-4cb1-8454-8cde32e41699'),(2082,'Ex Miner - Completed','Ex Miner - Completed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Ex Miner - Completed\n Ex Miner - Completed\n \n 2023-04-03 10:21:16 UTC\n \n 2023-04-03 10:53:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2082\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 12:21:16',4,'2023-04-03 12:53:45',4,0,NULL,NULL,NULL,'6512f126-9e67-46ba-aaab-e783a36a4efa'),(2083,'Ex Miner - Moved Second Line','Ex Miner moved second line','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Ex Miner - Moved Second Line\n Ex Miner moved second line\n \n 2023-04-03 10:22:16 UTC\n \n 2023-04-03 10:24:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2083\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 12:22:16',4,'2023-04-03 12:24:44',4,0,NULL,NULL,NULL,'7de4354e-95cb-4f66-8d40-0bd243779ee4'),(2084,'TB New and Relapse Failed (Susceptible)','TB New and Relapse Failed (Susceptible)','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB New and Relapse Failed (Susceptible)\n TB New and Relapse Failed (Susceptible)\n \n 2023-04-03 10:26:32 UTC\n \n 2023-04-03 11:24:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2084\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 12:26:32',4,'2023-04-03 13:24:51',4,0,NULL,NULL,NULL,'e3218a64-d243-48aa-9b9a-bbcda0104ae7'),(2085,'Ex Miner - Failed','Ex Miner - Failed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Ex Miner - Failed\n Ex Miner - Failed\n \n 2023-04-03 10:27:35 UTC\n \n 2023-04-03 11:24:34 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2085\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 12:27:35',4,'2023-04-03 13:24:34',4,0,NULL,NULL,NULL,'aa17ed03-51ed-4fde-8ad9-164f975ded80'),(2086,'TB New and Relapse Moved to second line treatment','TB New and Relapse Moved to second line treatment','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB New and Relapse Moved to second line treatment\n TB New and Relapse Moved to second line treatment\n \n 2023-04-03 10:27:42 UTC\n \n 2023-04-03 10:29:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2086\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 12:27:42',4,'2023-04-03 12:29:11',4,0,NULL,NULL,NULL,'687406cb-8ffe-4b7a-a806-583e78f04e48'),(2087,'Ex Miner - Cured','Ex Miner - Cured','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Ex Miner - Cured\n Ex Miner - Cured\n \n 2023-04-03 10:28:42 UTC\n \n 2023-04-04 09:25:16 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2087\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 12:28:42',4,'2023-04-04 11:25:16',4,0,NULL,NULL,NULL,'6210a6de-cdbc-411c-b9fc-e6a6bf2f42bc'),(2088,'Factory Worker - Complete','Factory Worker - Complete','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Factory Worker - Complete\n Factory Worker - Complete\n \n 2023-04-03 11:31:19 UTC\n \n 2023-04-03 11:33:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2088\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 13:31:19',4,'2023-04-03 13:33:02',4,0,NULL,NULL,NULL,'d1ce4f4f-9869-4fdd-afa5-da1899ae3815'),(2089,'Factory Worker - Cured','Factory Worker - Cured','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Factory Worker - Cured\n Factory Worker - Cured\n \n 2023-04-03 11:35:29 UTC\n \n 2023-04-03 11:37:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2089\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 13:35:29',4,'2023-04-03 13:37:51',4,0,NULL,NULL,NULL,'b92fab4d-1381-445b-abb1-1ba06b0957d4'),(2090,'Factory Worker - Died','Factory Worker - Died','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Factory Worker - Died\n Factory Worker - Died\n \n 2023-04-03 11:37:01 UTC\n \n 2023-04-03 11:39:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2090\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 13:37:01',4,'2023-04-03 13:39:08',4,0,NULL,NULL,NULL,'ef65034d-ed9d-452d-af2f-ababeecfa6ad'),(2091,'Factory Worker - Lost','Factory Worker - Lost','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Factory Worker - Lost\n Factory Worker - Lost\n \n 2023-04-03 11:38:56 UTC\n \n 2023-04-03 11:58:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2091\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 13:38:56',4,'2023-04-03 13:58:59',4,0,NULL,NULL,NULL,'a9e56df4-43a7-4387-828d-10c9dfb89245'),(2092,'Factory Worker - Not Evaluated','Factory Worker - Not Evaluated','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Factory Worker - Not Evaluated\n Factory Worker - Not Evaluated\n \n 2023-04-03 11:43:52 UTC\n \n 2023-04-03 11:59:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2092\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 13:43:52',4,'2023-04-03 13:59:10',4,0,NULL,NULL,NULL,'77cd1821-951d-42ed-a866-5f08fd800a9c'),(2093,'TB New and Relapse Not Evaluated','TB New and Relapse Not Evaluated','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB New and Relapse Not Evaluated\n TB New and Relapse Not Evaluated\n \n 2023-04-03 11:45:15 UTC\n \n 2023-04-03 11:52:49 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2093\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 13:45:15',4,'2023-04-03 13:52:49',4,0,NULL,NULL,NULL,'8c3908aa-5ac3-4dc9-9261-cdd7fc07e365'),(2094,'Retreatment excluding Relapse Completed','Retreatment excluding Relapse Completed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Retreatment excluding Relapse Completed\n Retreatment excluding Relapse Completed\n \n 2023-04-03 19:27:03 UTC\n \n 2023-04-04 12:39:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2094\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 21:27:03',4,'2023-04-04 14:39:55',4,0,NULL,NULL,NULL,'f3df3cc6-11ba-4ef1-9b6b-eba700de0818'),(2095,'Factory Worker - Moved to 2nd line','Factory Worker - Moved to 2nd line','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Factory Worker - Moved to 2nd line\n Factory Worker - Moved to 2nd line\n \n 2023-04-03 19:33:19 UTC\n \n 2023-04-03 19:35:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2095\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 21:33:19',4,'2023-04-03 21:35:06',4,0,NULL,NULL,NULL,'9ac7ec7c-6fa1-4771-8cb3-bcfca51f5e4b'),(2096,'Retreatment excluding Relapse Cured','Retreatment excluding Relapse Cured','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Retreatment excluding Relapse Cured\n Retreatment excluding Relapse Cured\n \n 2023-04-03 19:37:22 UTC\n \n 2023-04-03 19:42:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2096\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 21:37:22',4,'2023-04-03 21:42:14',4,0,NULL,NULL,NULL,'af4ccd45-738a-452f-ab0e-aa7588ecd131'),(2097,'Factory Worker - Failed','Factory Worker - Failed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Factory Worker - Failed\n Factory Worker - Failed\n \n 2023-04-03 19:44:52 UTC\n \n 2023-04-03 19:49:24 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2097\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 21:44:52',4,'2023-04-03 21:49:24',4,0,NULL,NULL,NULL,'f353300f-5673-4742-9115-c5b0b7e398e8'),(2098,'Retreatment excluding Relapse Died','Retreatment excluding Relapse Died','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Retreatment excluding Relapse Died\n Retreatment excluding Relapse Died\n \n 2023-04-03 19:48:30 UTC\n \n 2023-04-03 19:51:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2098\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 21:48:30',4,'2023-04-03 21:51:58',4,0,NULL,NULL,NULL,'ae6d7e28-203a-4141-b338-0a2faadc3662'),(2099,'Prison Worker - Died','Prison Worker - Died','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Prison Worker - Died\n Prison Worker - Died\n \n 2023-04-03 19:50:39 UTC\n \n 2023-04-03 19:53:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2099\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 21:50:39',4,'2023-04-03 21:53:44',4,0,NULL,NULL,NULL,'93b06207-6e95-4711-aa58-31c3a88ef1c0'),(2100,'Prison Worker - Cured','Prison Worker - Cured','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Prison Worker - Cured\n Prison Worker - Cured\n \n 2023-04-03 19:53:11 UTC\n \n 2023-04-03 19:54:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2100\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 21:53:11',4,'2023-04-03 21:54:43',4,0,NULL,NULL,NULL,'2f32e1d7-b41d-4bb7-89a3-80c3243e4948'),(2101,'Retreatment excluding Relapse Lost to follow up','Retreatment excluding Relapse Lost to follow up','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Retreatment excluding Relapse Lost to follow up\n Retreatment excluding Relapse Lost to follow up\n \n 2023-04-03 19:53:33 UTC\n \n 2023-04-03 19:55:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2101\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 21:53:33',4,'2023-04-03 21:55:20',4,0,NULL,NULL,NULL,'e5c0a844-b04b-40b4-99a4-32232d7a740e'),(2102,'Prison Worker - Completed','Prison Worker - Completed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Prison Worker - Completed\n Prison Worker - Completed\n \n 2023-04-03 19:55:01 UTC\n \n 2023-04-03 20:00:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2102\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 21:55:01',4,'2023-04-03 22:00:15',4,0,NULL,NULL,NULL,'a4e75f76-e839-46af-bdc6-8218f3df823c'),(2103,'Retreatment excluding Relapse Failed','Retreatment excluding Relapse Failed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Retreatment excluding Relapse Failed\n Retreatment excluding Relapse Failed\n \n 2023-04-03 19:57:02 UTC\n \n 2023-04-03 20:01:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2103\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 21:57:02',4,'2023-04-03 22:01:44',4,0,NULL,NULL,NULL,'abea75a9-417c-4570-a63e-5739c02c765e'),(2104,'Prison Worker - Not Evaluated','Prison Worker - Not Evaluated','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Prison Worker - Not Evaluated\n Prison Worker - Not Evaluated\n \n 2023-04-03 19:59:02 UTC\n \n 2023-04-03 20:00:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2104\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 21:59:02',4,'2023-04-03 22:00:31',4,0,NULL,NULL,NULL,'5f8c563b-7314-4359-8bb4-4f9d51fe2257'),(2105,'TB Treatment Outcome - Block 2','Block 2: TB/HIV Activities','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Treatment Outcome - Block 2\n Block 2: TB/HIV Activities\n \n 2023-04-03 20:01:22 UTC\n \n 2023-04-03 20:01:46 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2105\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-04-03 22:01:22',4,'2023-04-03 22:01:46',4,0,NULL,NULL,NULL,'e24dad06-5de1-4215-b021-85b95585a56b'),(2106,'TB Treatment Outcome - Block 2 Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Treatment Outcome - Block 2 Data Set\n \n 2023-04-03 20:01:46 UTC\n \n 2023-04-03 20:33:35 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2106\n \n \n DM_Sex\n \n \n \n \n \n \n \n \n ARTNw&Rl_F\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n \n \n \n ARTNw&Rl_M\n \n \n \n \n DM_Sex\n Males\n \n \n \n \n \n ARTRetr_F\n \n \n \n \n \n \n \n \n \n ARTRetr_M\n \n \n \n \n \n \n DapNw&Rl_F\n \n \n \n \n \n \n \n \n \n DapNw&Rl_M\n \n \n \n \n \n \n DapRetre_F\n \n \n \n \n \n \n \n \n \n DapRetre_M\n \n \n \n \n \n \n PosNw&Rs_F\n \n \n \n \n \n \n \n \n \n PosNw&Rs_M\n \n \n \n \n \n \n PosRetr_F\n \n \n \n \n \n \n \n \n \n PosRetr_M\n \n \n \n \n \n \n StsNw&Rs_F\n \n \n \n \n \n \n \n \n \n StsNw&Rs_M\n \n \n \n \n \n \n StsRetre_F\n \n \n \n \n \n \n StsRetre_M\n \n \n \n \n \n \n','2023-04-03 22:01:46',4,'2023-04-03 22:33:35',4,0,NULL,NULL,NULL,'5730236a-dfc3-4bf5-8f18-3769e49f4519'),(2107,'Prison Worker - Failed','Prison Worker - Failed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Prison Worker - Failed\n Prison Worker - Failed\n \n 2023-04-03 20:01:47 UTC\n \n 2023-04-03 20:07:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2107\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:01:47',4,'2023-04-03 22:07:43',4,0,NULL,NULL,NULL,'832801ab-b41b-4695-b0df-ada7c5c34ff7'),(2108,'Retreatment excluding Relapse Not Evaluated','Retreatment excluding Relapse Not Evaluated','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Retreatment excluding Relapse Not Evaluated\n Retreatment excluding Relapse Not Evaluated\n \n 2023-04-03 20:02:36 UTC\n \n 2023-04-03 20:05:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2108\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:02:36',4,'2023-04-03 22:05:10',4,0,NULL,NULL,NULL,'9c3205c9-eb03-46c1-b7e8-a0e9fa4b4738'),(2109,'Prison Worker - Moved to 2nd line','Prison Worker - Moved to 2nd line','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Prison Worker - Moved to 2nd line\n Prison Worker - Moved to 2nd line\n \n 2023-04-03 20:02:41 UTC\n \n 2023-04-03 20:05:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2109\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:02:41',4,'2023-04-03 22:05:28',4,0,NULL,NULL,NULL,'cee1771f-3491-455f-9b0a-a35e99f25454'),(2110,'Retreatment excluding Relapse Moved to Secondline Treatment','Retreatment excluding Relapse Moved to Secondline Treatment','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Retreatment excluding Relapse Moved to Secondline Treatment\n Retreatment excluding Relapse Moved to Secondline Treatment\n \n 2023-04-03 20:06:37 UTC\n \n 2023-04-03 20:20:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2110\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:06:37',4,'2023-04-03 22:20:31',4,0,NULL,NULL,NULL,'ee732817-3760-4a2d-9d61-f7009cd0b256'),(2111,'Prison Worker - Lost','Prison Worker - Lost','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Prison Worker - Lost\n Prison Worker - Lost\n \n 2023-04-03 20:07:00 UTC\n \n 2023-04-03 20:10:16 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2111\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:07:00',4,'2023-04-03 22:10:16',4,0,NULL,NULL,NULL,'bfa5d083-f2ca-4c04-a6d3-193176de6d61'),(2112,'RetreatRetreatment excluding Relapse Moved to Secondline Treatment','RetreatRetreatment excluding Relapse Moved to Secondline Treatment','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n RetreatRetreatment excluding Relapse Moved to Secondline Treatment\n RetreatRetreatment excluding Relapse Moved to Secondline Treatment\n \n 2023-04-03 20:13:03 UTC\n \n 2023-04-03 20:14:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2112\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- Retreatment excluding Relapse \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3785 and o.value_coded in (3786,1037) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3794 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-04-03 22:13:03',4,'2023-04-03 22:14:36',4,0,NULL,NULL,NULL,'2573846a-4c51-4427-bcba-7ed91d2c0835'),(2113,'Health Worker - Died','Health Worker - Died','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Health Worker - Died\n Health Worker - Died\n \n 2023-04-03 20:14:38 UTC\n \n 2023-04-03 20:16:57 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2113\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:14:38',4,'2023-04-03 22:16:57',4,0,NULL,NULL,NULL,'15cca65b-c4f6-4e32-8b7d-18cb047f999a'),(2114,'Health Worker - Cured','Health Worker - Cured','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Health Worker - Cured\n Health Worker - Cured\n \n 2023-04-03 20:16:23 UTC\n \n 2023-04-03 20:18:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2114\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:16:23',4,'2023-04-03 22:18:17',4,0,NULL,NULL,NULL,'efe0083b-cc7c-4394-bf4d-e4129ee2d998'),(2115,'Prison Worker - Completed','Prison Worker - Completed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Prison Worker - Completed\n Prison Worker - Completed\n \n 2023-04-03 20:18:34 UTC\n \n 2023-04-03 20:22:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2115\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:18:34',4,'2023-04-03 22:22:51',4,0,NULL,NULL,NULL,'685d03a5-0f34-426e-aa83-e12e209284b4'),(2116,'Prison Worker - Failed','Prison Worker - Failed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Prison Worker - Failed\n Prison Worker - Failed\n \n 2023-04-03 20:20:00 UTC\n \n 2023-04-03 20:22:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2116\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:20:00',4,'2023-04-03 22:22:29',4,0,NULL,NULL,NULL,'792e1555-e40d-4ebf-8b96-ebbaa769f859'),(2117,'All TB HIV positive Completed','All TB HIV positive Completed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV positive Completed\n All TB HIV positive Completed\n \n 2023-04-03 20:21:28 UTC\n \n 2023-04-03 20:31:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2117\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:21:28',4,'2023-04-03 22:31:15',4,0,NULL,NULL,NULL,'18f345bc-6ed0-42d6-893a-05ba98b38e16'),(2118,'All TB HIV positive Cured','All TB HIV positive Cured','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV positive Cured\n All TB HIV positive Cured\n \n 2023-04-03 20:25:37 UTC\n \n 2023-04-03 20:32:16 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2118\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:25:37',4,'2023-04-03 22:32:16',4,0,NULL,NULL,NULL,'4b6e2cd9-29b6-4f7b-8af7-0ab18e2af838'),(2119,'Health Worker - Completed','Health Worker - Completed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Health Worker - Completed\n Health Worker - Completed\n \n 2023-04-03 20:32:38 UTC\n \n 2023-04-03 20:39:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2119\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:32:38',4,'2023-04-03 22:39:58',4,0,NULL,NULL,NULL,'b38f490e-8d26-411a-9073-2a7e5d17e235'),(2120,'All TB HIV positive and Died','All TB HIV positive and Died','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV positive and Died\n All TB HIV positive and Died\n \n 2023-04-03 20:32:43 UTC\n \n 2023-04-03 20:35:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2120\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:32:43',4,'2023-04-03 22:35:39',4,0,NULL,NULL,NULL,'f0b13ce3-b836-4a27-a7a4-d1b83c1eb900'),(2121,'Health Worker - Not Evaluated','Health Worker - Not Evaluated','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Health Worker - Not Evaluated\n Health Worker - Not Evaluated\n \n 2023-04-03 20:32:56 UTC\n \n 2023-04-03 20:35:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2121\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:32:56',4,'2023-04-03 22:35:43',4,0,NULL,NULL,NULL,'9f750645-0dc4-488d-8a94-05e31d6b4838'),(2122,'All TB HIV positive and Lost to Follow Up','All TB HIV positive and Lost to Follow Up','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV positive and Lost to Follow Up\n All TB HIV positive and Lost to Follow Up\n \n 2023-04-03 20:33:45 UTC\n \n 2023-04-03 20:36:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2122\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:33:45',4,'2023-04-03 22:36:08',4,0,NULL,NULL,NULL,'21738598-0974-4f31-9925-1c9606d66410'),(2123,'All TB HIV positive and Failed','All TB HIV positive and Failed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV positive and Failed\n All TB HIV positive and Failed\n \n 2023-04-03 20:36:30 UTC\n \n 2023-04-03 20:40:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2123\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:36:30',4,'2023-04-03 22:40:18',4,0,NULL,NULL,NULL,'2a7766be-418e-4a5a-a204-c5fa91e6b672'),(2124,'All TB HIV positive and Not Evaluated','All TB HIV positive and Not Evaluated','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV positive and Not Evaluated\n All TB HIV positive and Not Evaluated\n \n 2023-04-03 20:37:09 UTC\n \n 2023-04-03 20:39:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2124\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:37:09',4,'2023-04-03 22:39:20',4,0,NULL,NULL,NULL,'04c0074a-fd87-44da-8d96-68d533e488ea'),(2125,'Health Worker - Lost','Health Worker - Lost','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Health Worker - Lost\n Health Worker - Lost\n \n 2023-04-03 20:40:25 UTC\n \n 2023-04-03 20:44:16 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2125\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:40:25',4,'2023-04-03 22:44:16',4,0,NULL,NULL,NULL,'925a50ba-435b-4213-a03b-6272a468cd01'),(2126,'All TB HIV positive and Moved to Secondline Treatment','All TB HIV positive and Moved to Secondline Treatment','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV positive and Moved to Secondline Treatment\n All TB HIV positive and Moved to Secondline Treatment\n \n 2023-04-03 20:40:57 UTC\n \n 2023-04-03 20:42:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2126\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:40:57',4,'2023-04-03 22:42:27',4,0,NULL,NULL,NULL,'6ed079c9-5ad9-4852-9523-95fddcbc9959'),(2127,'Health Worker - Failed','Health Worker - Failed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Health Worker - Failed\n Health Worker - Failed\n \n 2023-04-03 20:42:41 UTC\n \n 2023-04-03 20:52:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2127\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:42:41',4,'2023-04-03 22:52:06',4,0,NULL,NULL,NULL,'4ec08d1c-6427-44e0-b604-b960e585b190'),(2128,'All TB HIV Negative and Completed','All TB HIV Negative and Completed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Negative and Completed\n All TB HIV Negative and Completed\n \n 2023-04-03 20:43:07 UTC\n \n 2023-04-03 20:53:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2128\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:43:07',4,'2023-04-03 22:53:20',4,0,NULL,NULL,NULL,'d5786c86-ca76-43b1-b0a6-1bd90817af65'),(2129,'All TB HIV Negative and Cured','All TB HIV Negative and Cured','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Negative and Cured\n All TB HIV Negative and Cured\n \n 2023-04-03 20:44:07 UTC\n \n 2023-04-03 20:49:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2129\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:44:07',4,'2023-04-03 22:49:20',4,0,NULL,NULL,NULL,'a564539f-267c-452a-99d2-0f61f7c88c4f'),(2130,'Health Worker - Moved to 2nd line','Health Worker - Moved to 2nd line','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Health Worker - Moved to 2nd line\n Health Worker - Moved to 2nd line\n \n 2023-04-03 20:48:45 UTC\n \n 2023-04-03 20:55:46 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2130\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:48:45',4,'2023-04-03 22:55:46',4,0,NULL,NULL,NULL,'c0d08cc2-25dc-48f6-a9bc-db0d9b376d17'),(2131,'All TB HIV Negative and Died','All TB HIV Negative and Died','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Negative and Died\n All TB HIV Negative and Died\n \n 2023-04-03 20:51:50 UTC\n \n 2023-04-03 20:55:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2131\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:51:50',4,'2023-04-03 22:55:29',4,0,NULL,NULL,NULL,'b375d3b0-9817-419c-ad36-5513383a0191'),(2132,'Public Transport - Died','Public Transport - Died','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Public Transport - Died\n Public Transport - Died\n \n 2023-04-03 20:55:26 UTC\n \n 2023-04-03 20:57:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2132\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:55:26',4,'2023-04-03 22:57:21',4,0,NULL,NULL,NULL,'09f945ef-6ced-4c7c-924b-d83368e5b544'),(2133,'All TB HIV Negative and Failed','All TB HIV Negative and Failed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Negative and Failed\n All TB HIV Negative and Failed\n \n 2023-04-03 20:56:21 UTC\n \n 2023-04-03 21:00:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2133\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:56:21',4,'2023-04-03 23:00:30',4,0,NULL,NULL,NULL,'bce54b53-dea6-4664-bc35-b436a74551f0'),(2134,'All TB HIV Negative and Lost to Follow Up','All TB HIV Negative and Lost to Follow Up','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Negative and Lost to Follow Up\n All TB HIV Negative and Lost to Follow Up\n \n 2023-04-03 20:56:44 UTC\n \n 2023-04-03 21:00:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2134\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:56:44',4,'2023-04-03 23:00:04',4,0,NULL,NULL,NULL,'7b40659a-ca9a-4034-832f-5fddb0421d26'),(2135,'Public Transport - Not Evaluated','Public Transport - Not Evaluated','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Public Transport - Not Evaluated\n Public Transport - Not Evaluated\n \n 2023-04-03 20:56:54 UTC\n \n 2023-04-03 20:59:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2135\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:56:54',4,'2023-04-03 22:59:03',4,0,NULL,NULL,NULL,'0b001306-febd-4630-acb7-03fedc1eca0d'),(2136,'Public Transport - Completed','Public Transport - Completed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Public Transport - Completed\n Public Transport - Completed\n \n 2023-04-03 20:58:25 UTC\n \n 2023-04-03 21:00:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2136\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:58:25',4,'2023-04-03 23:00:42',4,0,NULL,NULL,NULL,'cb8baffc-6e41-4464-91b4-478da43820ad'),(2137,'Public Transport - Lost','Public Transport - Lost','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Public Transport - Lost\n Public Transport - Lost\n \n 2023-04-03 21:00:25 UTC\n \n 2023-04-03 21:04:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2137\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:00:25',4,'2023-04-03 23:04:00',4,0,NULL,NULL,NULL,'68abf753-d909-4d9d-866b-d707b637b5f6'),(2138,'All TB HIV Negative and Not Evaluated','All TB HIV Negative and Not Evaluated','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Negative and Not Evaluated\n All TB HIV Negative and Not Evaluated\n \n 2023-04-03 21:00:53 UTC\n \n 2023-04-03 21:02:35 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2138\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:00:53',4,'2023-04-03 23:02:35',4,0,NULL,NULL,NULL,'56fc35af-e96c-4268-b7b4-0d63610a2d06'),(2139,'All TB HIV Negative and Moved to Secondline Treatment','All TB HIV Negative and Moved to Secondline Treatment','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Negative and Moved to Secondline Treatment\n All TB HIV Negative and Moved to Secondline Treatment\n \n 2023-04-03 21:01:36 UTC\n \n 2023-04-03 21:02:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2139\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:01:36',4,'2023-04-03 23:02:58',4,0,NULL,NULL,NULL,'bdf99672-96f9-4eda-ad34-a82f5b59ffbc'),(2140,'Public Transport - Cured','Public Transport - Cured','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Public Transport - Cured\n Public Transport - Cured\n \n 2023-04-03 21:02:12 UTC\n \n 2023-04-03 21:06:24 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2140\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:02:12',4,'2023-04-03 23:06:24',4,0,NULL,NULL,NULL,'185b4be8-a666-4211-b22d-56dc426cbbcd'),(2141,'All TB Children (0-14 yrs) and Completed','All TB Children (0-14 yrs) and Completed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Children (0-14 yrs) and Completed\n All TB Children (0-14 yrs) and Completed\n \n 2023-04-03 21:03:41 UTC\n \n 2023-04-03 21:05:56 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2141\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:03:41',4,'2023-04-03 23:05:56',4,0,NULL,NULL,NULL,'eb242fe9-dde6-4baa-b92f-7a7084920dd7'),(2142,'All TB Children (0-14 yrs) and Cured','All TB Children (0-14 yrs) and Cured','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Children (0-14 yrs) and Cured\n All TB Children (0-14 yrs) and Cured\n \n 2023-04-03 21:04:01 UTC\n \n 2023-04-03 21:06:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2142\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:04:01',4,'2023-04-03 23:06:20',4,0,NULL,NULL,NULL,'88c4f217-bf94-4e84-9d4b-15f6747276ae'),(2143,'Public Transport - Moved to 2nd line','Public Transport - Moved to 2nd line','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Public Transport - Moved to 2nd line\n Public Transport - Moved to 2nd line\n \n 2023-04-03 21:05:57 UTC\n \n 2023-04-03 21:10:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2143\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:05:57',4,'2023-04-03 23:10:23',4,0,NULL,NULL,NULL,'3d87ffb3-cfb1-4ac5-bf47-dcb3193e133b'),(2144,'All TB Children (0-14 yrs) and Died','All TB Children (0-14 yrs) and Died','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Children (0-14 yrs) and Died\n All TB Children (0-14 yrs) and Died\n \n 2023-04-03 21:06:48 UTC\n \n 2023-04-03 21:08:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2144\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:06:48',4,'2023-04-03 23:08:55',4,0,NULL,NULL,NULL,'30a341a8-2bf8-4e91-a9ee-41b6826e2cef'),(2145,'Public Transport - Failed','Public Transport - Failed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Public Transport - Failed\n Public Transport - Failed\n \n 2023-04-03 21:07:43 UTC\n \n 2023-04-03 21:09:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2145\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:07:43',4,'2023-04-03 23:09:40',4,0,NULL,NULL,NULL,'e9843f95-15c2-4d15-bd2c-bdfc19bc4767'),(2146,'All TB Children (0-14 yrs) and Lost to follow up','All TB Children (0-14 yrs) and Lost to follow up','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Children (0-14 yrs) and Lost to follow up\n All TB Children (0-14 yrs) and Lost to follow up\n \n 2023-04-03 21:08:17 UTC\n \n 2023-04-03 21:16:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2146\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:08:17',4,'2023-04-03 23:16:59',4,0,NULL,NULL,NULL,'33f4111b-438c-4da8-bc56-0c588f408444'),(2147,'All TB Children (0-14 yrs) and failed','All TB Children (0-14 yrs) and failed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Children (0-14 yrs) and failed\n All TB Children (0-14 yrs) and failed\n \n 2023-04-03 21:09:49 UTC\n \n 2023-04-03 21:17:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2147\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:09:49',4,'2023-04-03 23:17:30',4,0,NULL,NULL,NULL,'af568cf8-77aa-4d45-ab4f-ca39418ba77d'),(2148,'HHCM - Completed','HHCM - Completed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM - Completed\n HHCM - Completed\n \n 2023-04-03 21:11:12 UTC\n \n 2023-04-03 21:13:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2148\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:11:12',4,'2023-04-03 23:13:17',4,0,NULL,NULL,NULL,'23d932aa-9c33-4aff-89ec-9028c25a03ef'),(2149,'All TB Children (0-14 yrs) and not evaluated','All TB Children (0-14 yrs) and not evaluated','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Children (0-14 yrs) and not evaluated\n All TB Children (0-14 yrs) and not evaluated\n \n 2023-04-03 21:12:28 UTC\n \n 2023-04-03 21:15:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2149\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:12:28',4,'2023-04-03 23:15:26',4,0,NULL,NULL,NULL,'12a47e2e-735f-4b72-9e0c-f9fc792f3fc8'),(2150,'HHCM - Failed','HHCM - Failed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM - Failed\n HHCM - Failed\n \n 2023-04-03 21:13:03 UTC\n \n 2023-04-03 21:35:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2150\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:13:03',4,'2023-04-03 23:35:08',4,0,NULL,NULL,NULL,'ce1c1a8e-9760-4a56-a885-4bc25de4f892'),(2151,'HHCM - Lost','HHCM - Lost','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM - Lost\n HHCM - Lost\n \n 2023-04-03 21:14:35 UTC\n \n 2023-04-03 21:36:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2151\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:14:35',4,'2023-04-03 23:36:26',4,0,NULL,NULL,NULL,'b9ee3b47-b5d7-42ed-9a47-4f61f77b6eeb'),(2152,'All TB Children (0-14 yrs) and moved to secondline treatment','All TB Children (0-14 yrs) and moved to secondline treatment','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Children (0-14 yrs) and moved to secondline treatment\n All TB Children (0-14 yrs) and moved to secondline treatment\n \n 2023-04-03 21:18:05 UTC\n \n 2023-04-03 21:30:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2152\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:18:05',4,'2023-04-03 23:30:14',4,0,NULL,NULL,NULL,'692b0f3e-9c3e-4a71-bba3-b6ae50963679'),(2153,'All TB Adolescent (10-19 yrs) and Completed','All TB Adolescent (10-19 yrs) and Completed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Adolescent (10-19 yrs) and Completed\n All TB Adolescent (10-19 yrs) and Completed\n \n 2023-04-03 21:27:45 UTC\n \n 2023-04-03 21:29:16 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2153\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:27:45',4,'2023-04-03 23:29:16',4,0,NULL,NULL,NULL,'ad3dbe97-3718-4885-a76d-36982b68f507'),(2154,'All TB Adolescent (10-19 yrs) and Cured','All TB Adolescent (10-19 yrs) and Cured','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Adolescent (10-19 yrs) and Cured\n All TB Adolescent (10-19 yrs) and Cured\n \n 2023-04-03 21:28:37 UTC\n \n 2023-04-03 21:30:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2154\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:28:37',4,'2023-04-03 23:30:39',4,0,NULL,NULL,NULL,'ee2cd03a-51b0-4f81-81cc-40ab687629a8'),(2155,'All TB Adolescent (10-19 yrs) and Died','All TB Adolescent (10-19 yrs) and Died','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Adolescent (10-19 yrs) and Died\n All TB Adolescent (10-19 yrs) and Died\n \n 2023-04-03 21:30:59 UTC\n \n 2023-04-03 21:33:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2155\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:30:59',4,'2023-04-03 23:33:07',4,0,NULL,NULL,NULL,'f27e06d5-38ff-443b-8ce0-3cebb07f2eec'),(2156,'All TB Adolescent (10-19 yrs) and Lost to follow up','All TB Adolescent (10-19 yrs) and Lost to follow up','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Adolescent (10-19 yrs) and Lost to follow up\n All TB Adolescent (10-19 yrs) and Lost to follow up\n \n 2023-04-03 21:31:24 UTC\n \n 2023-04-03 21:33:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2156\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:31:24',4,'2023-04-03 23:33:27',4,0,NULL,NULL,NULL,'b7f7dbd4-f089-4ac4-9bc5-4c750a016a6c'),(2157,'All TB Adolescent (10-19 yrs) and failed','All TB Adolescent (10-19 yrs) and failed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Adolescent (10-19 yrs) and failed\n All TB Adolescent (10-19 yrs) and failed\n \n 2023-04-03 21:31:48 UTC\n \n 2023-04-03 21:38:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2157\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:31:48',4,'2023-04-03 23:38:15',4,0,NULL,NULL,NULL,'6ab5cc07-88e8-4b34-9cb6-8d451336945a'),(2158,'All TB Adolescent (10-19 yrs) and Not Evaluated','All TB Adolescent (10-19 yrs) and Not Evaluated','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Adolescent (10-19 yrs) and Not Evaluated\n All TB Adolescent (10-19 yrs) and Not Evaluated\n \n 2023-04-03 21:34:28 UTC\n \n 2023-04-03 21:36:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2158\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:34:28',4,'2023-04-03 23:36:44',4,0,NULL,NULL,NULL,'4465b2b0-282f-4b7a-8acc-ba9018cf82ca'),(2159,'All TB Adolescent (10-19 yrs) and Moved to Secondline treatment','All TB Adolescent (10-19 yrs) and Moved to Secondline treatment','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Adolescent (10-19 yrs) and Moved to Secondline treatment\n All TB Adolescent (10-19 yrs) and Moved to Secondline treatment\n \n 2023-04-03 21:34:49 UTC\n \n 2023-04-03 21:37:16 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2159\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:34:49',4,'2023-04-03 23:37:16',4,0,NULL,NULL,NULL,'fc47f473-d8f7-4b44-b969-4aee12de4036'),(2160,'HHCM - Not Evaluated','HHCM - Not Evaluated','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM - Not Evaluated\n HHCM - Not Evaluated\n \n 2023-04-03 21:37:03 UTC\n \n 2023-04-03 21:42:22 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2160\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:37:03',4,'2023-04-03 23:42:22',4,0,NULL,NULL,NULL,'f801b15a-b96f-491f-a8b5-1fbee8ba9c83'),(2161,'Female and Completed','Female and Completed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Female and Completed\n Female and Completed\n \n 2023-04-03 21:37:55 UTC\n \n 2023-04-03 21:44:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2161\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:37:55',4,'2023-04-03 23:44:21',4,0,NULL,NULL,NULL,'615ab43e-7d60-462d-bab7-3ea00babd032'),(2162,'Female and Cured','Female and Cured','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Female and Cured\n Female and Cured\n \n 2023-04-03 21:38:38 UTC\n \n 2023-04-03 21:46:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2162\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:38:38',4,'2023-04-03 23:46:42',4,0,NULL,NULL,NULL,'807438e3-b735-4310-9e68-24f15521e66d'),(2163,'HHCM - Cured','HHCM - Cured','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM - Cured\n HHCM - Cured\n \n 2023-04-03 21:38:56 UTC\n \n 2023-04-03 21:42:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2163\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:38:56',4,'2023-04-03 23:42:00',4,0,NULL,NULL,NULL,'352d4e3a-8ea5-4848-a515-ea4a3a091d8f'),(2164,'TB Female and Died','TB Female and Died','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Female and Died\n TB Female and Died\n \n 2023-04-03 21:39:57 UTC\n \n 2023-04-03 21:47:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2164\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:39:57',4,'2023-04-03 23:47:30',4,0,NULL,NULL,NULL,'ab84625a-199b-4a80-99b9-9b89c8c02ba4'),(2165,'HHCM - Died','HHCM - Died','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM - Died\n HHCM - Died\n \n 2023-04-03 21:43:38 UTC\n \n 2023-04-03 21:46:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2165\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:43:38',4,'2023-04-03 23:46:59',4,0,NULL,NULL,NULL,'144c7351-4092-442d-ab8d-91cf1d13698c'),(2166,'HHCM - Moved to 2nd line','HHCM - Moved to 2nd line','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM - Moved to 2nd line\n HHCM - Moved to 2nd line\n \n 2023-04-03 21:44:32 UTC\n \n 2023-04-03 21:48:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2166\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:44:32',4,'2023-04-03 23:48:15',4,0,NULL,NULL,NULL,'a7391f1f-e1b2-415c-bde5-52d06b5616ad'),(2167,'TB Female and Lost to Follow up','TB Female and Lost to Follow up','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Female and Lost to Follow up\n TB Female and Lost to Follow up\n \n 2023-04-03 21:46:14 UTC\n \n 2023-04-03 21:48:16 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2167\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:46:14',4,'2023-04-03 23:48:16',4,0,NULL,NULL,NULL,'6ad8a1fc-9753-4d52-b40a-68c6c9089141'),(2168,'TB Female and Failed','TB Female and Failed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Female and Failed\n TB Female and Failed\n \n 2023-04-03 21:47:53 UTC\n \n 2023-04-03 21:49:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2168\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:47:53',4,'2023-04-03 23:49:44',4,0,NULL,NULL,NULL,'676800f0-5583-436b-b7ab-815f7d884f96'),(2169,'TB Female and Not Evaluated','TB Female and Not Evaluated','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Female and Not Evaluated\n TB Female and Not Evaluated\n \n 2023-04-03 21:48:58 UTC\n \n 2023-04-03 21:53:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2169\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:48:58',4,'2023-04-03 23:53:30',4,0,NULL,NULL,NULL,'67a2aa65-3b21-45f8-bdba-fe284d683360'),(2170,'TB Female and moved to secondline','TB Female and moved to secondline','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Female and moved to secondline\n TB Female and moved to secondline\n \n 2023-04-03 21:49:27 UTC\n \n 2023-04-03 21:51:19 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2170\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:49:27',4,'2023-04-03 23:51:19',4,0,NULL,NULL,NULL,'eac53c81-f295-41ae-989d-26f66888caae'),(2171,'HHXM - Completed','HHXM - Completed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM - Completed\n HHXM - Completed\n \n 2023-04-03 21:51:36 UTC\n \n 2023-04-03 21:56:49 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2171\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:51:36',4,'2023-04-03 23:56:49',4,0,NULL,NULL,NULL,'558ce9d9-35d7-4d49-8b41-f4c8cc979bdf'),(2172,'HHXM - Cured','HHXM - Cured','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM - Cured\n HHXM - Cured\n \n 2023-04-03 21:51:55 UTC\n \n 2023-04-03 21:57:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2172\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:51:55',4,'2023-04-03 23:57:44',4,0,NULL,NULL,NULL,'56f5154b-cb21-456b-8e13-508a0dc032ff'),(2173,'TB Mine Workers and completed','TB Mine Workers and completed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Mine Workers and completed\n TB Mine Workers and completed\n \n 2023-04-03 21:53:08 UTC\n \n 2023-04-03 21:56:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2173\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:53:08',4,'2023-04-03 23:56:07',4,0,NULL,NULL,NULL,'a54130b0-7643-4865-9a0e-6c70215d3046'),(2174,'TB Mine Workers and cured','TB Mine Workers and cured','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Mine Workers and cured\n TB Mine Workers and cured\n \n 2023-04-03 21:53:49 UTC\n \n 2023-04-03 21:57:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2174\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:53:49',4,'2023-04-03 23:57:45',4,0,NULL,NULL,NULL,'f5957799-79ad-4f08-9a68-c359c4b69ce3'),(2175,'TB Mine Workers and died','TB Mine Workers and died','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Mine Workers and died\n TB Mine Workers and died\n \n 2023-04-03 21:55:02 UTC\n \n 2023-04-03 21:57:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2175\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:55:02',4,'2023-04-03 23:57:23',4,0,NULL,NULL,NULL,'fc3c4c67-738d-403a-9584-bd4a17942c24'),(2176,'HHXM - Died','HHXM - Died','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM - Died\n HHXM - Died\n \n 2023-04-03 21:56:35 UTC\n \n 2023-04-03 21:59:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2176\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:56:35',4,'2023-04-03 23:59:44',4,0,NULL,NULL,NULL,'2aaeab53-7906-480f-a51b-ebc9077a28ac'),(2177,'TB Mine Workers and lost to follow up','TB Mine Workers and lost to follow up','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Mine Workers and lost to follow up\n TB Mine Workers and lost to follow up\n \n 2023-04-03 21:58:16 UTC\n \n 2023-04-03 22:05:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2177\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:58:16',4,'2023-04-04 00:05:17',4,0,NULL,NULL,NULL,'2d37e108-26d4-4c69-aa41-dbcb4298d209'),(2178,'HHXM - Not Evaluated','HHXM - Not Evaluated','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM - Not Evaluated\n HHXM - Not Evaluated\n \n 2023-04-03 21:58:28 UTC\n \n 2023-04-03 22:01:46 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2178\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:58:28',4,'2023-04-04 00:01:46',4,0,NULL,NULL,NULL,'ffa409cc-0ce1-4ca0-9971-e339c3d29f8c'),(2179,'TB Mine Workers and failed','TB Mine Workers and failed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Mine Workers and failed\n TB Mine Workers and failed\n \n 2023-04-03 21:58:31 UTC\n \n 2023-04-03 22:00:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2179\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:58:31',4,'2023-04-04 00:00:58',4,0,NULL,NULL,NULL,'f866bee9-323a-4a71-8e35-94cceaa3550d'),(2180,'TB Mine Workers and not evaluated','TB Mine Workers and not evaluated','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Mine Workers and not evaluated\n TB Mine Workers and not evaluated\n \n 2023-04-03 21:58:52 UTC\n \n 2023-04-03 22:04:47 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2180\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:58:52',4,'2023-04-04 00:04:47',4,0,NULL,NULL,NULL,'b2a2038e-f629-45ee-8033-f797caa6ac39'),(2181,'HHXM - Lost','HHXM - Lost','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM - Lost\n HHXM - Lost\n \n 2023-04-03 22:00:45 UTC\n \n 2023-04-03 22:04:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2181\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-04 00:00:45',4,'2023-04-04 00:04:15',4,0,NULL,NULL,NULL,'11bcf608-b1dd-492d-ba8a-cd3c9e19748f'),(2182,'HHXM - Failed','HHXM - Failed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM - Failed\n HHXM - Failed\n \n 2023-04-03 22:01:29 UTC\n \n 2023-04-03 22:11:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2182\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-04 00:01:29',4,'2023-04-04 00:11:06',4,0,NULL,NULL,NULL,'a10dc54c-654e-4f57-9df8-be1b14c50a14'),(2183,'TB Mine Workers and moved to secondline ','TB Mine Workers and moved to secondline ','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Mine Workers and moved to secondline \n TB Mine Workers and moved to secondline \n \n 2023-04-03 22:02:20 UTC\n \n 2023-04-03 22:11:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2183\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${endDate}\n \n \n \n','2023-04-04 00:02:20',4,'2023-04-04 00:11:10',4,0,NULL,NULL,NULL,'e07ad771-1ec2-4d4a-a085-5433cc94b7de'),(2184,'HHXM - Moved to 2nd Line','HHXM - Moved to 2nd Line','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM - Moved to 2nd Line\n HHXM - Moved to 2nd Line\n \n 2023-04-03 22:03:46 UTC\n \n 2023-04-03 22:08:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2184\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-04 00:03:46',4,'2023-04-04 00:08:51',4,0,NULL,NULL,NULL,'b12d1160-3ba1-4b39-92b9-e765d0d9fe55'),(2185,'TB Treatment Outcome - Block 1','TB Treatment Outcome - Block 1','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Treatment Outcome - Block 1\n TB Treatment Outcome - Block 1\n \n 2023-04-03 22:07:23 UTC\n \n 2023-04-03 22:07:54 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2185\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-04-04 00:07:23',4,'2023-04-04 00:07:54',4,0,NULL,NULL,NULL,'a7cfcef1-57f5-4fbc-8a24-77fac2b219bf'),(2186,'TB Treatment Outcome - Block 1 Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Treatment Outcome - Block 1 Data Set\n \n 2023-04-03 22:07:54 UTC\n \n 2023-04-04 12:21:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2186\n \n \n \n Fmale2nd\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n \n \n FmaleComp\n \n \n \n \n \n \n \n \n \n FmaleCured\n \n \n \n \n \n \n \n \n \n FmaleDied\n \n \n \n \n \n \n \n \n \n FmaleFaile\n \n \n \n \n \n \n \n \n \n FmaleLost\n \n \n \n \n \n \n \n \n \n FmaleNtEv\n \n \n \n \n \n \n \n \n \n Miner2nd\n \n \n \n \n \n \n \n \n \n MinerComp\n \n \n \n \n \n \n \n \n \n MinerCured\n \n \n \n \n \n \n \n \n \n MinerDied\n \n \n \n \n \n \n \n \n \n MinerFail\n \n \n \n \n \n \n \n \n \n MinerLost\n \n \n \n \n \n \n \n \n \n MinerNtEv\n \n \n \n \n \n \n \n \n \n NwRlps2nd\n \n \n \n \n \n \n \n \n \n NwRlpsComp\n \n \n \n \n \n \n \n \n \n NwRlpsCure\n \n \n \n \n \n \n \n \n \n NwRlpsDied\n \n \n \n \n \n \n \n \n \n NwRlpsLost\n \n \n \n \n \n \n \n \n \n NwRlpsNtEv\n \n \n \n \n \n \n \n \n \n NwRlpsfail\n \n \n \n \n \n \n \n \n \n RtrtEx2nd\n \n \n \n \n \n \n \n \n \n RtrtExComp\n \n \n \n \n \n \n \n \n \n RtrtExCure\n \n \n \n \n \n \n \n \n \n RtrtExDied\n \n \n \n \n \n \n \n \n \n RtrtExFail\n \n \n \n \n \n \n \n \n \n RtrtExLost\n \n \n \n \n \n \n \n \n \n RtrtExNtEv\n \n \n \n \n \n \n \n \n \n TBAdol2nd\n \n \n \n \n \n \n \n \n \n TBAdolComp\n \n \n \n \n \n \n \n \n \n TBAdolCure\n \n \n \n \n \n \n \n \n \n TBAdolDied\n \n \n \n \n \n \n \n \n \n TBAdolFail\n \n \n \n \n \n \n \n \n \n TBAdolLost\n \n \n \n \n \n \n \n \n \n TBAdolNtEv\n \n \n \n \n \n \n \n \n \n TBChld2nd\n \n \n \n \n \n \n \n \n \n TBChldCure\n \n \n \n \n \n \n \n \n \n TBChldDied\n \n \n \n \n \n \n \n \n \n TBChldFail\n \n \n \n \n \n \n \n \n \n TBChldLost\n \n \n \n \n \n \n \n \n \n TBChldNtEv\n \n \n \n \n \n \n \n \n \n TBNeg2nd\n \n \n \n \n \n \n \n \n \n TBNegCompl\n \n \n \n \n \n \n \n \n \n TBNegCured\n \n \n \n \n \n \n \n \n \n TBNegDied\n \n \n \n \n \n \n \n \n \n TBNegFaile\n \n \n \n \n \n \n \n \n \n TBNegLost\n \n \n \n \n \n \n \n \n \n TBNegNtEv\n \n \n \n \n \n \n \n \n \n TBPos2nd\n \n \n \n \n \n \n \n \n \n TBPosCompl\n \n \n \n \n \n \n \n \n \n TBPosCured\n \n \n \n \n \n \n \n \n \n TBPosDied\n \n \n \n \n \n \n \n \n \n TBPosFaile\n \n \n \n \n \n \n \n \n \n TBPosLost\n \n \n \n \n \n \n \n \n \n TBPosNtEv\n \n \n \n \n \n \n \n \n \n TbChldComp\n \n \n \n \n \n \n \n \n \n exM_comple\n \n \n \n \n \n \n \n \n \n exM_cured\n \n \n \n \n \n \n \n \n \n exM_died\n \n \n \n \n \n \n \n \n \n exM_failed\n \n \n \n \n \n \n \n \n \n exM_lost\n \n \n \n \n \n \n \n \n \n exM_moved\n \n \n \n \n \n \n \n \n \n exM_noteEv\n \n \n \n \n \n \n \n \n \n fact_Died\n \n \n \n \n \n \n \n \n \n fact_compl\n \n \n \n \n \n \n \n \n \n fact_cured\n \n \n \n \n \n \n fact_fail\n \n \n \n \n \n \n \n \n \n fact_lost\n \n \n \n \n \n \n \n \n \n fact_moved\n \n \n \n \n \n \n \n \n \n fact_notEv\n \n \n \n \n \n \n \n \n \n hcw_comple\n \n \n \n \n \n \n \n \n \n hcw_cured\n \n \n \n \n \n \n \n \n \n hcw_died\n \n \n \n \n \n \n \n \n \n hcw_failed\n \n \n \n \n \n \n \n \n \n hcw_lost\n \n \n \n \n \n \n \n \n \n hcw_moved\n \n \n \n \n \n \n \n \n \n hcw_notEva\n \n \n \n \n \n \n \n \n \n hhcm_compl\n \n \n \n \n \n \n \n \n \n hhcm_cured\n \n \n \n \n \n \n \n \n \n hhcm_died\n \n \n \n \n \n \n \n \n \n hhcm_evalu\n \n \n \n \n \n \n \n \n \n hhcm_faile\n \n \n \n \n \n \n \n \n \n hhcm_lost\n \n \n \n \n \n \n \n \n \n hhcm_moved\n \n \n \n \n \n \n \n \n \n hhx_comple\n \n \n \n \n \n \n \n \n \n hhxm_cured\n \n \n \n \n \n \n \n \n \n hhxm_died\n \n \n \n \n \n \n \n \n \n hhxm_faile\n \n \n \n \n \n \n \n \n \n hhxm_lost\n \n \n \n \n \n \n \n \n \n hhxm_moved\n \n \n \n \n \n \n \n \n \n hhxm_notEv\n \n \n \n \n \n \n \n \n \n ptran_comp\n \n \n \n \n \n \n \n \n \n ptran_cure\n \n \n \n \n \n \n \n \n \n ptran_died\n \n \n \n \n \n \n \n \n \n ptran_eval\n \n \n \n \n \n \n \n \n \n ptran_fail\n \n \n \n \n \n \n \n \n \n ptran_lost\n \n \n \n \n \n \n \n \n \n ptran_move\n \n \n \n \n \n \n \n \n \n','2023-04-04 00:07:54',4,'2023-04-04 14:21:10',4,0,NULL,NULL,NULL,'71fbb539-96d9-420c-9b3c-1edeab07e722'),(2187,'Children ARV Regimen_1stLine_4C','Children ARV Regimen_1stLine_Regimen disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4C\n Children ARV Regimen_1stLine_Regimen disaggregated by weight, sex, age\n \n 2023-07-26 13:30:34 UTC\n \n 2023-07-26 13:32:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2187\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-07-26 13:30:34',4,'2023-07-26 13:32:50',4,0,NULL,NULL,NULL,'f97eba59-b593-4225-8140-5bbe62c4a836'),(2188,'Children ARV Regimen_1stLine_4D','Children ARV Regimen_1stLine_4D disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4D\n Children ARV Regimen_1stLine_4D disaggregated by weight, sex, age\n \n 2023-07-26 13:30:39 UTC\n \n 2023-07-27 13:48:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2188\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-07-26 15:30:39',4,'2023-07-27 15:48:06',4,0,NULL,NULL,NULL,'f0f167bb-dc9e-4121-9ceb-a2268861062f'),(2189,'Children ARV Regimen_1stLine_Transition Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_Transition Data Set\n \n 2023-07-26 13:31:12 UTC\n \n 2023-08-14 12:41:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2189\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4>=35\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4y10-13\n \n \n \n \n \n \n \n \n \n F1-4y14-19\n \n \n \n \n \n \n \n \n \n F1-4y20-24\n \n \n \n \n \n \n \n \n \n F1-4y25-34\n \n \n \n \n \n \n \n \n \n F1-4yr0-3\n \n \n \n \n \n \n \n \n \n F1-4yr4-5\n \n \n \n \n \n \n \n \n \n F1-4yr6-9\n \n \n \n \n \n \n \n \n \n F10-14y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14y10-\n \n \n \n \n \n \n F10-14y14-\n \n \n \n \n \n \n F10-14y20-\n \n \n \n \n \n \n F10-14y25-\n \n \n \n \n \n \n F10-14y4-5\n \n \n \n \n \n \n F10-14y6-9\n \n \n \n \n \n \n F10-14y>=3\n \n \n \n \n \n \n F5-9y10-13\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9y14-19\n \n \n \n \n \n \n F5-9y20-24\n \n \n \n \n \n \n F5-9y25-34\n \n \n \n \n \n \n F5-9y>=35\n \n \n \n \n \n \n F5-9yr0-3\n \n \n \n \n \n \n F5-9yr4-5\n \n \n \n \n \n \n F5-9yr6-9\n \n \n \n \n \n \n F<1y10-13\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1y14-19\n \n \n \n \n \n \n F<1y20-24\n \n \n \n \n \n \n F<1y25-34\n \n \n \n \n \n \n F<1y>=35\n \n \n \n \n \n \n F<1yr0-3\n \n \n \n \n \n \n F<1yr4-5\n \n \n \n \n \n \n F<1yr6-9\n \n \n \n \n \n \n M1-4y10-13\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4y14-19\n \n \n \n \n \n \n M1-4y20-24\n \n \n \n \n \n \n M1-4y25-34\n \n \n \n \n \n \n M1-4y>=35\n \n \n \n \n \n \n M1-4yr0-3\n \n \n \n \n \n \n M1-4yr4-5\n \n \n \n \n \n \n M1-4yr6-9\n \n \n \n \n \n \n M10-14y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14y10-\n \n \n \n \n \n \n M10-14y14-\n \n \n \n \n \n \n M10-14y20-\n \n \n \n \n \n \n M10-14y25-\n \n \n \n \n \n \n M10-14y4-5\n \n \n \n \n \n \n M10-14y6-9\n \n \n \n \n \n \n M10-14y>=3\n \n \n \n \n \n \n M5-9y10-13\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9y14-19\n \n \n \n \n \n \n M5-9y20-24\n \n \n \n \n \n \n M5-9y25-34\n \n \n \n \n \n \n M5-9y>=35\n \n \n \n \n \n \n M5-9yr0-3\n \n \n \n \n \n \n M5-9yr4-5\n \n \n \n \n \n \n M5-9yr6-9\n \n \n \n \n \n \n M<1y14-19\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1y20-24\n \n \n \n \n \n \n M<1y25-34\n \n \n \n \n \n \n M<1y>=35\n \n \n \n \n \n \n M<1yr0-3\n \n \n \n \n \n \n M<1yr10-13\n \n \n \n \n \n \n M<1yr4-5\n \n \n \n \n \n \n M<1yr6-9\n \n \n \n \n \n \n','2023-07-26 13:31:12',4,'2023-08-14 12:41:44',4,0,NULL,NULL,NULL,'da04bec0-be82-45a6-9136-716f46837537'),(2190,'Children ARV Regimen_1stLine_Transition Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_Transition Data Set\n \n 2023-07-26 13:31:22 UTC\n \n 2023-08-14 13:10:49 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2190\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4yr0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4yr10-1\n \n \n \n \n \n \n \n \n \n F1-4yr14-1\n \n \n \n \n \n \n \n \n \n F1-4yr20-2\n \n \n \n \n \n \n \n \n \n F1-4yr25-3\n \n \n \n \n \n \n \n \n \n F1-4yr4-5\n \n \n \n \n \n \n \n \n \n F1-4yr6-9\n \n \n \n \n \n \n \n \n \n F1-4yr>=35\n \n \n \n \n \n \n \n \n \n F10-14yr0-\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14yr10\n \n \n \n \n \n \n F10-14yr14\n \n \n \n \n \n \n F10-14yr20\n \n \n \n \n \n \n F10-14yr25\n \n \n \n \n \n \n F10-14yr35\n \n \n \n \n \n \n F10-14yr4-\n \n \n \n \n \n \n F10-14yr6-\n \n \n \n \n \n \n F5-9yr0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9yr10-1\n \n \n \n \n \n \n F5-9yr14-1\n \n \n \n \n \n \n F5-9yr20-2\n \n \n \n \n \n \n F5-9yr25-3\n \n \n \n \n \n \n F5-9yr4-5\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9yr6-9\n \n \n \n \n \n \n F5-9yr>=35\n \n \n \n \n \n \n F<1yr0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1yr10-13\n \n \n \n \n \n \n F<1yr14-19\n \n \n \n \n \n \n F<1yr20-14\n \n \n \n \n \n \n F<1yr25-34\n \n \n \n \n \n \n F<1yr4-5\n \n \n \n \n \n \n F<1yr6-9\n \n \n \n \n \n \n F<1yr>=35\n \n \n \n \n \n \n M1-4yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4yr10-1\n \n \n \n \n \n \n M1-4yr14-1\n \n \n \n \n \n \n M1-4yr20-2\n \n \n \n \n \n \n M1-4yr25-3\n \n \n \n \n \n \n M1-4yr4-5\n \n \n \n \n \n \n M1-4yr6-9\n \n \n \n \n \n \n M1-4yr>=35\n \n \n \n \n \n \n M10-14yr0-\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14yr10\n \n \n \n \n \n \n M10-14yr14\n \n \n \n \n \n \n M10-14yr20\n \n \n \n \n \n \n M10-14yr25\n \n \n \n \n \n \n M10-14yr35\n \n \n \n \n \n \n M10-14yr4-\n \n \n \n \n \n \n M10-14yr6-\n \n \n \n \n \n \n M5-9yr0-3\n \n \n \n \n \n \n M5-9yr10-1\n \n \n \n \n \n \n M5-9yr14-1\n \n \n \n \n \n \n M5-9yr20-2\n \n \n \n \n \n \n M5-9yr25-3\n \n \n \n \n \n \n M5-9yr4-5\n \n \n \n \n \n \n M5-9yr6-9\n \n \n \n \n \n \n M5-9yr>=35\n \n \n \n \n \n \n M<1yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1yr10-13\n \n \n \n \n \n \n M<1yr14-19\n \n \n \n \n \n \n M<1yr20-24\n \n \n \n \n \n \n M<1yr25-34\n \n \n \n \n \n \n M<1yr4-5\n \n \n \n \n \n \n M<1yr6-9\n \n \n \n \n \n \n M<1yr>=35\n \n \n \n \n \n \n','2023-07-26 13:31:22',4,'2023-08-14 13:10:49',4,0,NULL,NULL,NULL,'5de7def7-e11b-404b-b30a-1dd8dab09558'),(2191,'Children ARV Regimen_1stLine_4E','Children ARV Regimen_1stLine_4E','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4E\n Children ARV Regimen_1stLine_4E\n \n 2023-07-28 07:21:30 UTC\n \n 2023-07-28 07:21:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2191\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-07-28 09:21:30',4,'2023-07-28 09:21:51',4,0,NULL,NULL,NULL,'e3824d29-b132-4875-b0a9-b5dea1536b22'),(2192,'Children ARV Regimen_1stLine_4E Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4E Data Set\n \n 2023-07-28 07:21:51 UTC\n \n 2023-08-14 15:40:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2192\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4y0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4y10-13\n \n \n \n \n \n \n \n \n \n F1-4y14-19\n \n \n \n \n \n \n \n \n \n F1-4y20-24\n \n \n \n \n \n \n \n \n \n F1-4y25-34\n \n \n \n \n \n \n \n \n \n F1-4y35>=\n \n \n \n \n \n \n \n \n \n F1-4y4-5\n \n \n \n \n \n \n \n \n \n F1-4y6-9\n \n \n \n \n \n \n \n \n \n F10-14y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14y10-\n \n \n \n \n \n \n F10-14y14-\n \n \n \n \n \n \n F10-14y20-\n \n \n \n \n \n \n F10-14y25-\n \n \n \n \n \n \n F10-14y35>\n \n \n \n \n \n \n F10-14y4-5\n \n \n \n \n \n \n F10-14y6-9\n \n \n \n \n \n \n F5-9y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9y10-13\n \n \n \n \n \n \n F5-9y14-19\n \n \n \n \n \n \n F5-9y20-24\n \n \n \n \n \n \n F5-9y25-34\n \n \n \n \n \n \n F5-9y35>=\n \n \n \n \n \n \n F5-9y4-5\n \n \n \n \n \n \n F5-9y6-9\n \n \n \n \n \n \n F<1y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1y10-13\n \n \n \n \n \n \n F<1y14-19\n \n \n \n \n \n \n F<1y20-24\n \n \n \n \n \n \n F<1y25-34\n \n \n \n \n \n \n F<1y35>=\n \n \n \n \n \n \n F<1y4-5\n \n \n \n \n \n \n F<1y6-9\n \n \n \n \n \n \n M1-4Y25-34\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4y0-3\n \n \n \n \n \n \n M1-4y10-13\n \n \n \n \n \n \n M1-4y14-19\n \n \n \n \n \n \n M1-4y20-24\n \n \n \n \n \n \n M1-4y35>=\n \n \n \n \n \n \n M1-4y4-5\n \n \n \n \n \n \n M1-4y6-9\n \n \n \n \n \n \n M10-14y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14y10-\n \n \n \n \n \n \n M10-14y14-\n \n \n \n \n \n \n M10-14y20-\n \n \n \n \n \n \n M10-14y25-\n \n \n \n \n \n \n M10-14y35>\n \n \n \n \n \n \n M10-14y4-5\n \n \n \n \n \n \n M10-14y6-9\n \n \n \n \n \n \n M5-9y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9y10-13\n \n \n \n \n \n \n M5-9y14-19\n \n \n \n \n \n \n M5-9y20-24\n \n \n \n \n \n \n M5-9y25-34\n \n \n \n \n \n \n M5-9y35>=\n \n \n \n \n \n \n M5-9y4-5\n \n \n \n \n \n \n M5-9y6-9\n \n \n \n \n \n \n M<1y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1y10-13\n \n \n \n \n \n \n M<1y14-19\n \n \n \n \n \n \n M<1y20-24\n \n \n \n \n \n \n M<1y25-34\n \n \n \n \n \n \n M<1y35>=\n \n \n \n \n \n \n M<1y4-5\n \n \n \n \n \n \n M<1y6-9\n \n \n \n \n \n \n','2023-07-28 07:21:51',4,'2023-08-14 15:40:40',4,0,NULL,NULL,NULL,'27162fa8-89a6-405a-b3c2-d79250d1fa72'),(2194,'Children ARV Regimen_1stLine_4E Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4E Data Set\n \n 2023-07-28 07:29:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n \n \n','2023-07-28 09:29:51',4,NULL,NULL,0,NULL,NULL,NULL,'4c11a721-c504-4075-a7aa-68b823c3d7cb'),(2196,'Children ARV Regimen_1stLine_4F','Children ARV Regimen_1stLine_4F disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4F\n Children ARV Regimen_1stLine_4F disaggregated by weight, sex, age\n \n 2023-07-28 07:58:35 UTC\n \n 2023-07-28 07:59:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2196\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-07-28 09:58:35',4,'2023-07-28 09:59:11',4,0,NULL,NULL,NULL,'0ee0e4f3-4bf0-43ee-be59-cb45d9ab0328'),(2197,'Children ARV Regimen_1stLine_4F Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4F Data Set\n \n 2023-07-28 07:59:11 UTC\n \n 2023-08-14 16:08:09 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2197\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4>=35\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4y0-3\n \n \n \n \n \n \n \n \n \n F1-4y10-13\n \n \n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F1-4y14-19\n \n \n \n \n \n \n \n \n \n F1-4y20-24\n \n \n \n \n \n \n \n \n \n F1-4y25-34\n \n \n \n \n \n \n \n \n \n F1-4y4-5\n \n \n \n \n \n \n \n \n \n F1-4y6-9\n \n \n \n \n \n \n \n \n \n F10-14y0-3\n \n \n \n \n \n \n F10-14y10-\n \n \n \n \n \n \n F10-14y14-\n \n \n \n \n \n \n F10-14y20-\n \n \n \n \n \n \n F10-14y25-\n \n \n \n \n \n \n F10-14y4-5\n \n \n \n \n \n \n F10-14y6-9\n \n \n \n \n \n \n F10-14y>=3\n \n \n \n \n \n \n F5-9y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9y10-13\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9y14-19\n \n \n \n \n \n \n F5-9y20-24\n \n \n \n \n \n \n F5-9y25-34\n \n \n \n \n \n \n F5-9y4-5\n \n \n \n \n \n \n F5-9y6-9\n \n \n \n \n \n \n F5-9y>=35\n \n \n \n \n \n \n F<1y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1y10-13\n \n \n \n \n \n \n F<1y14-19\n \n \n \n \n \n \n F<1y20-24\n \n \n \n \n \n \n F<1y25-34\n \n \n \n \n \n \n F<1y4-5\n \n \n \n \n \n \n F<1y6-9\n \n \n \n \n \n \n F<1y>=35\n \n \n \n \n \n \n M1-4y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4y10-13\n \n \n \n \n \n \n M1-4y14-19\n \n \n \n \n \n \n M1-4y20-24\n \n \n \n \n \n \n M1-4y25-34\n \n \n \n \n \n \n M1-4y4-5\n \n \n \n \n \n \n M1-4y6-9\n \n \n \n \n \n \n M1-4y>=35\n \n \n \n \n \n \n M10-14y\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14y0-3\n \n \n \n \n \n \n M10-14y10-\n \n \n \n \n \n \n M10-14y14-\n \n \n \n \n \n \n M10-14y25-\n \n \n \n \n \n \n M10-14y4-5\n \n \n \n \n \n \n M10-14y6-9\n \n \n \n \n \n \n M10-14y>=3\n \n \n \n \n \n \n M5-9y0-3\n \n \n \n \n \n \n M5-9y10-13\n \n \n \n \n \n \n M5-9y14-19\n \n \n \n \n \n \n M5-9y20-24\n \n \n \n \n \n \n M5-9y25-34\n \n \n \n \n \n \n M5-9y4-5\n \n \n \n \n \n \n M5-9y6-9\n \n \n \n \n \n \n M5-9y>=35\n \n \n \n \n \n \n M<1y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1y10-13\n \n \n \n \n \n \n M<1y14-19\n \n \n \n \n \n \n M<1y20-24\n \n \n \n \n \n \n M<1y25-34\n \n \n \n \n \n \n M<1y4-5\n \n \n \n \n \n \n M<1y6-9\n \n \n \n \n \n \n M<1y>=35\n \n \n \n \n \n \n','2023-07-28 07:59:11',4,'2023-08-14 16:08:09',4,0,NULL,NULL,NULL,'88a32f53-ea23-4ad9-9673-98bde635a960'),(2198,'Children ARV Regimen_1stLine_4G','Children ARV Regimen_1stLine_4G','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4G\n Children ARV Regimen_1stLine_4G\n \n 2023-07-28 10:06:07 UTC\n \n 2023-07-28 10:06:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2198\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-07-28 12:06:07',4,'2023-07-28 12:06:18',4,0,NULL,NULL,NULL,'0827caea-7bbc-4d28-b47d-e04cebd43d96'),(2199,'Children ARV Regimen_1stLine_4G Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4G Data Set\n \n 2023-07-28 10:06:18 UTC\n \n 2023-08-14 16:22:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2199\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4y0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4y10-13\n \n \n \n \n \n \n \n \n \n F1-4y14-19\n \n \n \n \n \n \n \n \n \n F1-4y20-24\n \n \n \n \n \n \n \n \n \n F1-4y25-34\n \n \n \n \n \n \n \n \n \n F1-4y35>=\n \n \n \n \n \n \n \n \n \n F1-4y4-5\n \n \n \n \n \n \n \n \n \n F1-4y6-9\n \n \n \n \n \n \n \n \n \n F10-14y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14y10-\n \n \n \n \n \n \n F10-14y14-\n \n \n \n \n \n \n F10-14y20-\n \n \n \n \n \n \n F10-14y25-\n \n \n \n \n \n \n F10-14y35>\n \n \n \n \n \n \n F10-14y4-5\n \n \n \n \n \n \n F10-14y6-9\n \n \n \n \n \n \n F5-9y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9y10-13\n \n \n \n \n \n \n F5-9y14-19\n \n \n \n \n \n \n F5-9y20-24\n \n \n \n \n \n \n F5-9y25-34\n \n \n \n \n \n \n F5-9y35>=\n \n \n \n \n \n \n F5-9y4-5\n \n \n \n \n \n \n F5-9y6-9\n \n \n \n \n \n \n F<1y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1y10-13\n \n \n \n \n \n \n F<1y14-19\n \n \n \n \n \n \n F<1y20-24\n \n \n \n \n \n \n F<1y25-34\n \n \n \n \n \n \n F<1y35>=\n \n \n \n \n \n \n F<1y4-5\n \n \n \n \n \n \n F<1y6-9\n \n \n \n \n \n \n M1-4y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4y10-13\n \n \n \n \n \n \n M1-4y14-19\n \n \n \n \n \n \n M1-4y20-24\n \n \n \n \n \n \n M1-4y25-34\n \n \n \n \n \n \n M1-4y35>=\n \n \n \n \n \n \n M1-4y4-5\n \n \n \n \n \n \n M1-4y6-9\n \n \n \n \n \n \n M10-14y-25\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14y0-3\n \n \n \n \n \n \n M10-14y10-\n \n \n \n \n \n \n M10-14y14-\n \n \n \n \n \n \n M10-14y20-\n \n \n \n \n \n \n M10-14y35>\n \n \n \n \n \n \n M10-14y4-5\n \n \n \n \n \n \n M10-14y6-9\n \n \n \n \n \n \n M5-9y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9y10-13\n \n \n \n \n \n \n M5-9y14-19\n \n \n \n \n \n \n M5-9y20-24\n \n \n \n \n \n \n M5-9y25-34\n \n \n \n \n \n \n M5-9y35>=\n \n \n \n \n \n \n M5-9y4-5\n \n \n \n \n \n \n M5-9y6-9\n \n \n \n \n \n \n M<1y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1y10-13\n \n \n \n \n \n \n M<1y14-19\n \n \n \n \n \n \n M<1y20-24\n \n \n \n \n \n \n M<1y24-34\n \n \n \n \n \n \n M<1y35>=\n \n \n \n \n \n \n M<1y4-5\n \n \n \n \n \n \n M<1y6-9\n \n \n \n \n \n \n','2023-07-28 10:06:18',4,'2023-08-14 16:22:43',4,0,NULL,NULL,NULL,'f61713b8-60c1-48f1-bab8-d0bf3046b3e1'),(2200,'Children ARV Regimen_1stLine_4H','Children ARV Regimen_1stLine_4H','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4H\n Children ARV Regimen_1stLine_4H\n \n 2023-07-28 10:19:42 UTC\n \n 2023-07-28 10:19:49 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2200\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-07-28 12:19:42',4,'2023-07-28 12:19:49',4,0,NULL,NULL,NULL,'f672b96f-7df9-48fa-b49e-a9946b7540e8'),(2201,'Children ARV Regimen_1stLine_4H Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4H Data Set\n \n 2023-07-28 10:19:49 UTC\n \n 2023-08-14 16:43:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2201\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4yr0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4yr10-1\n \n \n \n \n \n \n \n \n \n F1-4yr14-1\n \n \n \n \n \n \n \n \n \n F1-4yr20-2\n \n \n \n \n \n \n \n \n \n F1-4yr25-3\n \n \n \n \n \n \n \n \n \n F1-4yr4-5\n \n \n \n \n \n \n \n \n \n F1-4yr6-9\n \n \n \n \n \n \n \n \n \n F1-4yr>=35\n \n \n \n \n \n \n \n \n \n F10-14yr0-\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14yr10\n \n \n \n \n \n \n F10-14yr14\n \n \n \n \n \n \n F10-14yr20\n \n \n \n \n \n \n F10-14yr25\n \n \n \n \n \n \n F10-14yr35\n \n \n \n \n \n \n F10-14yr4-\n \n \n \n \n \n \n F10-14yr6-\n \n \n \n \n \n \n F5-9yr0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9yr10-1\n \n \n \n \n \n \n F5-9yr14-1\n \n \n \n \n \n \n F5-9yr20-2\n \n \n \n \n \n \n F5-9yr25-3\n \n \n \n \n \n \n F5-9yr4-5\n \n \n \n \n \n \n F5-9yr6-9\n \n \n \n \n \n \n F5-9yr>=35\n \n \n \n \n \n \n F<1yr0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1yr10-13\n \n \n \n \n \n \n F<1yr14-19\n \n \n \n \n \n \n F<1yr20-24\n \n \n \n \n \n \n F<1yr25-34\n \n \n \n \n \n \n F<1yr4-5\n \n \n \n \n \n \n F<1yr6-9\n \n \n \n \n \n \n F<1yr>=35\n \n \n \n \n \n \n M1-4yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4yr10-1\n \n \n \n \n \n \n M1-4yr14-1\n \n \n \n \n \n \n M1-4yr20-2\n \n \n \n \n \n \n M1-4yr25-3\n \n \n \n \n \n \n M1-4yr4-5\n \n \n \n \n \n \n M1-4yr6-9\n \n \n \n \n \n \n M1-4yr>=35\n \n \n \n \n \n \n M10-14yr0-\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14yr10\n \n \n \n \n \n \n M10-14yr14\n \n \n \n \n \n \n M10-14yr20\n \n \n \n \n \n \n M10-14yr25\n \n \n \n \n \n \n M10-14yr35\n \n \n \n \n \n \n M10-14yr4-\n \n \n \n \n \n \n M10-14yr6-\n \n \n \n \n \n \n M5-9yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9yr10-1\n \n \n \n \n \n \n M5-9yr14-1\n \n \n \n \n \n \n M5-9yr20-2\n \n \n \n \n \n \n M5-9yr25-3\n \n \n \n \n \n \n M5-9yr4-5\n \n \n \n \n \n \n M5-9yr6-9\n \n \n \n \n \n \n M5-9yr>=35\n \n \n \n \n \n \n M<1yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1yr10-13\n \n \n \n \n \n \n M<1yr14-19\n \n \n \n \n \n \n M<1yr20-24\n \n \n \n \n \n \n M<1yr25-34\n \n \n \n \n \n \n M<1yr4-5\n \n \n \n \n \n \n M<1yr6-9\n \n \n \n \n \n \n M<1yr>=35\n \n \n \n \n \n \n','2023-07-28 10:19:49',4,'2023-08-14 16:43:42',4,0,NULL,NULL,NULL,'014c9e79-d8d0-4226-8d86-869e879fb6ce'),(2202,'Children ARV Regimen_1stLine_4J',' Children ARV Regimen_1stLine_4J disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4J\n Children ARV Regimen_1stLine_4J disaggregated by weight, sex, age\n \n 2023-07-28 10:40:17 UTC\n \n 2023-07-28 10:40:24 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2202\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-07-28 12:40:17',4,'2023-07-28 12:40:24',4,0,NULL,NULL,NULL,'4390ec11-9cbe-42bd-888e-e681da953912'),(2203,'Children ARV Regimen_1stLine_4J Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4J Data Set\n \n 2023-07-28 10:40:24 UTC\n \n 2023-08-14 17:17:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2203\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4y0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4y10-13\n \n \n \n \n \n \n \n \n \n F1-4y14-19\n \n \n \n \n \n \n \n \n \n F1-4y20-24\n \n \n \n \n \n \n \n \n \n F1-4y25-34\n \n \n \n \n \n \n \n \n \n F1-4y35>=\n \n \n \n \n \n \n \n \n \n F1-4y4-5\n \n \n \n \n \n \n \n \n \n F1-4y6-9\n \n \n \n \n \n \n \n \n \n F10-14y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14y10-\n \n \n \n \n \n \n F10-14y14-\n \n \n \n \n \n \n F10-14y20-\n \n \n \n \n \n \n F10-14y25-\n \n \n \n \n \n \n F10-14y35>\n \n \n \n \n \n \n F10-14y4-5\n \n \n \n \n \n \n F10-14y6-9\n \n \n \n \n \n \n F5-9y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9y10-13\n \n \n \n \n \n \n F5-9y14-19\n \n \n \n \n \n \n F5-9y20-24\n \n \n \n \n \n \n F5-9y25-34\n \n \n \n \n \n \n F5-9y35>=\n \n \n \n \n \n \n F5-9y4-5\n \n \n \n \n \n \n F5-9y6-9\n \n \n \n \n \n \n F<1y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1y10-13\n \n \n \n \n \n \n F<1y14-19\n \n \n \n \n \n \n F<1y20-24\n \n \n \n \n \n \n F<1y25-34\n \n \n \n \n \n \n F<1y35>=\n \n \n \n \n \n \n F<1y6-9\n \n \n \n \n \n \n F<1yr4-5\n \n \n \n \n \n \n M1-4y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4y10-13\n \n \n \n \n \n \n M1-4y14-19\n \n \n \n \n \n \n M1-4y20-24\n \n \n \n \n \n \n M1-4y25-34\n \n \n \n \n \n \n M1-4y35>=\n \n \n \n \n \n \n M1-4y4-5\n \n \n \n \n \n \n M1-4y6-9\n \n \n \n \n \n \n M10-14y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14y10-\n \n \n \n \n \n \n M10-14y14-\n \n \n \n \n \n \n M10-14y20-\n \n \n \n \n \n \n M10-14y25-\n \n \n \n \n \n \n M10-14y35>\n \n \n \n \n \n \n M10-14y4-5\n \n \n \n \n \n \n M10-14y6-9\n \n \n \n \n \n \n M5-9y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9y10-13\n \n \n \n \n \n \n M5-9y14-19\n \n \n \n \n \n \n M5-9y20-24\n \n \n \n \n \n \n M5-9y25-34\n \n \n \n \n \n \n M5-9y35>=\n \n \n \n \n \n \n M5-9y4-5\n \n \n \n \n \n \n M5-9y6-9\n \n \n \n \n \n \n M<1y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1y10-13\n \n \n \n \n \n \n M<1y14-19\n \n \n \n \n \n \n M<1y20-24\n \n \n \n \n \n \n M<1y25-34\n \n \n \n \n \n \n M<1y35>=\n \n \n \n \n \n \n M<1y6-9\n \n \n \n \n \n \n M<1yr4-5\n \n \n \n \n \n \n','2023-07-28 10:40:24',4,'2023-08-14 17:17:03',4,0,NULL,NULL,NULL,'b1b5ff26-4220-44b4-856e-88b7e9d39451'),(2204,'Children ARV Regimen_1stLine_4K','Children ARV Regimen_1stLine_4K disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4K\n Children ARV Regimen_1stLine_4K disaggregated by weight, sex, age\n \n 2023-07-31 11:04:52 UTC\n \n 2023-07-31 11:04:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2204\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-07-31 13:04:52',4,'2023-07-31 13:04:59',4,0,NULL,NULL,NULL,'635157c8-9203-475c-bc08-998a880fa244'),(2205,'Children ARV Regimen_1stLine_4K Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4K Data Set\n \n 2023-07-31 11:04:59 UTC\n \n 2023-08-14 17:30:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2205\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4>=35\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4y0-3\n \n \n \n \n \n \n \n \n \n F1-4y10-13\n \n \n \n \n \n \n \n \n \n F1-4y14-19\n \n \n \n \n \n \n \n \n \n F1-4y20-24\n \n \n \n \n \n \n \n \n \n F1-4y25-34\n \n \n \n \n \n \n \n \n \n F1-4y4-5\n \n \n \n \n \n \n \n \n \n F1-4y6-9\n \n \n \n \n \n \n \n \n \n F10-14y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14y10-\n \n \n \n \n \n \n F10-14y14-\n \n \n \n \n \n \n F10-14y20-\n \n \n \n \n \n \n F10-14y25-\n \n \n \n \n \n \n F10-14y4-5\n \n \n \n \n \n \n F10-14y6-9\n \n \n \n \n \n \n F10-14y>=3\n \n \n \n \n \n \n F5-9y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9y10-13\n \n \n \n \n \n \n F5-9y14-19\n \n \n \n \n \n \n F5-9y20-24\n \n \n \n \n \n \n F5-9y25-34\n \n \n \n \n \n \n F5-9y4-5\n \n \n \n \n \n \n F5-9y6-9\n \n \n \n \n \n \n F5-9y>=35\n \n \n \n \n \n \n F<1y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1y10-13\n \n \n \n \n \n \n F<1y14-19\n \n \n \n \n \n \n F<1y20-24\n \n \n \n \n \n \n F<1y25-34\n \n \n \n \n \n \n F<1y4-5\n \n \n \n \n \n \n F<1y6-9\n \n \n \n \n \n \n F<1y>=35\n \n \n \n \n \n \n M1-4y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4y10-13\n \n \n \n \n \n \n M1-4y14-19\n \n \n \n \n \n \n M1-4y20-24\n \n \n \n \n \n \n M1-4y25-34\n \n \n \n \n \n \n M1-4y4-5\n \n \n \n \n \n \n M1-4y6-9\n \n \n \n \n \n \n M1-4y>=35\n \n \n \n \n \n \n M10-14y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14y10-\n \n \n \n \n \n \n M10-14y14-\n \n \n \n \n \n \n M10-14y20-\n \n \n \n \n \n \n M10-14y25-\n \n \n \n \n \n \n M10-14y4-5\n \n \n \n \n \n \n M10-14y6-9\n \n \n \n \n \n \n M10-14y>=3\n \n \n \n \n \n \n M5-9y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9y10-13\n \n \n \n \n \n \n M5-9y14-19\n \n \n \n \n \n \n M5-9y20-24\n \n \n \n \n \n \n M5-9y25-34\n \n \n \n \n \n \n M5-9y4-5\n \n \n \n \n \n \n M5-9y6-9\n \n \n \n \n \n \n M5-9y>=35\n \n \n \n \n \n \n M<1y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1y10-13\n \n \n \n \n \n \n M<1y14-19\n \n \n \n \n \n \n M<1y20-24\n \n \n \n \n \n \n M<1y25-34\n \n \n \n \n \n \n M<1y4-5\n \n \n \n \n \n \n M<1y6-9\n \n \n \n \n \n \n M<1y>=35\n \n \n \n \n \n \n','2023-07-31 11:04:59',4,'2023-08-14 17:30:12',4,0,NULL,NULL,NULL,'a3a4b9a1-0d71-4c08-9e4e-486f87840b6e'),(2206,'Children ARV Regimen_1stLine_4L','Children ARV Regimen_1stLine_4L','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4L\n Children ARV Regimen_1stLine_4L\n \n 2023-07-31 11:19:07 UTC\n \n 2023-07-31 11:19:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2206\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-07-31 13:19:07',4,'2023-07-31 13:19:14',4,0,NULL,NULL,NULL,'646bc981-856b-4f66-b545-eb5843952af7'),(2207,'Children ARV Regimen_1stLine_4L Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4L Data Set\n \n 2023-07-31 11:19:14 UTC\n \n 2023-08-14 17:43:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2207\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4yr0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4yr10-1\n \n \n \n \n \n \n \n \n \n F1-4yr14-1\n \n \n \n \n \n \n \n \n \n F1-4yr20-2\n \n \n \n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4yr25-3\n \n \n \n \n \n \n \n \n \n F1-4yr4-5\n \n \n \n \n \n \n \n \n \n F1-4yr6-9\n \n \n \n \n \n \n \n \n \n F1-4yr>=35\n \n \n \n \n \n \n \n \n \n F10-14yr0-\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14yr10\n \n \n \n \n \n \n F10-14yr14\n \n \n \n \n \n \n F10-14yr20\n \n \n \n \n \n \n F10-14yr25\n \n \n \n \n \n \n F10-14yr35\n \n \n \n \n \n \n F10-14yr4-\n \n \n \n \n \n \n F10-14yr6-\n \n \n \n \n \n \n F5-9yr0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9yr10-1\n \n \n \n \n \n \n F5-9yr14-1\n \n \n \n \n \n \n F5-9yr20-2\n \n \n \n \n \n \n F5-9yr25-3\n \n \n \n \n \n \n F5-9yr4-5\n \n \n \n \n \n \n F5-9yr6-9\n \n \n \n \n \n \n F5-9yr>=35\n \n \n \n \n \n \n F<1yr0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1yr10-13\n \n \n \n \n \n \n F<1yr14-19\n \n \n \n \n \n \n F<1yr20-24\n \n \n \n \n \n \n F<1yr25-34\n \n \n \n \n \n \n F<1yr4-5\n \n \n \n \n \n \n F<1yr6-9\n \n \n \n \n \n \n F<1yr>=35\n \n \n \n \n \n \n M1-4yr0-3\n \n \n \n \n \n \n M1-4yr10-1\n \n \n \n \n \n \n M1-4yr14-1\n \n \n \n \n \n \n M1-4yr20-2\n \n \n \n \n \n \n M1-4yr25-3\n \n \n \n \n \n \n M1-4yr4-5\n \n \n \n \n \n \n M1-4yr6-9\n \n \n \n \n \n \n M1-4yr>=35\n \n \n \n \n \n \n M10-14yr0-\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14yr10\n \n \n \n \n \n \n M10-14yr14\n \n \n \n \n \n \n M10-14yr20\n \n \n \n \n \n \n M10-14yr25\n \n \n \n \n \n \n M10-14yr35\n \n \n \n \n \n \n M10-14yr4-\n \n \n \n \n \n \n M10-14yr6-\n \n \n \n \n \n \n M5-9yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9yr10-1\n \n \n \n \n \n \n M5-9yr14-1\n \n \n \n \n \n \n M5-9yr20-2\n \n \n \n \n \n \n M5-9yr25-3\n \n \n \n \n \n \n M5-9yr4-5\n \n \n \n \n \n \n M5-9yr6-9\n \n \n \n \n \n \n M5-9yr>=35\n \n \n \n \n \n \n M<1yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1yr10-13\n \n \n \n \n \n \n M<1yr14-19\n \n \n \n \n \n \n M<1yr20-24\n \n \n \n \n \n \n M<1yr25-34\n \n \n \n \n \n \n M<1yr4-5\n \n \n \n \n \n \n M<1yr6-9\n \n \n \n \n \n \n M<1yr>=35\n \n \n \n \n \n \n','2023-07-31 11:19:14',4,'2023-08-14 17:43:21',4,0,NULL,NULL,NULL,'f228bb0b-0af6-48b3-afeb-8b1e4e21feb3'),(2208,'Clients given 4C with >=20 copies viral load','Clients given 4C with >=20 copies viral load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C with >=20 copies viral load\n Clients given 4C with >=20 copies viral load\n \n 2023-08-07 11:49:27 UTC\n \n 2023-08-14 11:19:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2208\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2202)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \n \n \non Active_Patients.Id = greaterThan20.Id \n)) \n \n\n','2023-08-07 11:49:27',4,'2023-08-14 11:19:55',4,0,NULL,NULL,NULL,'5a765ffd-b4ff-4899-ba79-aae76385d5d9'),(2209,'Clients given 4C with >=20 copies viral load','Clients given 4C with >=20 copies viral load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C with >=20 copies viral load\n Clients given 4C with >=20 copies viral load\n \n 2023-08-07 14:15:14 UTC\n \n 2023-08-07 14:18:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2209\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 16:15:14',4,'2023-08-07 16:18:06',4,0,NULL,NULL,NULL,'6942c194-b069-44c3-a161-b77891d7f06c'),(2210,'Children ARV Regimen_1stLine_Viral_Load','Children ARV Regimen_1stLine_Viral_Load','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_Viral_Load\n Children ARV Regimen_1stLine_Viral_Load\n \n 2023-08-07 14:19:54 UTC\n \n 2023-08-08 20:10:19 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2210\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-07 16:19:54',4,'2023-08-08 22:10:19',4,0,NULL,NULL,NULL,'400088e7-a254-4fac-8a59-eac6dc9d177b'),(2211,'Children ARV Regimen_1stLine_4C_>20Copies_Viraload Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4C_>20Copies_Viraload Data Set\n \n 2023-08-07 14:20:07 UTC\n \n 2023-12-20 07:10:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2211\n \n \n \n 4C<20\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n \n \n 4C>=20\n \n \n \n \n \n \n \n \n \n 4CUndetect\n \n \n \n \n \n \n \n \n \n 4D<20\n \n \n \n \n \n \n \n \n \n 4D>=20\n \n \n \n \n \n \n \n \n \n 4DUndetect\n \n \n \n \n \n \n \n \n \n 4E<20\n \n \n \n \n \n \n \n \n \n 4E>=20\n \n \n \n \n \n \n \n \n \n 4EUndetect\n \n \n \n \n \n \n \n \n \n 4F<20\n \n \n \n \n \n \n \n \n \n 4F>=20\n \n \n \n \n \n \n \n \n \n 4FUndetect\n \n \n \n \n \n \n \n \n \n 4G<20\n \n \n \n \n \n \n \n \n \n 4G>=20\n \n \n \n \n \n \n \n \n \n 4GUndetect\n \n \n \n \n \n \n \n \n \n 4H<20\n \n \n \n \n \n \n \n \n \n 4H>=20\n \n \n \n \n \n \n \n \n \n 4HUndetect\n \n \n \n \n \n \n \n \n \n 4J<20\n \n \n \n \n \n \n \n \n \n 4J>=20\n \n \n \n \n \n \n \n \n \n 4JUndetect\n \n \n \n \n \n \n \n \n \n 4K<20\n \n \n \n \n \n \n \n \n \n 4K>=20\n \n \n \n \n \n \n \n \n \n 4KUndetect\n \n \n \n \n \n \n \n \n \n 4L<20\n \n \n \n \n \n \n \n \n \n 4L>=20\n \n \n \n \n \n \n \n \n \n 4LUndetect\n \n \n \n \n \n \n \n \n \n','2023-08-07 16:20:07',4,'2023-12-20 09:10:01',4,0,NULL,NULL,NULL,'96eef8c5-dc41-4f3f-9e62-4004c11fb291'),(2212,'Clients given 4D with >=20 Copies Viral Load','Clients given 4D with >=20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D with >=20 Copies Viral Load\n Clients given 4D with >=20 Copies Viral Load\n \n 2023-08-07 14:40:38 UTC\n \n 2023-08-14 11:22:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2212\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4d \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2204)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n -- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-07 14:40:38',4,'2023-08-14 11:22:44',4,0,NULL,NULL,NULL,'41de8523-3ab9-4284-a0b1-f0298f2da510'),(2213,'Clients given 4E with >=20 Copies Viral Load','Clients given 4E with >=20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E with >=20 Copies Viral Load\n Clients given 4E with >=20 Copies Viral Load\n \n 2023-08-07 14:50:06 UTC\n \n 2023-08-14 11:23:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2213\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3679)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-07 14:50:06',4,'2023-08-14 11:23:53',4,0,NULL,NULL,NULL,'c1f2fd48-a980-4af6-93f0-08598fd57995'),(2214,'Clients given 4F with >=20 copies viral load','Clients given 4F with >=20 copies viral load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F with >=20 copies viral load\n Clients given 4F with >=20 copies viral load\n \n 2023-08-07 15:02:48 UTC\n \n 2023-08-14 11:29:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2214\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3680)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n -- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-07 15:02:48',4,'2023-08-14 11:29:08',4,0,NULL,NULL,NULL,'1605d858-dca2-4c0d-bb6f-967424aed8ad'),(2215,'Clients given 4H with >=20 Copies Viral Load','Clients given 4H with >=20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H with >=20 Copies Viral Load\n Clients given 4H with >=20 Copies Viral Load\n \n 2023-08-07 15:11:34 UTC\n \n 2023-08-14 11:47:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2215\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4685)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n -- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-07 15:11:34',4,'2023-08-14 11:47:45',4,0,NULL,NULL,NULL,'07781cf0-2cc5-497b-b9a3-dafc63842da1'),(2216,'Clients given 4J with >=20 Copies Viral Load','Clients given 4J weighing >=20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J with >=20 Copies Viral Load\n Clients given 4J weighing >=20 Copies Viral Load\n \n 2023-08-07 15:32:07 UTC\n \n 2023-08-14 11:49:33 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2216\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4J \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-07 15:32:07',4,'2023-08-14 11:49:33',4,0,NULL,NULL,NULL,'180f7359-ac4f-4728-ae43-8208ebf052cb'),(2217,'Clients given 4K with >=20 Copies Viral Load','Clients given 4K with >=20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K with >=20 Copies Viral Load\n Clients given 4K with >=20 Copies Viral Load\n \n 2023-08-07 15:41:37 UTC\n \n 2023-08-14 11:51:49 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2217\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4K \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-07 15:41:37',4,'2023-08-14 11:51:49',4,0,NULL,NULL,NULL,'a5a07716-681f-44bd-84ef-391d51ace7c9'),(2218,'Clients given 4L with >=20 Copies Viral Load','Clients given 4L with >=20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L with >=20 Copies Viral Load\n Clients given 4L with >=20 Copies Viral Load\n \n 2023-08-07 15:45:38 UTC\n \n 2023-12-20 07:15:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2218\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4L \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4688)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n -- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-07 17:45:38',4,'2023-12-20 09:15:07',4,0,NULL,NULL,NULL,'606f20bd-cac9-4282-a3c4-56b9f72ded30'),(2219,'Clients given 4C with <20 copies Viral Load','Clients given 4C with <20 copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C with <20 copies Viral Load\n Clients given 4C with <20 copies Viral Load\n \n 2023-08-07 15:55:07 UTC\n \n 2023-08-14 11:20:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2219\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2202)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-07 15:55:07',4,'2023-08-14 11:20:12',4,0,NULL,NULL,NULL,'5571d546-89fc-4cda-bc4d-fab1f629ce7a'),(2220,'Clients given 4C with Undetectable Viral Load','Clients given 4C with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C with Undetectable Viral Load\n Clients given 4C with Undetectable Viral Load\n \n 2023-08-07 15:57:44 UTC\n \n 2023-08-14 11:19:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2220\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2202)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- undetectable, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-07 15:57:44',4,'2023-08-14 11:19:40',4,0,NULL,NULL,NULL,'eaa0d4ac-c56c-4a8a-b2ca-12a462b06874'),(2221,'Clients given 4D with <20 Copies Viral Load','Clients given 4D with <20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D with <20 Copies Viral Load\n Clients given 4D with <20 Copies Viral Load\n \n 2023-08-07 16:09:50 UTC\n \n 2023-08-14 11:23:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2221\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4d \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2204)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n -- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-07 16:09:50',4,'2023-08-14 11:23:00',4,0,NULL,NULL,NULL,'60e4edc3-d202-4e5c-b9d1-a4791c874209'),(2222,'Clients given 4D with Undetectable Viral Load','Clients given 4D with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D with Undetectable Viral Load\n Clients given 4D with Undetectable Viral Load\n \n 2023-08-07 16:11:59 UTC\n \n 2023-08-14 11:22:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2222\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4d \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2204)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n -- Undetectable Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable Copies \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-07 16:11:59',4,'2023-08-14 11:22:23',4,0,NULL,NULL,NULL,'2da8e7c6-793e-42f3-994a-0dc0e72464ae'),(2223,'Clients given 4E with <20 Copies Viral Load','Clients given 4E with <20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E with <20 Copies Viral Load\n Clients given 4E with <20 Copies Viral Load\n \n 2023-08-07 16:18:03 UTC\n \n 2023-08-14 11:26:22 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2223\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3679)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-07 16:18:03',4,'2023-08-14 11:26:22',4,0,NULL,NULL,NULL,'72e755a7-cbbc-4ccd-be81-7bedf125f8c4'),(2224,'Clients given 4E with Undetectable Viral Load','Clients given 4E with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E with Undetectable Viral Load\n Clients given 4E with Undetectable Viral Load\n \n 2023-08-07 16:20:52 UTC\n \n 2023-08-14 12:07:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2224\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3679)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Undetectable, Viral load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-07 16:20:52',4,'2023-08-14 12:07:26',4,0,NULL,NULL,NULL,'1d7a46e2-8d42-4f34-8958-f5cf962db589'),(2225,'Clients given 4F with <20 copies viral load','Clients given 4F with <20 copies viral load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F with <20 copies viral load\n Clients given 4F with <20 copies viral load\n \n 2023-08-07 16:26:02 UTC\n \n 2023-08-14 11:29:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2225\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3680)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-07 16:26:02',4,'2023-08-14 11:29:28',4,0,NULL,NULL,NULL,'3c193bb3-64d6-4b71-9069-0b53083963e2'),(2226,'Clients given 4F with Undetectable viral load','Clients given 4F with Undetectable copies viral load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F with Undetectable viral load\n Clients given 4F with Undetectable copies viral load\n \n 2023-08-07 16:28:54 UTC\n \n 2023-08-14 11:28:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2226\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3680)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-07 16:28:54',4,'2023-08-14 11:28:42',4,0,NULL,NULL,NULL,'978dc8c8-3f02-4e20-9fb5-302be9fbf23c'),(2227,'Clients given 4G with >=20 Copies Viral Load','Clients given 4G with >=20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G with >=20 Copies Viral Load\n Clients given 4G with >=20 Copies Viral Load\n \n 2023-08-07 16:32:35 UTC\n \n 2023-08-14 11:45:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2227\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4684)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-07 16:32:35',4,'2023-08-14 11:45:02',4,0,NULL,NULL,NULL,'41d9cb1b-b376-4e21-aa6c-7dce59197a97'); -INSERT INTO `serialized_object` VALUES (2228,'Clients given 4G with <20 copies Viral_Load','Clients given 4G with <20 copies Viral_Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G with <20 copies Viral_Load\n Clients given 4G with <20 copies Viral_Load\n \n 2023-08-07 16:34:54 UTC\n \n 2023-08-14 11:44:33 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2228\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4684)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-07 16:34:54',4,'2023-08-14 11:44:33',4,0,NULL,NULL,NULL,'80ebb214-6a46-4379-9a31-3e3cbbb05566'),(2229,'Clients given 4G with Undetectable Viral Load','Clients given 4G with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G with Undetectable Viral Load\n Clients given 4G with Undetectable Viral Load\n \n 2023-08-07 16:39:28 UTC\n \n 2023-08-14 11:45:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2229\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4684)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- Undetectable Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable Copies \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-07 16:39:28',4,'2023-08-14 11:45:51',4,0,NULL,NULL,NULL,'d480aafa-578b-4865-bdd4-e158af437b06'),(2230,'Clients given 4H with <20 Copies Viral Load','Clients given 4H with <20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H with <20 Copies Viral Load\n Clients given 4H with <20 Copies Viral Load\n \n 2023-08-07 16:45:29 UTC\n \n 2023-08-14 11:47:21 UTC\n \n \n endDate\n \n java.util.Date\n true\n \n \n startDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2230\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4685)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-07 16:45:29',4,'2023-08-14 11:47:21',4,0,NULL,NULL,NULL,'5c8ddadc-a50e-4433-afb8-48e1acfc3ed5'),(2231,'Clients given 4H with Undetectable Viral Load','Clients given 4H with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H with Undetectable Viral Load\n Clients given 4H with Undetectable Viral Load\n \n 2023-08-07 16:47:28 UTC\n \n 2023-08-14 11:48:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2231\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4685)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- undetectable, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-07 16:47:28',4,'2023-08-14 11:48:07',4,0,NULL,NULL,NULL,'6d85bd5f-af27-43f5-a456-e1679230a4aa'),(2232,'Clients given 4J with <20 copies Viral Load','Clients given 4J with <20 copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J with <20 copies Viral Load\n Clients given 4J with <20 copies Viral Load\n \n 2023-08-07 16:53:00 UTC\n \n 2023-08-14 11:49:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2232\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4J \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-07 16:53:00',4,'2023-08-14 11:49:15',4,0,NULL,NULL,NULL,'1cf1f1b1-2f40-4e5c-b55b-893716cf2a04'),(2233,'Clients given 4J with Undetectable Viral Load','Clients given 4J with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J with Undetectable Viral Load\n Clients given 4J with Undetectable Viral Load\n \n 2023-08-07 16:57:27 UTC\n \n 2023-08-14 11:49:52 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2233\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4J \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- Undetectable, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable Copies \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-07 16:57:27',4,'2023-08-14 11:49:52',4,0,NULL,NULL,NULL,'e543fa69-cbc5-46c8-a3de-e77abcaa185a'),(2234,'Clients given 4K with <20 Copies Viral Load','Clients given 4K with <20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K with <20 Copies Viral Load\n Clients given 4K with <20 Copies Viral Load\n \n 2023-08-07 17:02:35 UTC\n \n 2023-08-14 11:51:25 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2234\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4K \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-07 17:02:35',4,'2023-08-14 11:51:25',4,0,NULL,NULL,NULL,'54121116-3d51-4a34-ae5c-5b15f1254f6e'),(2235,'Clients given 4K with Undetectable Viral Load','Clients given 4K with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K with Undetectable Viral Load\n Clients given 4K with Undetectable Viral Load\n \n 2023-08-07 17:08:26 UTC\n \n 2023-08-14 11:52:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2235\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4K \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Undetectable, Viral load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-07 17:08:26',4,'2023-08-14 11:52:08',4,0,NULL,NULL,NULL,'d2e6acfd-540a-4220-b160-b104be742043'),(2236,'Clients given 4L with <20 Copies Viral Load','Clients given 4L with <20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L with <20 Copies Viral Load\n Clients given 4L with <20 Copies Viral Load\n \n 2023-08-07 17:13:48 UTC\n \n 2023-08-14 11:54:16 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2236\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4L \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4688)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-07 17:13:48',4,'2023-08-14 11:54:16',4,0,NULL,NULL,NULL,'d4e9e456-61f2-4e2d-8779-52e1dd59a11a'),(2237,'Clients given 4L with Undetectable Viral Load','Clients given 4L with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L with Undetectable Viral Load\n Clients given 4L with Undetectable Viral Load\n \n 2023-08-07 17:17:22 UTC\n \n 2023-08-14 12:04:57 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2237\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4K \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4688)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Undetectable, Viral load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-07 17:17:22',4,'2023-08-14 12:04:57',4,0,NULL,NULL,NULL,'4792ce19-a4f6-4876-9a81-a7e48f279b1b'),(2238,'Clients given 4C with <20 copies Viral Load','Clients given 4C with <20 copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C with <20 copies Viral Load\n Clients given 4C with <20 copies Viral Load\n \n 2023-08-07 17:40:01 UTC\n \n 2023-08-07 17:41:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2238\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 19:40:01',4,'2023-08-07 19:41:50',4,0,NULL,NULL,NULL,'523777b6-edc7-4346-abbb-1eec797d6e5c'),(2239,'Clients given 4C with Undetectable Viral_Load','Clients given 4C with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C with Undetectable Viral_Load\n Clients given 4C with Undetectable Viral Load\n \n 2023-08-07 17:45:29 UTC\n \n 2023-08-07 17:54:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2239\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 19:45:29',4,'2023-08-07 19:54:18',4,0,NULL,NULL,NULL,'b3e08e0a-35ac-4b1c-86e2-2dffaa8b6ce6'),(2240,'Clients given 4D with >=20 Copies Viral Load','Clients given 4D with >=20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D with >=20 Copies Viral Load\n Clients given 4D with >=20 Copies Viral Load\n \n 2023-08-07 17:57:17 UTC\n \n 2023-08-07 17:59:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2240\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 19:57:17',4,'2023-08-07 19:59:18',4,0,NULL,NULL,NULL,'06a65347-260a-49f6-b227-e152d369db09'),(2241,'Clients given 4D with < 20 Copies Viral Load','Clients given 4D with < 20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D with < 20 Copies Viral Load\n Clients given 4D with < 20 Copies Viral Load\n \n 2023-08-07 18:00:13 UTC\n \n 2023-08-07 18:01:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2241\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:00:13',4,'2023-08-07 20:01:11',4,0,NULL,NULL,NULL,'849b9ad0-e14d-4e64-8d4d-c90f1ea85d2c'),(2242,'Clients given 4D with Undetectable Viral Load','Clients given 4D with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D with Undetectable Viral Load\n Clients given 4D with Undetectable Viral Load\n \n 2023-08-07 18:02:05 UTC\n \n 2023-08-07 18:02:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2242\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:02:05',4,'2023-08-07 20:02:59',4,0,NULL,NULL,NULL,'269d7cd2-40e5-41a3-9da2-be9e310de73d'),(2243,'Clients given 4E with >=20 Copies Viral Load','Clients given 4E with >=20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E with >=20 Copies Viral Load\n Clients given 4E with >=20 Copies Viral Load\n \n 2023-08-07 18:05:06 UTC\n \n 2023-08-07 18:06:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2243\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:05:06',4,'2023-08-07 20:06:12',4,0,NULL,NULL,NULL,'deaade8d-fa75-4774-9422-2379319a59b2'),(2244,'Clients given 4E with <20 Copies Viral Load','Clients given 4E with <20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E with <20 Copies Viral Load\n Clients given 4E with <20 Copies Viral Load\n \n 2023-08-07 18:06:56 UTC\n \n 2023-08-07 18:08:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2244\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:06:56',4,'2023-08-07 20:08:02',4,0,NULL,NULL,NULL,'e0b2f670-7df3-4672-8411-b6d500f5f13d'),(2245,'Clients given 4E with Undetectable Viral Load','Clients given 4E with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E with Undetectable Viral Load\n Clients given 4E with Undetectable Viral Load\n \n 2023-08-07 18:08:42 UTC\n \n 2023-08-07 18:10:35 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2245\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:08:42',4,'2023-08-07 20:10:35',4,0,NULL,NULL,NULL,'ada290e9-0105-4579-843e-a66c38a30845'),(2246,'Clients given 4F with >=20 copies viral load','Clients given 4F with >=20 copies viral load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F with >=20 copies viral load\n Clients given 4F with >=20 copies viral load\n \n 2023-08-07 18:12:14 UTC\n \n 2023-08-07 18:12:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2246\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:12:14',4,'2023-08-07 20:12:59',4,0,NULL,NULL,NULL,'2755008d-c58f-4cf7-b3fb-879cb0055625'),(2247,'Clients given 4F with <20 copies Viral Load','Clients given 4F with <20 copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F with <20 copies Viral Load\n Clients given 4F with <20 copies Viral Load\n \n 2023-08-07 18:13:57 UTC\n \n 2023-08-07 18:15:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2247\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:13:57',4,'2023-08-07 20:15:02',4,0,NULL,NULL,NULL,'5fd4b692-7c21-4e41-80e5-143ee6c04385'),(2248,'Clients given 4F with Undetectable Viral Load','Clients given 4F with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F with Undetectable Viral Load\n Clients given 4F with Undetectable Viral Load\n \n 2023-08-07 18:15:52 UTC\n \n 2023-08-07 18:16:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2248\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:15:52',4,'2023-08-07 20:16:55',4,0,NULL,NULL,NULL,'9aae30ff-90c2-4228-b4a1-0aedf7354802'),(2249,'Clients given 4G with >=20 Copies Viral Load','Clients given 4G with >=20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G with >=20 Copies Viral Load\n Clients given 4G with >=20 Copies Viral Load\n \n 2023-08-07 18:18:32 UTC\n \n 2023-08-07 18:20:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2249\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:18:32',4,'2023-08-07 20:20:58',4,0,NULL,NULL,NULL,'a602c987-a1c2-486d-93e8-2efb6a3d06d6'),(2250,'Clients given 4G with <20 copies Viral Load','Clients given 4G with <20 copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G with <20 copies Viral Load\n Clients given 4G with <20 copies Viral Load\n \n 2023-08-07 18:21:47 UTC\n \n 2023-08-07 18:23:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2250\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:21:47',4,'2023-08-07 20:23:21',4,0,NULL,NULL,NULL,'6cec76ef-5466-4efe-970d-f7b76ed79e1e'),(2251,'Clients given 4G with Undetectable Viral Load','Clients given 4G with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G with Undetectable Viral Load\n Clients given 4G with Undetectable Viral Load\n \n 2023-08-07 18:24:19 UTC\n \n 2023-08-07 18:25:25 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2251\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:24:19',4,'2023-08-07 20:25:25',4,0,NULL,NULL,NULL,'ef8cbe9f-0742-4531-8dbe-1efbfc9c807a'),(2252,'Clients given 4H with >=20 Copies Viral Load','Clients given 4H with >=20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H with >=20 Copies Viral Load\n Clients given 4H with >=20 Copies Viral Load\n \n 2023-08-07 18:26:08 UTC\n \n 2023-08-07 18:27:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2252\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:26:08',4,'2023-08-07 20:27:36',4,0,NULL,NULL,NULL,'f374ad0c-24ca-460e-8ed4-812fcdbb8b30'),(2253,'Clients given 4H weighing <20 Copies Viral Load','Clients given 4H weighing <20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H weighing <20 Copies Viral Load\n Clients given 4H weighing <20 Copies Viral Load\n \n 2023-08-07 18:32:51 UTC\n \n 2023-08-07 18:34:47 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2253\n COUNT\n \n \n \n \n endDate\n ${startDate}\n \n \n location\n ${location}\n \n \n startDate\n ${endDate}\n \n \n \n','2023-08-07 20:32:51',4,'2023-08-07 20:34:47',4,0,NULL,NULL,NULL,'981353f5-77cf-4e9e-b418-96ba27b38c0d'),(2254,'Clients given 4H with Undetectable Viral Load','Clients given 4H with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H with Undetectable Viral Load\n Clients given 4H with Undetectable Viral Load\n \n 2023-08-07 18:35:38 UTC\n \n 2023-08-07 18:36:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2254\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:35:38',4,'2023-08-07 20:36:30',4,0,NULL,NULL,NULL,'3cff4201-9093-4de5-a526-4c714a0e4b75'),(2255,'Clients given 4J weighing >=20 Copies Viral Load','Clients given 4J weighing >=20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J weighing >=20 Copies Viral Load\n Clients given 4J weighing >=20 Copies Viral Load\n \n 2023-08-07 18:37:43 UTC\n \n 2023-08-07 18:38:52 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2255\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:37:43',4,'2023-08-07 20:38:52',4,0,NULL,NULL,NULL,'ccd5a99e-b517-45c0-864c-d3c6f4ef6701'),(2256,'Clients given 4J with <20 copies Viral Load','Clients given 4J with <20 copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J with <20 copies Viral Load\n Clients given 4J with <20 copies Viral Load\n \n 2023-08-07 18:40:26 UTC\n \n 2023-08-07 18:41:37 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2256\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:40:26',4,'2023-08-07 20:41:37',4,0,NULL,NULL,NULL,'99531929-455a-4092-b2e9-48993920a7b3'),(2257,'Clients given 4J with Undetectable Viral Load','Clients given 4J with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J with Undetectable Viral Load\n Clients given 4J with Undetectable Viral Load\n \n 2023-08-07 18:42:19 UTC\n \n 2023-08-07 18:45:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2257\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:42:19',4,'2023-08-07 20:45:10',4,0,NULL,NULL,NULL,'059ea6c5-c8bf-42ba-abbf-50b8bd27f0e1'),(2258,'Clients given 4K with >=20 Copies Viral Load','Clients given 4K with >=20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K with >=20 Copies Viral Load\n Clients given 4K with >=20 Copies Viral Load\n \n 2023-08-07 18:46:10 UTC\n \n 2023-08-07 18:47:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2258\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:46:10',4,'2023-08-07 20:47:00',4,0,NULL,NULL,NULL,'4d992a61-8cc5-4846-afd1-605e939b3f6e'),(2259,'Clients given 4K with <20 Copies Viral Load','Clients given 4K with <20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K with <20 Copies Viral Load\n Clients given 4K with <20 Copies Viral Load\n \n 2023-08-07 18:48:35 UTC\n \n 2023-08-08 10:02:48 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2259\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:48:35',4,'2023-08-08 12:02:48',4,0,NULL,NULL,NULL,'a1388a42-9e0b-4057-9343-515ab7744a3a'),(2260,'Clients given 4K with Undetectable Viral Load','Clients given 4K with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K with Undetectable Viral Load\n Clients given 4K with Undetectable Viral Load\n \n 2023-08-07 18:50:00 UTC\n \n 2023-08-07 18:50:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2260\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:50:00',4,'2023-08-07 20:50:42',4,0,NULL,NULL,NULL,'50081155-8d33-4ece-ad03-825e8f26f54b'),(2261,'Clients given 4L with >=20 Copies Viral Load','Clients given 4L with >=20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L with >=20 Copies Viral Load\n Clients given 4L with >=20 Copies Viral Load\n \n 2023-08-07 18:51:33 UTC\n \n 2023-12-20 07:08:34 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2261\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:51:33',4,'2023-12-20 09:08:34',4,0,NULL,NULL,NULL,'44e7920f-d834-4397-ba46-342d70d2d351'),(2262,'Clients given 4L with <20 Copies Viral Load','Clients given 4L with <20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L with <20 Copies Viral Load\n Clients given 4L with <20 Copies Viral Load\n \n 2023-08-07 18:54:15 UTC\n \n 2023-08-07 18:54:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2262\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:54:15',4,'2023-08-07 20:54:59',4,0,NULL,NULL,NULL,'a46689e8-87db-4b2e-b627-fa3a695e9e49'),(2263,'Clients given 4L with Undetectable Viral Load','Clients given 4L with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L with Undetectable Viral Load\n Clients given 4L with Undetectable Viral Load\n \n 2023-08-07 18:55:39 UTC\n \n 2023-08-07 18:56:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2263\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:55:39',4,'2023-08-07 20:56:21',4,0,NULL,NULL,NULL,'38640382-c5f2-4174-b4b6-e05863aea4b8'),(2264,'Clients given 4C with good adherence','Clients given 4C with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C with good adherence\n Clients given 4C with good adherence\n \n 2023-08-09 09:38:59 UTC\n \n 2023-08-14 10:41:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2264\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2202)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-09 09:38:59',4,'2023-08-14 10:41:15',4,0,NULL,NULL,NULL,'80eda8e4-4432-4308-92bc-9c4a6d5835ba'),(2265,'Clients given 4D with good adherence','Clients given 4D with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D with good adherence\n Clients given 4D with good adherence\n \n 2023-08-09 09:40:40 UTC\n \n 2023-08-14 10:43:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2265\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4D \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2204)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-09 09:40:40',4,'2023-08-14 10:43:07',4,0,NULL,NULL,NULL,'50e6ed7b-8da6-420e-b00d-c5a7a6e8e618'),(2266,'Clients given 4E with good adherence','Clients given 4E with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E with good adherence\n Clients given 4E with good adherence\n \n 2023-08-09 09:40:58 UTC\n \n 2023-08-14 10:45:49 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2266\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3679)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-09 09:40:58',4,'2023-08-14 10:45:49',4,0,NULL,NULL,NULL,'c9adbf40-4d5f-4ca4-b388-4a4ee5c16f3e'),(2267,'Clients given 4F with good adherence','Clients given 4F with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F with good adherence\n Clients given 4F with good adherence\n \n 2023-08-09 09:49:16 UTC\n \n 2023-08-14 10:57:13 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2267\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3680)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-09 09:49:16',4,'2023-08-14 10:57:13',4,0,NULL,NULL,NULL,'691b7d00-855b-4869-8938-9502f8762962'),(2268,'Clients given 4G with good adherence','Clients given 4G with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G with good adherence\n Clients given 4G with good adherence\n \n 2023-08-09 09:49:37 UTC\n \n 2023-08-14 10:58:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2268\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4684)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-09 09:49:37',4,'2023-08-14 10:58:30',4,0,NULL,NULL,NULL,'d0f8da5f-e6aa-44af-9980-cd882429e8ac'),(2269,'Clients given 4H with good adherence','Clients given 4H with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H with good adherence\n Clients given 4H with good adherence\n \n 2023-08-09 09:49:55 UTC\n \n 2023-08-14 11:00:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2269\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4685)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-09 09:49:55',4,'2023-08-14 11:00:32',4,0,NULL,NULL,NULL,'90332338-8e76-4563-a7f1-f3f67ffa8f3b'),(2270,'Clients given 4J with good adherence','Clients given 4J with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J with good adherence\n Clients given 4J with good adherence\n \n 2023-08-09 09:54:49 UTC\n \n 2023-08-14 11:09:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2270\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4J \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-09 09:54:49',4,'2023-08-14 11:09:02',4,0,NULL,NULL,NULL,'888d3fd4-ad2c-4e7e-b07f-8c68a08ed1f4'),(2271,'Clients given 4K with good adherence','Clients given 4K with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K with good adherence\n Clients given 4K with good adherence\n \n 2023-08-09 09:55:07 UTC\n \n 2023-08-14 11:10:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2271\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4K \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-09 09:55:07',4,'2023-08-14 11:10:40',4,0,NULL,NULL,NULL,'def70332-aae8-450d-8e78-2b3f83574bc9'),(2272,'Clients given 4L with good adherence','Clients given 4L with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L with good adherence\n Clients given 4L with good adherence\n \n 2023-08-09 09:55:23 UTC\n \n 2023-08-14 11:14:33 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2272\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4L \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4688)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-09 09:55:23',4,'2023-08-14 11:14:33',4,0,NULL,NULL,NULL,'7d1751a3-47c6-406a-a631-90ed96f37660'),(2273,'clients given 4C with fair adherence','clients given 4C with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n clients given 4C with fair adherence\n clients given 4C with fair adherence\n \n 2023-08-09 10:04:32 UTC\n \n 2023-08-14 10:40:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2273\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2202)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-09 10:04:32',4,'2023-08-14 10:40:15',4,0,NULL,NULL,NULL,'15494d8b-bc16-4865-8561-a0f11bb906f5'),(2274,'clients given 4D with fair adherence','clients given 4D with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n clients given 4D with fair adherence\n clients given 4D with fair adherence\n \n 2023-08-09 10:04:52 UTC\n \n 2023-08-14 10:42:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2274\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4D \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2204)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-09 10:04:52',4,'2023-08-14 10:42:43',4,0,NULL,NULL,NULL,'3076328f-0cf6-496f-bcfc-ec00585bf8f7'),(2275,'clients given 4E with fair adherence','clients given 4E with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n clients given 4E with fair adherence\n clients given 4E with fair adherence\n \n 2023-08-09 10:05:09 UTC\n \n 2023-08-14 10:45:35 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2275\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3679)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-09 10:05:09',4,'2023-08-14 10:45:35',4,0,NULL,NULL,NULL,'8c441fe9-1c2f-4eba-9e14-3c13b7d0e22d'),(2276,'clients given 4F with fair adherence','clients given 4F with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n clients given 4F with fair adherence\n clients given 4F with fair adherence\n \n 2023-08-09 10:08:17 UTC\n \n 2023-08-14 10:56:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2276\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3680)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-09 10:08:17',4,'2023-08-14 10:56:58',4,0,NULL,NULL,NULL,'cb6f6a66-39fa-4584-8ad9-397be4e8acc0'),(2277,'clients given 4G with fair adherence','clients given 4G with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n clients given 4G with fair adherence\n clients given 4G with fair adherence\n \n 2023-08-09 10:09:12 UTC\n \n 2023-08-14 10:58:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2277\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4684)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-09 10:09:12',4,'2023-08-14 10:58:17',4,0,NULL,NULL,NULL,'456a7189-4a16-40fa-9702-abf6b2e8b707'),(2278,'Clients given 4H with fair adherence','Clients given 4H with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H with fair adherence\n Clients given 4H with fair adherence\n \n 2023-08-09 10:10:29 UTC\n \n 2023-08-14 11:00:09 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2278\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4685)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-09 10:10:29',4,'2023-08-14 11:00:09',4,0,NULL,NULL,NULL,'3cb85e60-1a5e-422c-b0af-fc15c8ba62ed'),(2279,'Clients given 4K with fair adherence','Clients given 4K with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K with fair adherence\n Clients given 4K with fair adherence\n \n 2023-08-09 10:17:56 UTC\n \n 2023-08-14 11:10:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2279\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4K \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-09 10:17:56',4,'2023-08-14 11:10:04',4,0,NULL,NULL,NULL,'cbd5b84d-066f-41a6-bd8b-bc81dc23c99d'),(2280,'Clients given 4J with fair adherence','Clients given 4J with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J with fair adherence\n Clients given 4J with fair adherence\n \n 2023-08-09 10:18:17 UTC\n \n 2023-08-14 11:08:38 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2280\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4J \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-09 10:18:17',4,'2023-08-14 11:08:38',4,0,NULL,NULL,NULL,'14b826bd-9709-497b-a02d-8fa8d4146faa'),(2281,'Clients given 4L with fair adherence','Clients given 4L with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L with fair adherence\n Clients given 4L with fair adherence\n \n 2023-08-09 10:21:31 UTC\n \n 2023-08-14 11:14:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2281\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4L \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-09 10:21:31',4,'2023-08-14 11:14:18',4,0,NULL,NULL,NULL,'62b94203-c51d-456f-87a6-dd15791f3d71'),(2282,'Clients given 4C with poor adherence','Clients given 4C with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C with poor adherence\n Clients given 4C with poor adherence\n \n 2023-08-09 10:45:41 UTC\n \n 2023-08-09 10:49:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2282\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 20 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2202)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-09 10:45:41',4,'2023-08-09 10:49:23',4,0,NULL,NULL,NULL,'769d8c15-f519-440d-acaf-e2640e2409bc'),(2283,'Clients given 4D with poor adherence','Clients given 4D with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D with poor adherence\n Clients given 4D with poor adherence\n \n 2023-08-09 10:46:02 UTC\n \n 2023-08-14 10:41:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2283\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4D \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2204)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-09 10:46:02',4,'2023-08-14 10:41:45',4,0,NULL,NULL,NULL,'f77a67fe-ac10-4c92-ab0c-98a5b4dfd5f1'),(2284,'Clients given 4E with poor adherence','Clients given 4E with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E with poor adherence\n Clients given 4E with poor adherence\n \n 2023-08-09 10:46:19 UTC\n \n 2023-08-14 10:45:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2284\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3679)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-09 10:46:19',4,'2023-08-14 10:45:20',4,0,NULL,NULL,NULL,'2eb584f9-1fbe-4c98-adec-b2feb88933b7'),(2285,'Clients given 4F with poor adherence','Clients given 4F with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F with poor adherence\n Clients given 4F with poor adherence\n \n 2023-08-09 10:50:41 UTC\n \n 2023-08-14 10:57:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2285\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3680)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-09 10:50:41',4,'2023-08-14 10:57:32',4,0,NULL,NULL,NULL,'3c5012df-c0bf-411b-a7d1-da092ade8986'),(2286,'Clients given 4G with poor adherence','Clients given 4G with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G with poor adherence\n Clients given 4G with poor adherence\n \n 2023-08-09 10:50:56 UTC\n \n 2023-08-14 10:58:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2286\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4684)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-09 10:50:56',4,'2023-08-14 10:58:45',4,0,NULL,NULL,NULL,'cdee04fe-950f-4b39-88bf-9736744da52f'),(2287,'Clients given 4H with poor adherence','Clients given 4H with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H with poor adherence\n Clients given 4H with poor adherence\n \n 2023-08-09 10:51:12 UTC\n \n 2023-08-14 11:00:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2287\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4685)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-09 10:51:12',4,'2023-08-14 11:00:59',4,0,NULL,NULL,NULL,'9a9175d4-c8ad-439e-b484-edb2345816ad'),(2288,'Clients given 4L with poor adherence','Clients given 4L with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L with poor adherence\n Clients given 4L with poor adherence\n \n 2023-08-09 10:55:46 UTC\n \n 2023-08-14 11:14:48 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2288\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4L \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4688)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-09 10:55:46',4,'2023-08-14 11:14:48',4,0,NULL,NULL,NULL,'5b38ffa0-ea56-4cda-b3cf-03d1b83e7889'),(2289,'Clients given 4K with poor adherence','Clients given 4K with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K with poor adherence\n Clients given 4K with poor adherence\n \n 2023-08-09 10:56:07 UTC\n \n 2023-08-14 11:10:52 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2289\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4K \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-09 10:56:07',4,'2023-08-14 11:10:52',4,0,NULL,NULL,NULL,'1c393c0d-a2e3-4223-9b24-848d235e7a19'),(2290,'Clients given 4J with poor adherence','Clients given 4J with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J with poor adherence\n Clients given 4J with poor adherence\n \n 2023-08-09 10:56:28 UTC\n \n 2023-08-14 11:09:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2290\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4J \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-09 10:56:28',4,'2023-08-14 11:09:18',4,0,NULL,NULL,NULL,'47569cef-3b90-4fbf-9558-b7a4afb195ab'),(2291,'Children ARV Regimen_1stLine_Adherence','Children ARV Regimen_1stLine_Adherence','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_Adherence\n Children ARV Regimen_1stLine_Adherence\n \n 2023-08-09 19:25:53 UTC\n \n 2023-08-09 19:26:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2291\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-09 19:25:53',4,'2023-08-09 19:26:39',4,0,NULL,NULL,NULL,'dcdcb494-6ca6-47a5-aaac-92decc868c82'),(2292,'Children ARV Regimen_1stLine_Adherence Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_Adherence Data Set\n \n 2023-08-09 19:26:39 UTC\n \n 2023-08-10 09:42:22 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2292\n \n \n \n 4C_fair\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n \n \n 4C_good\n \n \n \n \n \n \n \n \n \n 4C_poor\n \n \n \n \n \n \n \n \n \n 4D_fair\n \n \n \n \n \n \n \n \n \n 4D_good\n \n \n \n \n \n \n \n \n \n 4D_poor\n \n \n \n \n \n \n \n \n \n 4E_fair\n \n \n \n \n \n \n \n \n \n 4E_good\n \n \n \n \n \n \n \n \n \n 4E_poor\n \n \n \n \n \n \n \n \n \n 4F_fair\n \n \n \n \n \n \n \n \n \n 4F_good\n \n \n \n \n \n \n \n \n \n 4F_poor\n \n \n \n \n \n \n \n \n \n 4G_fair\n \n \n \n \n \n \n \n \n \n 4G_good\n \n \n \n \n \n \n \n \n \n 4G_poor\n \n \n \n \n \n \n \n \n \n 4H_fair\n \n \n \n \n \n \n \n \n \n 4H_good\n \n \n \n \n \n \n \n \n \n 4H_poor\n \n \n \n \n \n \n \n \n \n 4J_fair\n \n \n \n \n \n \n \n \n \n 4J_good\n \n \n \n \n \n \n \n \n \n 4J_poor\n \n \n \n \n \n \n \n \n \n 4K_fair\n \n \n \n \n \n \n \n \n \n 4K_good\n \n \n \n \n \n \n \n \n \n 4K_poor\n \n \n \n \n \n \n \n \n \n 4L_fair\n \n \n \n \n \n \n \n \n \n 4L_good\n \n \n \n \n \n \n \n \n \n 4L_poor\n \n \n \n \n \n \n \n \n \n','2023-08-09 19:26:39',4,'2023-08-10 09:42:22',4,0,NULL,NULL,NULL,'129f4cce-9154-4509-8649-9b3ed22fe029'),(2293,'Clients given 4C with good adherence','Clients given 4C with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C with good adherence\n Clients given 4C with good adherence\n \n 2023-08-09 19:34:37 UTC\n \n 2023-08-09 19:40:19 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2293\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 19:34:37',4,'2023-08-09 19:40:19',4,0,NULL,NULL,NULL,'9aebf6da-cf9b-45ed-bbdd-861ff4c0fd41'),(2294,'Clients given 4C with fair adherence','Clients given 4C with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C with fair adherence\n Clients given 4C with fair adherence\n \n 2023-08-09 19:34:50 UTC\n \n 2023-08-09 19:39:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2294\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 19:34:50',4,'2023-08-09 19:39:36',4,0,NULL,NULL,NULL,'ae06dd89-8f3d-4448-bab9-212196f1660d'),(2295,'Clients given 4C with poor adherence','Clients given 4C with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C with poor adherence\n Clients given 4C with poor adherence\n \n 2023-08-09 19:35:01 UTC\n \n 2023-08-09 19:39:57 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2295\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 19:35:01',4,'2023-08-09 19:39:57',4,0,NULL,NULL,NULL,'88e3d929-46c6-4698-b83e-81552c4b0078'),(2296,'Clients given 4D with good adherence','Clients given 4D with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D with good adherence\n Clients given 4D with good adherence\n \n 2023-08-09 19:43:04 UTC\n \n 2023-08-09 19:46:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2296\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 19:43:04',4,'2023-08-09 19:46:08',4,0,NULL,NULL,NULL,'7b0d9987-2436-479b-b186-682878585356'),(2297,'Clients given 4D with fair adherence','Clients given 4D with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D with fair adherence\n Clients given 4D with fair adherence\n \n 2023-08-09 19:43:10 UTC\n \n 2023-08-09 19:46:35 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2297\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 19:43:10',4,'2023-08-09 19:46:35',4,0,NULL,NULL,NULL,'6e70eb0d-55a5-4cc0-b79e-4e80bf25978d'),(2298,'Clients given 4D with poor adherence','Clients given 4D with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D with poor adherence\n Clients given 4D with poor adherence\n \n 2023-08-09 19:43:23 UTC\n \n 2023-08-09 19:47:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2298\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 19:43:23',4,'2023-08-09 19:47:01',4,0,NULL,NULL,NULL,'dde54d37-4aab-443f-9b40-2fe211fc296a'),(2299,'Clients given 4E with good adherence','Clients given 4E with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E with good adherence\n Clients given 4E with good adherence\n \n 2023-08-09 19:47:57 UTC\n \n 2023-08-09 19:52:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2299\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 19:47:57',4,'2023-08-09 19:52:12',4,0,NULL,NULL,NULL,'8572efe5-f3ea-463f-8abf-fe4086a2aaf7'),(2300,'clients given 4E with fair adherence','Clients given 4E with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n clients given 4E with fair adherence\n Clients given 4E with fair adherence\n \n 2023-08-09 19:48:21 UTC\n \n 2023-08-09 19:53:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2300\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 19:48:21',4,'2023-08-09 19:53:51',4,0,NULL,NULL,NULL,'9157aa83-9a8f-4598-933d-06a98e849b9c'),(2301,'Clients given 4E with poor adherence','Clients given 4E with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E with poor adherence\n Clients given 4E with poor adherence\n \n 2023-08-09 19:49:01 UTC\n \n 2023-08-09 19:54:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2301\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 19:49:01',4,'2023-08-09 19:54:14',4,0,NULL,NULL,NULL,'134c2069-3e31-41df-8845-18839686bfba'),(2302,'Clients given 4F with good adherence','Clients given 4F with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F with good adherence\n Clients given 4F with good adherence\n \n 2023-08-09 19:55:08 UTC\n \n 2023-08-09 19:57:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2302\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 19:55:08',4,'2023-08-09 19:57:55',4,0,NULL,NULL,NULL,'d6358532-78d0-4095-9fcb-edf9bc09f548'),(2303,'clients given 4F with fair adherence','clients given 4F with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n clients given 4F with fair adherence\n clients given 4F with fair adherence\n \n 2023-08-09 19:55:30 UTC\n \n 2023-08-09 19:59:24 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2303\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 19:55:30',4,'2023-08-09 19:59:24',4,0,NULL,NULL,NULL,'25550508-c457-4534-9385-9c35fe182a5e'),(2304,'Clients given 4F with poor adherence','Clients given 4F with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F with poor adherence\n Clients given 4F with poor adherence\n \n 2023-08-09 19:56:13 UTC\n \n 2023-08-09 19:59:49 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2304\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 19:56:13',4,'2023-08-09 19:59:49',4,0,NULL,NULL,NULL,'de1988bb-4fda-4d70-b77a-569364cb3880'),(2305,'Clients given 4G with good adherence','Clients given 4G with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G with good adherence\n Clients given 4G with good adherence\n \n 2023-08-09 20:00:32 UTC\n \n 2023-08-09 20:04:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2305\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 20:00:32',4,'2023-08-09 20:04:29',4,0,NULL,NULL,NULL,'f15e2c6d-1a13-45c8-b80e-33982967f9ee'),(2306,'Clients given 4G with poor adherence','Clients given 4G with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G with poor adherence\n Clients given 4G with poor adherence\n \n 2023-08-09 20:01:35 UTC\n \n 2023-08-09 20:05:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2306\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 20:01:35',4,'2023-08-09 20:05:36',4,0,NULL,NULL,NULL,'9b6c2db1-dea2-4afa-b20c-391c4985795c'),(2307,'clients given 4G with fair adherence','clients given 4G with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n clients given 4G with fair adherence\n clients given 4G with fair adherence\n \n 2023-08-09 20:01:43 UTC\n \n 2023-08-09 20:04:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2307\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 20:01:43',4,'2023-08-09 20:04:58',4,0,NULL,NULL,NULL,'b7856cf5-f989-45fd-8da6-f0ba354e3e96'),(2308,'Clients given 4H with good adherence','Clients given 4H with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H with good adherence\n Clients given 4H with good adherence\n \n 2023-08-09 20:06:49 UTC\n \n 2023-08-09 20:10:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2308\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 20:06:49',4,'2023-08-09 20:10:41',4,0,NULL,NULL,NULL,'cfb7a7c6-30e8-4f10-a55b-faff56674767'),(2309,'Clients given 4H with fair adherence','Clients given 4H with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H with fair adherence\n Clients given 4H with fair adherence\n \n 2023-08-09 20:07:01 UTC\n \n 2023-08-09 20:10:57 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2309\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 20:07:01',4,'2023-08-09 20:10:57',4,0,NULL,NULL,NULL,'5df6e5f1-3116-49e6-a896-df143af3004e'),(2310,'Clients given 4H with poor adherence','Clients given 4H with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H with poor adherence\n Clients given 4H with poor adherence\n \n 2023-08-09 20:07:57 UTC\n \n 2023-08-09 20:13:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2310\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 20:07:57',4,'2023-08-09 20:13:06',4,0,NULL,NULL,NULL,'65132fb3-cc4a-4859-8cbf-2f26ad87c444'),(2311,'Clients given 4J with fair adherence','Clients given 4J with fair adherence\r\n','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J with fair adherence\n Clients given 4J with fair adherence \n\n \n 2023-08-09 20:13:40 UTC\n \n 2023-08-09 20:17:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2311\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 20:13:40',4,'2023-08-09 20:17:28',4,0,NULL,NULL,NULL,'7396bec4-26e5-46ae-9751-217c77d66d44'),(2312,'Clients given 4J with good adherence','Clients given 4J with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J with good adherence\n Clients given 4J with good adherence\n \n 2023-08-09 20:13:48 UTC\n \n 2023-08-09 20:17:09 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2312\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 20:13:48',4,'2023-08-09 20:17:09',4,0,NULL,NULL,NULL,'b7ecce5a-9011-4c8a-a77b-538d579acf4a'),(2313,'Clients given 4J with poor adherence','Clients given 4J with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J with poor adherence\n Clients given 4J with poor adherence\n \n 2023-08-09 20:14:07 UTC\n \n 2023-08-09 20:17:52 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2313\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 20:14:07',4,'2023-08-09 20:17:52',4,0,NULL,NULL,NULL,'21d68248-3137-4f24-89b3-702c4c86b258'),(2314,'Clients given 4K with good adherence','Clients given 4K with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K with good adherence\n Clients given 4K with good adherence\n \n 2023-08-09 20:19:21 UTC\n \n 2023-08-09 20:22:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2314\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 20:19:21',4,'2023-08-09 20:22:30',4,0,NULL,NULL,NULL,'898b11a3-3876-45bc-a327-207de5a91288'),(2315,'Clients given 4K with fair adherence','Clients given 4K with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K with fair adherence\n Clients given 4K with fair adherence\n \n 2023-08-09 20:19:40 UTC\n \n 2023-08-09 20:23:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2315\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 20:19:40',4,'2023-08-09 20:23:00',4,0,NULL,NULL,NULL,'01cd007c-98e1-4a76-91a3-35dde1c4b25b'),(2316,'Clients given 4K with poor adherence','Clients given 4K with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K with poor adherence\n Clients given 4K with poor adherence\n \n 2023-08-09 20:20:07 UTC\n \n 2023-08-09 20:23:47 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2316\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 20:20:07',4,'2023-08-09 20:23:47',4,0,NULL,NULL,NULL,'4feeb398-2818-460e-8e2c-3df8a27c5c68'),(2317,'Clients given 4L with good adherence','Clients given 4L with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L with good adherence\n Clients given 4L with good adherence\n \n 2023-08-09 20:25:36 UTC\n \n 2023-08-09 20:29:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2317\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 20:25:36',4,'2023-08-09 20:29:06',4,0,NULL,NULL,NULL,'6f28a61d-320a-49a5-8bf5-fc9e9c68cf5e'),(2318,'Clients given 4L with fair adherence','Clients given 4L with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L with fair adherence\n Clients given 4L with fair adherence\n \n 2023-08-09 20:25:55 UTC\n \n 2023-08-09 20:29:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2318\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 20:25:55',4,'2023-08-09 20:29:26',4,0,NULL,NULL,NULL,'58759e6a-e8d0-4eca-9a01-610e7d2f27c6'),(2319,'Clients given 4L with poor adherence','Clients given 4L with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L with poor adherence\n Clients given 4L with poor adherence\n \n 2023-08-09 20:26:12 UTC\n \n 2023-08-09 20:29:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2319\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 20:26:12',4,'2023-08-09 20:29:45',4,0,NULL,NULL,NULL,'3dfc43b9-8bf9-4833-890a-88876f8da47c'),(2321,'Children ARV Regimen_2ndLine_5A','Children ARV Regimen_2ndLine_5A disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5A\n Children ARV Regimen_2ndLine_5A disaggregated by weight, sex, age\n \n 2023-08-15 17:48:13 UTC\n \n 2023-08-15 19:23:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2321\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-15 19:48:13',4,'2023-08-15 21:23:02',4,0,NULL,NULL,NULL,'37b51d3f-838d-4211-aced-12371e6a7493'),(2322,'Children ARV Regimen_1stLine_5A Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_5A Data Set\n \n 2023-08-15 17:48:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n \n \n','2023-08-15 19:48:21',4,NULL,NULL,0,NULL,NULL,NULL,'6b9d88ee-8215-4be6-89f5-2b6dbec7d979'),(2323,'Children ARV Regimen_1stLine_5A Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_5A Data Set\n \n 2023-08-15 17:48:43 UTC\n \n 2023-08-16 10:53:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2323\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4y0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4y10-13\n \n \n \n \n \n \n \n \n \n F1-4y14-19\n \n \n \n \n \n \n \n \n \n F1-4y20-24\n \n \n \n \n \n \n \n \n \n F1-4y25-34\n \n \n \n \n \n \n \n \n \n F1-4y4-5\n \n \n \n \n \n \n \n \n \n F1-4y6-9\n \n \n \n \n \n \n \n \n \n F1-4y>=35\n \n \n \n \n \n \n \n \n \n F10-14y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14y10-\n \n \n \n \n \n \n F10-14y14-\n \n \n \n \n \n \n F10-14y20-\n \n \n \n \n \n \n F10-14y25-\n \n \n \n \n \n \n F10-14y4-5\n \n \n \n \n \n \n F10-14y6-9\n \n \n \n \n \n \n F10-14y>=3\n \n \n \n \n \n \n F5-9y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9y10-13\n \n \n \n \n \n \n F5-9y14-19\n \n \n \n \n \n \n F5-9y20-24\n \n \n \n \n \n \n F5-9y25-34\n \n \n \n \n \n \n F5-9y4-5\n \n \n \n \n \n \n F5-9y6-9\n \n \n \n \n \n \n F5-9y>=35\n \n \n \n \n \n \n F<1y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1y10-13\n \n \n \n \n \n \n F<1y14-19\n \n \n \n \n \n \n F<1y20-24\n \n \n \n \n \n \n F<1y25-34\n \n \n \n \n \n \n F<1y4-5\n \n \n \n \n \n \n F<1y6-9\n \n \n \n \n \n \n F<1y>=35\n \n \n \n \n \n \n M1-4y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4y10-13\n \n \n \n \n \n \n \n \n \n M1-4y14-19\n \n \n \n \n \n \n M1-4y20-24\n \n \n \n \n \n \n M1-4y25-34\n \n \n \n \n \n \n M1-4y4-5\n \n \n \n \n \n \n M1-4y6-9\n \n \n \n \n \n \n M1-4y>=35\n \n \n \n \n \n \n M10-14y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14y10-\n \n \n \n \n \n \n M10-14y14-\n \n \n \n \n \n \n M10-14y20-\n \n \n \n \n \n \n M10-14y25-\n \n \n \n \n \n \n M10-14y4-5\n \n \n \n \n \n \n M10-14y6-9\n \n \n \n \n \n \n M10-14y>=3\n \n \n \n \n \n \n M5-9y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9y10-13\n \n \n \n \n \n \n M5-9y14-19\n \n \n \n \n \n \n M5-9y20-24\n \n \n \n \n \n \n M5-9y25-34\n \n \n \n \n \n \n M5-9y4-5\n \n \n \n \n \n \n M5-9y6-9\n \n \n \n \n \n \n M5-9y>=35\n \n \n \n \n \n \n M<1y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1y10-13\n \n \n \n \n \n \n M<1y14-19\n \n \n \n \n \n \n M<1y20-24\n \n \n \n \n \n \n M<1y25-34\n \n \n \n \n \n \n \n \n \n M<1y4-5\n \n \n \n \n \n \n M<1y6-9\n \n \n \n \n \n \n M<1y>=35\n \n \n \n \n \n \n','2023-08-15 19:48:43',4,'2023-08-16 12:53:15',4,0,NULL,NULL,NULL,'1311fb91-2a90-44c5-876f-0bf0284580f4'),(2324,'Children ARV Regimen_3rdLine_6A','Children ARV Regimen_3rdLine_6A disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_6A\n Children ARV Regimen_3rdLine_6A disaggregated by weight, sex, age\n \n 2023-08-15 19:27:09 UTC\n \n 2023-08-15 19:27:54 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2324\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-15 21:27:09',4,'2023-08-15 21:27:54',4,0,NULL,NULL,NULL,'2478792b-752a-4b20-97f7-5033810e1ba8'),(2325,'Children ARV Regimen_3rdLine_6A Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_6A Data Set\n \n 2023-08-15 19:27:54 UTC\n \n 2023-08-15 21:23:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2325\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4yr0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4yr10-1\n \n \n \n \n \n \n \n \n \n F1-4yr14-1\n \n \n \n \n \n \n \n \n \n F1-4yr20-2\n \n \n \n \n \n \n \n \n \n F1-4yr25-3\n \n \n \n \n \n \n \n \n \n F1-4yr4-5\n \n \n \n \n \n \n \n \n \n F1-4yr6-9\n \n \n \n \n \n \n \n \n \n F1-4yr>=35\n \n \n \n \n \n \n \n \n \n F10-14yr0-\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14yr10\n \n \n \n \n \n \n F10-14yr14\n \n \n \n \n \n \n F10-14yr20\n \n \n \n \n \n \n F10-14yr25\n \n \n \n \n \n \n F10-14yr4-\n \n \n \n \n \n \n F10-14yr6\n \n \n \n \n \n \n F10-14yr>=\n \n \n \n \n \n \n F5-9yr0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9yr10-1\n \n \n \n \n \n \n F5-9yr14-1\n \n \n \n \n \n \n F5-9yr20-2\n \n \n \n \n \n \n F5-9yr25-3\n \n \n \n \n \n \n F5-9yr4-5\n \n \n \n \n \n \n F5-9yr6-9\n \n \n \n \n \n \n F5-9yr>=35\n \n \n \n \n \n \n F<1y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1yr10-13\n \n \n \n \n \n \n F<1yr14-19\n \n \n \n \n \n \n F<1yr20-24\n \n \n \n \n \n \n F<1yr25-34\n \n \n \n \n \n \n F<1yr4-5\n \n \n \n \n \n \n F<1yr6-9\n \n \n \n \n \n \n F<1yr>=35\n \n \n \n \n \n \n M1-4yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4yr10-1\n \n \n \n \n \n \n M1-4yr14-1\n \n \n \n \n \n \n M1-4yr20-2\n \n \n \n \n \n \n M1-4yr25-3\n \n \n \n \n \n \n M1-4yr4-5\n \n \n \n \n \n \n M1-4yr6-9\n \n \n \n \n \n \n M1-4yr>=35\n \n \n \n \n \n \n M10-14yr0-\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14yr10\n \n \n \n \n \n \n M10-14yr14\n \n \n \n \n \n \n M10-14yr20\n \n \n \n \n \n \n M10-14yr25\n \n \n \n \n \n \n M10-14yr4-\n \n \n \n \n \n \n M10-14yr6-\n \n \n \n \n \n \n M10-14yr>=\n \n \n \n \n \n \n M5-9yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9yr10-1\n \n \n \n \n \n \n M5-9yr14-1\n \n \n \n \n \n \n M5-9yr20-2\n \n \n \n \n \n \n M5-9yr25-3\n \n \n \n \n \n \n M5-9yr4-5\n \n \n \n \n \n \n M5-9yr6-9\n \n \n \n \n \n \n M5-9yr>=35\n \n \n \n \n \n \n M<1yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1yr10-13\n \n \n \n \n \n \n M<1yr14-19\n \n \n \n \n \n \n M<1yr20-24\n \n \n \n \n \n \n M<1yr25-34\n \n \n \n \n \n \n M<1yr4-5\n \n \n \n \n \n \n M<1yr6-9\n \n \n \n \n \n \n M<1yr>=35\n \n \n \n \n \n \n','2023-08-15 21:27:54',4,'2023-08-15 23:23:05',4,0,NULL,NULL,NULL,'0e0b0b1e-e085-4f4f-af07-c44587b0d8f2'),(2326,'Children ARV Regimen_2ndLine_5B','Children ARV Regimen_2ndLine_5B disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5B\n Children ARV Regimen_2ndLine_5B disaggregated by weight, sex, age\n \n 2023-08-15 19:42:04 UTC\n \n 2023-08-15 19:42:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2326\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-15 21:42:04',4,'2023-08-15 21:42:28',4,0,NULL,NULL,NULL,'85cddf9e-e519-40f9-9df5-e1d36c7c2b27'),(2327,'Children ARV Regimen_2ndLine_5B Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5B Data Set\n \n 2023-08-15 19:42:28 UTC\n \n 2023-08-16 10:02:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2327\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4y0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4y10-13\n \n \n \n \n \n \n \n \n \n F1-4y14-19\n \n \n \n \n \n \n \n \n \n F1-4y20-24\n \n \n \n \n \n \n \n \n \n F1-4y25-34\n \n \n \n \n \n \n \n \n \n F1-4y4-5\n \n \n \n \n \n \n \n \n \n F1-4y6-9\n \n \n \n \n \n \n \n \n \n F1-4y>=35\n \n \n \n \n \n \n \n \n \n F10-14y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14y10-\n \n \n \n \n \n \n \n \n \n F10-14y14-\n \n \n \n \n \n \n F10-14y20-\n \n \n \n \n \n \n F10-14y25-\n \n \n \n \n \n \n F10-14y4-5\n \n \n \n \n \n \n F10-14y6-9\n \n \n \n \n \n \n F10-14y>=3\n \n \n \n \n \n \n F5-9y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9y10-13\n \n \n \n \n \n \n F5-9y14-19\n \n \n \n \n \n \n F5-9y20-24\n \n \n \n \n \n \n F5-9y25-34\n \n \n \n \n \n \n F5-9y4-5\n \n \n \n \n \n \n F5-9y6-9\n \n \n \n \n \n \n F5-9y>=35\n \n \n \n \n \n \n F<1y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1y10-13\n \n \n \n \n \n \n F<1y14-19\n \n \n \n \n \n \n F<1y20-24\n \n \n \n \n \n \n F<1y25-34\n \n \n \n \n \n \n F<1y4-5\n \n \n \n \n \n \n F<1y6-9\n \n \n \n \n \n \n F<1y>=35\n \n \n \n \n \n \n M1-4y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4y10-14\n \n \n \n \n \n \n M1-4y14-19\n \n \n \n \n \n \n M1-4y20-24\n \n \n \n \n \n \n M1-4y25-34\n \n \n \n \n \n \n M1-4y4-5\n \n \n \n \n \n \n M1-4y6-9\n \n \n \n \n \n \n M1-4y>=35\n \n \n \n \n \n \n M10-14y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14y10-\n \n \n \n \n \n \n M10-14y14-\n \n \n \n \n \n \n M10-14y20-\n \n \n \n \n \n \n M10-14y25-\n \n \n \n \n \n \n M10-14y4-5\n \n \n \n \n \n \n M10-14y6-9\n \n \n \n \n \n \n M10-14y>=3\n \n \n \n \n \n \n M5-9y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9y10-13\n \n \n \n \n \n \n M5-9y14-19\n \n \n \n \n \n \n M5-9y20-24\n \n \n \n \n \n \n M5-9y25-34\n \n \n \n \n \n \n M5-9y4-5\n \n \n \n \n \n \n M5-9y6-9\n \n \n \n \n \n \n M5-9y>=35\n \n \n \n \n \n \n M<1y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1y10-13\n \n \n \n \n \n \n M<1y14-19\n \n \n \n \n \n \n M<1y20-24\n \n \n \n \n \n \n M<1y25-34\n \n \n \n \n \n \n M<1y4-5\n \n \n \n \n \n \n M<1y6-9\n \n \n \n \n \n \n M<1y>=35\n \n \n \n \n \n \n','2023-08-15 21:42:28',4,'2023-08-16 12:02:14',4,0,NULL,NULL,NULL,'b217699a-cf93-4478-8b85-8f59939d020a'),(2328,'Children ARV Regimen_3rdLine_6B ','Children ARV Regimen_3rdLine_6B disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_6B \n Children ARV Regimen_3rdLine_6B disaggregated by weight, sex, age\n \n 2023-08-16 08:51:49 UTC\n \n 2023-08-16 08:53:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2328\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-16 10:51:49',4,'2023-08-16 10:53:21',4,0,NULL,NULL,NULL,'1f0f9f2c-575a-462f-be70-5b8774c58cd6'),(2329,'Children ARV Regimen_3rdLine_6B Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_6B Data Set\n \n 2023-08-16 08:53:21 UTC\n \n 2023-08-16 11:15:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2329\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4yr0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4yr10-1\n \n \n \n \n \n \n \n \n \n F1-4yr14-1\n \n \n \n \n \n \n \n \n \n F1-4yr20-2\n \n \n \n \n \n \n \n \n \n F1-4yr25-3\n \n \n \n \n \n \n \n \n \n F1-4yr4-5\n \n \n \n \n \n \n \n \n \n F1-4yr6-9\n \n \n \n \n \n \n \n \n \n F1-4yr>=35\n \n \n \n \n \n \n \n \n \n F10-14yr0-\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14yr10\n \n \n \n \n \n \n F10-14yr14\n \n \n \n \n \n \n F10-14yr20\n \n \n \n \n \n \n F10-14yr25\n \n \n \n \n \n \n F10-14yr4-\n \n \n \n \n \n \n F10-14yr6-\n \n \n \n \n \n \n F10-14yr>=\n \n \n \n \n \n \n F5-9yr0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9yr10-1\n \n \n \n \n \n \n F5-9yr14-1\n \n \n \n \n \n \n F5-9yr20-2\n \n \n \n \n \n \n F5-9yr25-3\n \n \n \n \n \n \n F5-9yr4-5\n \n \n \n \n \n \n F5-9yr6-9\n \n \n \n \n \n \n F5-9yr>=35\n \n \n \n \n \n \n F<1yr0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1yr10-13\n \n \n \n \n \n \n F<1yr14-19\n \n \n \n \n \n \n F<1yr20-24\n \n \n \n \n \n \n F<1yr25-34\n \n \n \n \n \n \n F<1yr4-5\n \n \n \n \n \n \n F<1yr6-9\n \n \n \n \n \n \n F<1yr>=35\n \n \n \n \n \n \n M1-4yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4yr10-1\n \n \n \n \n \n \n M1-4yr14-1\n \n \n \n \n \n \n M1-4yr20-2\n \n \n \n \n \n \n M1-4yr25-3\n \n \n \n \n \n \n M1-4yr4-5\n \n \n \n \n \n \n M1-4yr6-9\n \n \n \n \n \n \n M1-4yr>=35\n \n \n \n \n \n \n M10-14yr0-\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14yr10\n \n \n \n \n \n \n M10-14yr14\n \n \n \n \n \n \n M10-14yr20\n \n \n \n \n \n \n M10-14yr25\n \n \n \n \n \n \n M10-14yr4-\n \n \n \n \n \n \n M10-14yr6-\n \n \n \n \n \n \n M10-14yr>=\n \n \n \n \n \n \n M5-9yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9yr10-1\n \n \n \n \n \n \n M5-9yr14-1\n \n \n \n \n \n \n M5-9yr20-2\n \n \n \n \n \n \n M5-9yr25-3\n \n \n \n \n \n \n M5-9yr4-5\n \n \n \n \n \n \n M5-9yr6-9\n \n \n \n \n \n \n M5-9yr>=35\n \n \n \n \n \n \n M<1yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1yr10-13\n \n \n \n \n \n \n M<1yr14-19\n \n \n \n \n \n \n M<1yr20-24\n \n \n \n \n \n \n M<1yr25-34\n \n \n \n \n \n \n M<1yr4-5\n \n \n \n \n \n \n M<1yr6-9\n \n \n \n \n \n \n M<1yr>=35\n \n \n \n \n \n \n','2023-08-16 10:53:21',4,'2023-08-16 13:15:59',4,0,NULL,NULL,NULL,'983588a7-5b66-41ef-ad94-a32596694717'),(2330,'HIV Lost To Follow Up','HIV patients who have not been seen for at least 18 months','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HIV Lost To Follow Up\n HIV patients who have not been seen for at least 18 months\n \n 2023-08-16 09:25:57 UTC\n \n \n lastExecutionTime\n \n java.util.Date\n true\n \n \n \n \n /* \n * Name:HIV Lost To Follow Up \n * Query Type: SQL Cohort Query \n * Description: HIV patients who have not been seen for at least 18 months \n * Assumption: Database has only HIV patients \n * HIV Case Reporting Module has already excluded patients previously added to the list. \n */ \n \n SELECT e2.patient_id \n FROM ( \n SELECT e1.patient_id, max(e1.encounter_datetime) as latest_encounter_date \n FROM encounter e1 \n WHERE not e1.voided \n GROUP BY e1.patient_id \n ) as e2 \n WHERE \n date(e2.latest_encounter_date) <= DATE_SUB(now(), INTERVAL 18 MONTH) \n AND \n date(e2.latest_encounter_date) > DATE_SUB(:lastExecutionTime, INTERVAL 18 MONTH); \n\n','2023-08-16 11:25:57',2,NULL,NULL,0,NULL,NULL,NULL,'8916dca2-85b6-4eea-b921-d5cffe1056d4'),(2331,'HIV Patient Died','HIV patients who have died','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HIV Patient Died\n HIV patients who have died\n \n 2023-08-16 09:25:57 UTC\n \n \n lastExecutionTime\n \n java.util.Date\n true\n \n \n \n \n /* \n * Name:HIV Patient Died \n * Query Type: SQL Cohort Query \n * Description: HIV patients who have died \n * Assumption: Database has only HIV patients \n * HIV Case Reporting Module has already excluded patients previously added to the list. \n */ \n \n SELECT person_id \n FROM person \n WHERE dead = 1 \n AND( \n date_created >= date(:lastExecutionTime) \n OR date_changed >= date(:lastExecutionTime) \n ) \n AND not voided; \n\n','2023-08-16 11:25:57',2,NULL,NULL,0,NULL,NULL,NULL,'d8cb3c40-0d86-4448-8f1f-cf4cd91ece26'),(2333,'Children ARV Regimen_2ndLine_5C','Children ARV Regimen_2ndLine_5C disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5C\n Children ARV Regimen_2ndLine_5C disaggregated by weight, sex, age\n \n 2023-08-16 10:14:20 UTC\n \n 2023-08-16 10:14:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2333\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-16 12:14:20',4,'2023-08-16 12:14:36',4,0,NULL,NULL,NULL,'38a458f9-cb42-4eb7-9b3a-22be06efe0e5'),(2334,'Children ARV Regimen_2ndLine_5C Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5C Data Set\n \n 2023-08-16 10:14:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n \n \n','2023-08-16 12:14:27',4,NULL,NULL,0,NULL,NULL,NULL,'2d670708-bd88-4e83-b9fa-9a0b6d137ea1'),(2335,'Children ARV Regimen_2ndLine_5C Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5C Data Set\n \n 2023-08-16 10:14:36 UTC\n \n 2023-08-16 11:42:37 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2335\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4y0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4y10-13\n \n \n \n \n \n \n \n \n \n F1-4y14-19\n \n \n \n \n \n \n \n \n \n F1-4y20-24\n \n \n \n \n \n \n \n \n \n F1-4y25-34\n \n \n \n \n \n \n \n \n \n F1-4y4-5\n \n \n \n \n \n \n \n \n \n F1-4y6-9\n \n \n \n \n \n \n \n \n \n F1-4y>=35\n \n \n \n \n \n \n \n \n \n F10-14y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14y10-\n \n \n \n \n \n \n F10-14y14-\n \n \n \n \n \n \n F10-14y20-\n \n \n \n \n \n \n F10-14y25-\n \n \n \n \n \n \n F10-14y4-5\n \n \n \n \n \n \n F10-14y6-9\n \n \n \n \n \n \n \n \n \n F10-14y>=3\n \n \n \n \n \n \n F5-9y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9y10-13\n \n \n \n \n \n \n F5-9y14-19\n \n \n \n \n \n \n \n \n \n F5-9y20-24\n \n \n \n \n \n \n F5-9y25-34\n \n \n \n \n \n \n F5-9y4-5\n \n \n \n \n \n \n F5-9y6-9\n \n \n \n \n \n \n F5-9y>=35\n \n \n \n \n \n \n F<1y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1y10-13\n \n \n \n \n \n \n F<1y14-19\n \n \n \n \n \n \n F<1y20-24\n \n \n \n \n \n \n F<1y25-34\n \n \n \n \n \n \n F<1y4-9\n \n \n \n \n \n \n F<1y6-9\n \n \n \n \n \n \n F<1y>=35\n \n \n \n \n \n \n M1-4y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4y10-13\n \n \n \n \n \n \n M1-4y14-19\n \n \n \n \n \n \n M1-4y20-24\n \n \n \n \n \n \n \n \n \n M1-4y25-34\n \n \n \n \n \n \n M1-4y4-5\n \n \n \n \n \n \n M1-4y6-9\n \n \n \n \n \n \n M1-4y>=35\n \n \n \n \n \n \n M10-14y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14y10-\n \n \n \n \n \n \n M10-14y14-\n \n \n \n \n \n \n \n \n \n M10-14y20-\n \n \n \n \n \n \n M10-14y25-\n \n \n \n \n \n \n M10-14y4-5\n \n \n \n \n \n \n M10-14y6-9\n \n \n \n \n \n \n M10-14y>=3\n \n \n \n \n \n \n M5-9y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9y10-13\n \n \n \n \n \n \n M5-9y14-19\n \n \n \n \n \n \n M5-9y20-24\n \n \n \n \n \n \n M5-9y25-34\n \n \n \n \n \n \n M5-9y4-5\n \n \n \n \n \n \n M5-9y6-9\n \n \n \n \n \n \n M5-9y>=35\n \n \n \n \n \n \n M<1y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1y10-13\n \n \n \n \n \n \n M<1y14-19\n \n \n \n \n \n \n M<1y20-24\n \n \n \n \n \n \n M<1y24-34\n \n \n \n \n \n \n M<1y5-9\n \n \n \n \n \n \n M<1y6-9\n \n \n \n \n \n \n M<1y>=35\n \n \n \n \n \n \n','2023-08-16 12:14:36',4,'2023-08-16 13:42:37',4,0,NULL,NULL,NULL,'5add0ab6-3850-4623-ad50-8f5d30ba2df9'),(2336,'Children ARV Regimen_2ndLine_5D','Children ARV Regimen_2ndLine_5D disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5D\n Children ARV Regimen_2ndLine_5D disaggregated by weight, sex, age\n \n 2023-08-16 11:00:11 UTC\n \n 2023-08-16 11:00:49 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2336\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-16 13:00:11',4,'2023-08-16 13:00:49',4,0,NULL,NULL,NULL,'3a4943e7-3026-4e28-b345-26acb4012006'),(2337,'Children ARV Regimen_2ndLine_5D Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5D Data Set\n \n 2023-08-16 11:00:49 UTC\n \n 2023-08-16 14:46:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2337\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4y0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4y10-13\n \n \n \n \n \n \n \n \n \n F1-4y14-19\n \n \n \n \n \n \n \n \n \n F1-4y20-24\n \n \n \n \n \n \n \n \n \n F1-4y25-34\n \n \n \n \n \n \n \n \n \n F1-4y4-5\n \n \n \n \n \n \n \n \n \n F1-4y6-9\n \n \n \n \n \n \n \n \n \n F1-4y>=35\n \n \n \n \n \n \n \n \n \n F10-14y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14y10-\n \n \n \n \n \n \n F10-14y14-\n \n \n \n \n \n \n F10-14y20-\n \n \n \n \n \n \n F10-14y25-\n \n \n \n \n \n \n F10-14y4-5\n \n \n \n \n \n \n F10-14y6-9\n \n \n \n \n \n \n F10-14y>=3\n \n \n \n \n \n \n F5-9y0-3\n \n \n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9y10-13\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9y14-19\n \n \n \n \n \n \n F5-9y20-24\n \n \n \n \n \n \n F5-9y25-34\n \n \n \n \n \n \n F5-9y4-5\n \n \n \n \n \n \n F5-9y6-9\n \n \n \n \n \n \n F5-9y>=35\n \n \n \n \n \n \n F<1y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1y10-13\n \n \n \n \n \n \n F<1y14-19\n \n \n \n \n \n \n F<1y20-24\n \n \n \n \n \n \n F<1y25-34\n \n \n \n \n \n \n F<1y4-5\n \n \n \n \n \n \n F<1y6-9\n \n \n \n \n \n \n F<1y>=35\n \n \n \n \n \n \n M1-4y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4y10-13\n \n \n \n \n \n \n M1-4y14-19\n \n \n \n \n \n \n M1-4y20-24\n \n \n \n \n \n \n M1-4y25-34\n \n \n \n \n \n \n M1-4y4-5\n \n \n \n \n \n \n M1-4y6-9\n \n \n \n \n \n \n M1-4y>=35\n \n \n \n \n \n \n M10-14y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14y10-\n \n \n \n \n \n \n \n \n \n M10-14y14-\n \n \n \n \n \n \n \n \n \n M10-14y20-\n \n \n \n \n \n \n M10-14y25-\n \n \n \n \n \n \n M10-14y4-5\n \n \n \n \n \n \n M10-14y6-9\n \n \n \n \n \n \n M10-14y>=3\n \n \n \n \n \n \n M5-9y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9y10-13\n \n \n \n \n \n \n M5-9y14-19\n \n \n \n \n \n \n M5-9y20-24\n \n \n \n \n \n \n M5-9y25-34\n \n \n \n \n \n \n M5-9y4-5\n \n \n \n \n \n \n M5-9y6-9\n \n \n \n \n \n \n M5-9y>=35\n \n \n \n \n \n \n M<1y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1y10-13\n \n \n \n \n \n \n M<1y14-19\n \n \n \n \n \n \n M<1y20-24\n \n \n \n \n \n \n M<1y25-34\n \n \n \n \n \n \n M<1y4-5\n \n \n \n \n \n \n M<1y6-9\n \n \n \n \n \n \n M<1y>=35\n \n \n \n \n \n \n','2023-08-16 13:00:49',4,'2023-08-16 16:46:17',4,0,NULL,NULL,NULL,'51fbe59a-77f3-40b1-9d18-e90e9cd9cacc'),(2338,'Children ARV Regimen_3rdLine_6C','Children ARV Regimen_3rdLine_6C disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_6C\n Children ARV Regimen_3rdLine_6C disaggregated by weight, sex, age\n \n 2023-08-16 11:26:46 UTC\n \n 2023-08-16 11:27:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2338\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-16 13:26:46',4,'2023-08-16 13:27:31',4,0,NULL,NULL,NULL,'61228d0f-b944-4ccc-ba45-d47ecd58c914'),(2339,'Children ARV Regimen_3rdLine_6C Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_6C Data Set\n \n 2023-08-16 11:27:31 UTC\n \n 2023-08-16 12:37:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2339\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4yr0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4yr10-1\n \n \n \n \n \n \n \n \n \n F1-4yr14-1\n \n \n \n \n \n \n \n \n \n F1-4yr20-2\n \n \n \n \n \n \n \n \n \n F1-4yr25-3\n \n \n \n \n \n \n \n \n \n F1-4yr4-5\n \n \n \n \n \n \n \n \n \n F1-4yr6-9\n \n \n \n \n \n \n \n \n \n F1-4yr>=35\n \n \n \n \n \n \n \n \n \n F10-14yr0-\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14yr10\n \n \n \n \n \n \n F10-14yr14\n \n \n \n \n \n \n F10-14yr20\n \n \n \n \n \n \n \n \n \n F10-14yr25\n \n \n \n \n \n \n F10-14yr4-\n \n \n \n \n \n \n F10-14yr6-\n \n \n \n \n \n \n F10-14yr>=\n \n \n \n \n \n \n F5-9yr0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9yr10-1\n \n \n \n \n \n \n F5-9yr14-1\n \n \n \n \n \n \n F5-9yr20-2\n \n \n \n \n \n \n F5-9yr25-3\n \n \n \n \n \n \n F5-9yr4-5\n \n \n \n \n \n \n F5-9yr6-9\n \n \n \n \n \n \n F5-9yr>=35\n \n \n \n \n \n \n F<1yr0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1yr10-13\n \n \n \n \n \n \n F<1yr14-19\n \n \n \n \n \n \n F<1yr20-24\n \n \n \n \n \n \n F<1yr25-34\n \n \n \n \n \n \n F<1yr4-5\n \n \n \n \n \n \n F<1yr6-9\n \n \n \n \n \n \n F<1yr>=35\n \n \n \n \n \n \n M1-4yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4yr10-1\n \n \n \n \n \n \n M1-4yr14-1\n \n \n \n \n \n \n M1-4yr20-2\n \n \n \n \n \n \n M1-4yr25-3\n \n \n \n \n \n \n M1-4yr4-5\n \n \n \n \n \n \n M1-4yr6-9\n \n \n \n \n \n \n M1-4yr>=35\n \n \n \n \n \n \n M10-14yr0-\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14yr10\n \n \n \n \n \n \n M10-14yr14\n \n \n \n \n \n \n M10-14yr20\n \n \n \n \n \n \n M10-14yr25\n \n \n \n \n \n \n M10-14yr4-\n \n \n \n \n \n \n M10-14yr6-\n \n \n \n \n \n \n M10-14yr>=\n \n \n \n \n \n \n M5-9yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9yr10-1\n \n \n \n \n \n \n M5-9yr14-1\n \n \n \n \n \n \n M5-9yr20-2\n \n \n \n \n \n \n M5-9yr25-3\n \n \n \n \n \n \n M5-9yr4-5\n \n \n \n \n \n \n M5-9yr6-9\n \n \n \n \n \n \n M5-9yr>=35\n \n \n \n \n \n \n M<1yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1yr10-13\n \n \n \n \n \n \n M<1yr14-19\n \n \n \n \n \n \n M<1yr20-24\n \n \n \n \n \n \n M<1yr25-34\n \n \n \n \n \n \n M<1yr4-5\n \n \n \n \n \n \n M<1yr6-9\n \n \n \n \n \n \n M<1yr>=35\n \n \n \n \n \n \n','2023-08-16 13:27:31',4,'2023-08-16 14:37:59',4,0,NULL,NULL,NULL,'4a1d329b-6eeb-4ef7-a104-d1c6f9479abc'),(2342,'Children ARV Regimen_2ndLine_5E','Children ARV Regimen_2ndLine_5E disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5E\n Children ARV Regimen_2ndLine_5E disaggregated by weight, sex, age\n \n 2023-08-16 11:51:18 UTC\n \n 2023-08-16 11:52:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2342\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-16 13:51:18',4,'2023-08-16 13:52:18',4,0,NULL,NULL,NULL,'f710c498-9264-4d7e-bdb4-e846dec7972b'),(2343,'Children ARV Regimen_2ndLine_5E Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5E Data Set\n \n 2023-08-16 11:51:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n \n \n','2023-08-16 13:51:29',4,NULL,NULL,0,NULL,NULL,NULL,'8eaa5921-d13d-4bd9-912d-d9d09af7394f'),(2344,'Children ARV Regimen_2ndLine_5E Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5E Data Set\n \n 2023-08-16 11:52:09 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n \n \n','2023-08-16 13:52:09',4,NULL,NULL,0,NULL,NULL,NULL,'0105c46c-76ef-4088-b5b1-b89e42dc49d1'),(2345,'Children ARV Regimen_2ndLine_5E Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5E Data Set\n \n 2023-08-16 11:52:18 UTC\n \n 2023-08-16 15:02:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2345\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4y0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4y10-13\n \n \n \n \n \n \n \n \n \n F1-4y14-19\n \n \n \n \n \n \n \n \n \n F1-4y20-24\n \n \n \n \n \n \n \n \n \n F1-4y25-34\n \n \n \n \n \n \n \n \n \n F1-4y4-5\n \n \n \n \n \n \n \n \n \n F1-4y6-9\n \n \n \n \n \n \n \n \n \n F1-4y>=35\n \n \n \n \n \n \n \n \n \n F10-14y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14y10-\n \n \n \n \n \n \n F10-14y14-\n \n \n \n \n \n \n F10-14y20-\n \n \n \n \n \n \n F10-14y25-\n \n \n \n \n \n \n F10-14y4-5\n \n \n \n \n \n \n \n \n \n F10-14y6-9\n \n \n \n \n \n \n F10-14y>=3\n \n \n \n \n \n \n F5-9y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9y10-13\n \n \n \n \n \n \n F5-9y14-19\n \n \n \n \n \n \n F5-9y20-24\n \n \n \n \n \n \n F5-9y25-34\n \n \n \n \n \n \n F5-9y4-5\n \n \n \n \n \n \n F5-9y6-9\n \n \n \n \n \n \n F5-9y>=35\n \n \n \n \n \n \n F6-9y4-5\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1y0-3\n \n \n \n \n \n \n F<1y10-13\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Adults\n \n \n \n \n \n F<1y14-19\n \n \n \n \n \n \n F<1y20-24\n \n \n \n \n \n \n F<1y25-34\n \n \n \n \n \n \n F<1y4-5\n \n \n \n \n \n \n F<1y6-9\n \n \n \n \n \n \n F<1y>=35\n \n \n \n \n \n \n M1-4y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4y10-13\n \n \n \n \n \n \n M1-4y14-19\n \n \n \n \n \n \n M1-4y20-24\n \n \n \n \n \n \n \n \n \n M1-4y25-34\n \n \n \n \n \n \n M1-4y4-5\n \n \n \n \n \n \n M1-4y6-9\n \n \n \n \n \n \n M1-4y>=35\n \n \n \n \n \n \n M10-14y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14y10-\n \n \n \n \n \n \n M10-14y14-\n \n \n \n \n \n \n M10-14y20-\n \n \n \n \n \n \n M10-14y25-\n \n \n \n \n \n \n M10-14y4-5\n \n \n \n \n \n \n M10-14y6-9\n \n \n \n \n \n \n M10-14y>=3\n \n \n \n \n \n \n M5-9y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9y10-13\n \n \n \n \n \n \n M5-9y14-19\n \n \n \n \n \n \n M5-9y20-24\n \n \n \n \n \n \n M5-9y25-34\n \n \n \n \n \n \n M5-9y4-5\n \n \n \n \n \n \n M5-9y6-9\n \n \n \n \n \n \n M5-9y>=35\n \n \n \n \n \n \n M<1y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1y10-13\n \n \n \n \n \n \n M<1y14-19\n \n \n \n \n \n \n M<1y20-24\n \n \n \n \n \n \n M<1y25-34\n \n \n \n \n \n \n M<1y4-5\n \n \n \n \n \n \n M<1y6-9\n \n \n \n \n \n \n M<1y>=35\n \n \n \n \n \n \n','2023-08-16 13:52:18',4,'2023-08-16 17:02:44',4,0,NULL,NULL,NULL,'3b422368-2868-4d7f-a24f-936289c1b8a2'),(2346,'Children ARV Regimen_3rdLine_6D','Children ARV Regimen_3rdLine_6D disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_6D\n Children ARV Regimen_3rdLine_6D disaggregated by weight, sex, age\n \n 2023-08-16 14:30:52 UTC\n \n 2023-08-16 14:31:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2346\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-16 16:30:52',4,'2023-08-16 16:31:03',4,0,NULL,NULL,NULL,'7f66540d-c280-4dd8-a771-71057ff7ce42'),(2347,'Children ARV Regimen_3rdLine_6D Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_6D Data Set\n \n 2023-08-16 14:31:03 UTC\n \n 2023-08-16 15:52:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2347\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4yr0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4yr10-1\n \n \n \n \n \n \n \n \n \n F1-4yr14-1\n \n \n \n \n \n \n \n \n \n F1-4yr20-2\n \n \n \n \n \n \n \n \n \n F1-4yr25-3\n \n \n \n \n \n \n \n \n \n F1-4yr4-5\n \n \n \n \n \n \n \n \n \n F1-4yr6-9\n \n \n \n \n \n \n \n \n \n F1-4yr>=35\n \n \n \n \n \n \n \n \n \n F10-14yr0-\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14yr10\n \n \n \n \n \n \n F10-14yr14\n \n \n \n \n \n \n F10-14yr20\n \n \n \n \n \n \n \n \n \n F10-14yr25\n \n \n \n \n \n \n \n \n \n F10-14yr4-\n \n \n \n \n \n \n F10-14yr6-\n \n \n \n \n \n \n F10-14yr>=\n \n \n \n \n \n \n F5-9yr0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9yr10-1\n \n \n \n \n \n \n F5-9yr14-1\n \n \n \n \n \n \n F5-9yr20-2\n \n \n \n \n \n \n F5-9yr25-3\n \n \n \n \n \n \n F5-9yr4-5\n \n \n \n \n \n \n F5-9yr6-9\n \n \n \n \n \n \n F5-9yr>=35\n \n \n \n \n \n \n F<1yr0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1yr10-13\n \n \n \n \n \n \n \n \n \n F<1yr14-19\n \n \n \n \n \n \n F<1yr20-24\n \n \n \n \n \n \n F<1yr25-34\n \n \n \n \n \n \n F<1yr4-5\n \n \n \n \n \n \n F<1yr6-9\n \n \n \n \n \n \n F<1yr>=35\n \n \n \n \n \n \n M1-4yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4yr10-1\n \n \n \n \n \n \n M1-4yr14-1\n \n \n \n \n \n \n M1-4yr20-2\n \n \n \n \n \n \n M1-4yr25-3\n \n \n \n \n \n \n M1-4yr4-5\n \n \n \n \n \n \n M1-4yr6-9\n \n \n \n \n \n \n M1-4yr>=35\n \n \n \n \n \n \n M10-14yr0-\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14yr10\n \n \n \n \n \n \n M10-14yr14\n \n \n \n \n \n \n M10-14yr20\n \n \n \n \n \n \n M10-14yr25\n \n \n \n \n \n \n M10-14yr4-\n \n \n \n \n \n \n M10-14yr6-\n \n \n \n \n \n \n M10-14yr>=\n \n \n \n \n \n \n M5-9yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9yr10-1\n \n \n \n \n \n \n M5-9yr14-1\n \n \n \n \n \n \n M5-9yr20-2\n \n \n \n \n \n \n M5-9yr25-3\n \n \n \n \n \n \n M5-9yr4-5\n \n \n \n \n \n \n M5-9yr6-9\n \n \n \n \n \n \n M5-9yr>=35\n \n \n \n \n \n \n M<1yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1yr10-13\n \n \n \n \n \n \n M<1yr14-19\n \n \n \n \n \n \n M<1yr20-24\n \n \n \n \n \n \n M<1yr25-34\n \n \n \n \n \n \n M<1yr4-5\n \n \n \n \n \n \n M<1yr6-9\n \n \n \n \n \n \n M<1yr>=35\n \n \n \n \n \n \n','2023-08-16 16:31:03',4,'2023-08-16 17:52:50',4,0,NULL,NULL,NULL,'27ae096d-4997-4d00-a00a-390c70159a12'),(2348,'Children ARV Regimen_2ndLine_5F','Children ARV Regimen_2ndLine_5F disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5F\n Children ARV Regimen_2ndLine_5F disaggregated by weight, sex, age\n \n 2023-08-16 14:55:10 UTC\n \n 2023-08-16 14:55:33 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2348\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-16 16:55:10',4,'2023-08-16 16:55:33',4,0,NULL,NULL,NULL,'9d77bcc5-cf55-4f71-8e9b-77d19d82e10d'),(2349,'Children ARV Regimen_2ndLine_5F Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5F Data Set\n \n 2023-08-16 14:55:33 UTC\n \n 2023-08-16 15:48:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2349\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4y0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4y10-13\n \n \n \n \n \n \n \n \n \n F1-4y14-19\n \n \n \n \n \n \n \n \n \n F1-4y20-24\n \n \n \n \n \n \n \n \n \n F1-4y25-34\n \n \n \n \n \n \n \n \n \n F1-4y4-5\n \n \n \n \n \n \n \n \n \n F1-4y6-9\n \n \n \n \n \n \n \n \n \n F1-4y>=35\n \n \n \n \n \n \n \n \n \n F10-14y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14y10-\n \n \n \n \n \n \n \n \n \n F10-14y14-\n \n \n \n \n \n \n F10-14y20-\n \n \n \n \n \n \n F10-14y25-\n \n \n \n \n \n \n F10-14y4-5\n \n \n \n \n \n \n F10-14y6-9\n \n \n \n \n \n \n F10-14y>=3\n \n \n \n \n \n \n F5-9y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9y10-13\n \n \n \n \n \n \n F5-9y14-19\n \n \n \n \n \n \n F5-9y20-24\n \n \n \n \n \n \n F5-9y25-34\n \n \n \n \n \n \n F5-9y4-5\n \n \n \n \n \n \n F5-9y6-9\n \n \n \n \n \n \n F5-9y>=35\n \n \n \n \n \n \n F<1y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1y10-13\n \n \n \n \n \n \n F<1y14-19\n \n \n \n \n \n \n F<1y20-24\n \n \n \n \n \n \n F<1y25-34\n \n \n \n \n \n \n F<1y4-5\n \n \n \n \n \n \n F<1y6-9\n \n \n \n \n \n \n \n \n \n F<1y>=35\n \n \n \n \n \n \n M1-4y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4y10-13\n \n \n \n \n \n \n M1-4y14-19\n \n \n \n \n \n \n M1-4y20-24\n \n \n \n \n \n \n M1-4y25-34\n \n \n \n \n \n \n M1-4y4-5\n \n \n \n \n \n \n M1-4y6-9\n \n \n \n \n \n \n M1-4y>=35\n \n \n \n \n \n \n M10-14y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14y10-\n \n \n \n \n \n \n M10-14y14-\n \n \n \n \n \n \n M10-14y20-\n \n \n \n \n \n \n M10-14y25-\n \n \n \n \n \n \n M10-14y4-5\n \n \n \n \n \n \n M10-14y6-9\n \n \n \n \n \n \n M10-14y>=3\n \n \n \n \n \n \n M5-9y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9y10-13\n \n \n \n \n \n \n M5-9y14-19\n \n \n \n \n \n \n M5-9y20-24\n \n \n \n \n \n \n M5-9y25-34\n \n \n \n \n \n \n M5-9y4-5\n \n \n \n \n \n \n M5-9y6-9\n \n \n \n \n \n \n M5-9y>=35\n \n \n \n \n \n \n M<1y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1y10-13\n \n \n \n \n \n \n M<1y14-19\n \n \n \n \n \n \n M<1y20-24\n \n \n \n \n \n \n M<1y25-34\n \n \n \n \n \n \n M<1y4-5\n \n \n \n \n \n \n M<1y6-9\n \n \n \n \n \n \n M<1y>=35\n \n \n \n \n \n \n','2023-08-16 16:55:33',4,'2023-08-16 17:48:02',4,0,NULL,NULL,NULL,'dc690b7d-b448-4f9f-b159-00d2671710e6'),(2350,'Children ARV Regimen_2ndLine_5G','Children ARV Regimen_2ndLine_5G','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5G\n Children ARV Regimen_2ndLine_5G\n \n 2023-08-16 15:09:07 UTC\n \n 2023-08-16 15:10:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2350\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-16 17:09:07',4,'2023-08-16 17:10:08',4,0,NULL,NULL,NULL,'f2f7b2a9-f96e-4f72-8edf-5e0a4195ec85'),(2351,'Children ARV Regimen_2ndLine_5G Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5G Data Set\n \n 2023-08-16 15:10:08 UTC\n \n 2023-08-16 18:01:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2351\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4y0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4y10-13\n \n \n \n \n \n \n \n \n \n F1-4y14-19\n \n \n \n \n \n \n \n \n \n F1-4y20-24\n \n \n \n \n \n \n \n \n \n F1-4y25-34\n \n \n \n \n \n \n \n \n \n F1-4y4-5\n \n \n \n \n \n \n \n \n \n F1-4y6-9\n \n \n \n \n \n \n \n \n \n F1-4y>=35\n \n \n \n \n \n \n \n \n \n F10-14y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14y10-\n \n \n \n \n \n \n \n \n \n F10-14y14-\n \n \n \n \n \n \n \n \n \n F10-14y20-\n \n \n \n \n \n \n \n \n \n F10-14y25-\n \n \n \n \n \n \n F10-14y4-5\n \n \n \n \n \n \n \n \n \n F10-14y6-9\n \n \n \n \n \n \n \n \n \n F10-14y>=3\n \n \n \n \n \n \n F5-9y0-3\n \n \n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9y10-13\n \n \n \n \n \n \n F5-9y14-19\n \n \n \n \n \n \n F5-9y20-24\n \n \n \n \n \n \n F5-9y25-34\n \n \n \n \n \n \n F5-9y4-5\n \n \n \n \n \n \n F5-9y6-9\n \n \n \n \n \n \n F5-9y>=35\n \n \n \n \n \n \n F<1y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1y10-13\n \n \n \n \n \n \n F<1y14-19\n \n \n \n \n \n \n F<1y25-34\n \n \n \n \n \n \n F<1y4-5\n \n \n \n \n \n \n F<1y6-9\n \n \n \n \n \n \n F<1y>=35\n \n \n \n \n \n \n M1-4y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4y10-13\n \n \n \n \n \n \n M1-4y14-19\n \n \n \n \n \n \n M1-4y20-24\n \n \n \n \n \n \n \n \n \n M1-4y25-34\n \n \n \n \n \n \n M1-4y4-5\n \n \n \n \n \n \n M1-4y6-9\n \n \n \n \n \n \n M1-4y>=35\n \n \n \n \n \n \n \n \n \n M10-14>=35\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14y0-3\n \n \n \n \n \n \n M10-14y10-\n \n \n \n \n \n \n M10-14y14-\n \n \n \n \n \n \n M10-14y20-\n \n \n \n \n \n \n M10-14y25-\n \n \n \n \n \n \n M10-14y4-5\n \n \n \n \n \n \n M10-14y6-9\n \n \n \n \n \n \n M5-9y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9y10-13\n \n \n \n \n \n \n M5-9y14-19\n \n \n \n \n \n \n M5-9y20-24\n \n \n \n \n \n \n M5-9y25-34\n \n \n \n \n \n \n M5-9y4-5\n \n \n \n \n \n \n M5-9y6-9\n \n \n \n \n \n \n M5-9y>=35\n \n \n \n \n \n \n M<1y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1y10-13\n \n \n \n \n \n \n M<1y14-19\n \n \n \n \n \n \n M<1y20-24\n \n \n \n \n \n \n M<1y25-34\n \n \n \n \n \n \n M<1y4-5\n \n \n \n \n \n \n M<1y6-9\n \n \n \n \n \n \n M<1y>=35\n \n \n \n \n \n \n','2023-08-16 17:10:08',4,'2023-08-16 20:01:10',4,0,NULL,NULL,NULL,'1041fe73-c2e7-47db-8d84-eb79176e25fe'),(2352,'Children ARV Regimen_2ndLine_5H','Children ARV Regimen_2ndLine_5H disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5H\n Children ARV Regimen_2ndLine_5H disaggregated by weight, sex, age\n \n 2023-08-16 15:50:48 UTC\n \n 2023-08-16 15:50:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2352\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-16 17:50:48',4,'2023-08-16 17:50:59',4,0,NULL,NULL,NULL,'71b6899d-048d-4c2a-a10f-84422454ece6'),(2353,'Children ARV Regimen_2ndLine_5H Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5H Data Set\n \n 2023-08-16 15:50:59 UTC\n \n 2023-08-16 17:19:35 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2353\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4y0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4y10-13\n \n \n \n \n \n \n \n \n \n F1-4y14-19\n \n \n \n \n \n \n \n \n \n F1-4y20-24\n \n \n \n \n \n \n \n \n \n F1-4y25-34\n \n \n \n \n \n \n \n \n \n F1-4y4-5\n \n \n \n \n \n \n \n \n \n F1-4y6-9\n \n \n \n \n \n \n \n \n \n F1-4y>=35\n \n \n \n \n \n \n \n \n \n F10-14y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14y10-\n \n \n \n \n \n \n F10-14y14-\n \n \n \n \n \n \n F10-14y20-\n \n \n \n \n \n \n F10-14y25-\n \n \n \n \n \n \n F10-14y4-5\n \n \n \n \n \n \n F10-14y6-9\n \n \n \n \n \n \n F10-14y>=3\n \n \n \n \n \n \n \n \n \n F5-9y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9y10-13\n \n \n \n \n \n \n F5-9y14-19\n \n \n \n \n \n \n F5-9y20-24\n \n \n \n \n \n \n F5-9y25-34\n \n \n \n \n \n \n F5-9y4-5\n \n \n \n \n \n \n F5-9y6-9\n \n \n \n \n \n \n F5-9y>=35\n \n \n \n \n \n \n F<1y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1y10-13\n \n \n \n \n \n \n \n \n \n F<1y14-19\n \n \n \n \n \n \n F<1y20-24\n \n \n \n \n \n \n F<1y25-34\n \n \n \n \n \n \n F<1y4-5\n \n \n \n \n \n \n F<1y6-9\n \n \n \n \n \n \n F<1y>=35\n \n \n \n \n \n \n M1-4y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4y10-13\n \n \n \n \n \n \n M1-4y14-19\n \n \n \n \n \n \n M1-4y20-24\n \n \n \n \n \n \n M1-4y25-34\n \n \n \n \n \n \n M1-4y4-5\n \n \n \n \n \n \n M1-4y6-9\n \n \n \n \n \n \n M1-4y>=35\n \n \n \n \n \n \n M10-14y0-3\n \n \n \n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14y10-\n \n \n \n \n \n \n M10-14y14-\n \n \n \n \n \n \n \n \n \n M10-14y20-\n \n \n \n \n \n \n M10-14y25-\n \n \n \n \n \n \n M10-14y4-5\n \n \n \n \n \n \n M10-14y6-9\n \n \n \n \n \n \n M10-14y>=3\n \n \n \n \n \n \n M5-9y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9y10-13\n \n \n \n \n \n \n M5-9y14-19\n \n \n \n \n \n \n M5-9y20-24\n \n \n \n \n \n \n M5-9y25-34\n \n \n \n \n \n \n M5-9y4-5\n \n \n \n \n \n \n \n \n \n M5-9y6-9\n \n \n \n \n \n \n M5-9y>=35\n \n \n \n \n \n \n M<1y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1y10-13\n \n \n \n \n \n \n M<1y14-19\n \n \n \n \n \n \n M<1y20-24\n \n \n \n \n \n \n M<1y25-34\n \n \n \n \n \n \n M<1y4-5\n \n \n \n \n \n \n M<1y6-9\n \n \n \n \n \n \n M<1y>=35\n \n \n \n \n \n \n','2023-08-16 17:50:59',4,'2023-08-16 19:19:35',4,0,NULL,NULL,NULL,'fa79bb1e-c2a3-435f-8074-de92d79ed741'),(2354,'Children ARV Regimen_3rdLine_6E','Children ARV Regimen_3rdLine_6E disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_6E\n Children ARV Regimen_3rdLine_6E disaggregated by weight, sex, age\n \n 2023-08-16 15:57:11 UTC\n \n 2023-08-16 15:58:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2354\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-16 17:57:11',4,'2023-08-16 17:58:30',4,0,NULL,NULL,NULL,'ace827f2-1783-4eac-819e-12793a2c4e9f'); +INSERT INTO `serialized_object` VALUES (1776,' Clients given 6B weighing 25-34.9kg',' Clients given 6B weighing 25-34.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6B weighing 25-34.9kg\n Clients given 6B weighing 25-34.9kg\n \n 2022-07-04 19:23:47 UTC\n \n 2022-07-04 19:27:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1776\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 00:53:47',4,'2022-07-05 00:57:17',4,0,NULL,NULL,NULL,'70621294-d632-4b66-8f10-0343433b8267'),(1777,' Clients given 6B weighing >= 35kg',' Clients given 6B weighing >= 35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6B weighing >= 35kg\n Clients given 6B weighing >= 35kg\n \n 2022-07-04 19:24:19 UTC\n \n 2022-07-04 19:27:33 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1777\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 00:54:19',4,'2022-07-05 00:57:33',4,0,NULL,NULL,NULL,'ed32ff5b-41ed-4933-a39e-bc4fb685b9eb'),(1778,'Clients given 6C weighing 0-3.9kg','Clients given 6C weighing 0-3.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C weighing 0-3.9kg\n Clients given 6C weighing 0-3.9kg\n \n 2022-07-05 06:03:11 UTC\n \n 2022-07-05 06:05:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1778\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:33:11',4,'2022-07-05 11:35:26',4,0,NULL,NULL,NULL,'7708c697-6d7d-42e7-aba6-613e36081fab'),(1779,'Clients given 6C weighing 4-5.9kg','Clients given 6C weighing 6-9.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C weighing 4-5.9kg\n Clients given 6C weighing 6-9.9kg\n \n 2022-07-05 06:03:33 UTC\n \n 2022-07-05 06:09:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1779\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:33:33',4,'2022-07-05 11:39:04',4,0,NULL,NULL,NULL,'95504660-becd-4eff-a280-5aa869762885'),(1780,'Clients given 6C weighing 6-9.9kg','Clients given 6C weighing 6-9.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C weighing 6-9.9kg\n Clients given 6C weighing 6-9.9kg\n \n 2022-07-05 06:03:55 UTC\n \n 2022-07-05 06:07:47 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1780\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:33:55',4,'2022-07-05 11:37:47',4,0,NULL,NULL,NULL,'d3ba1e90-03ce-4af3-8b68-9e4bb86a2fda'),(1781,'Clients given 6C weighing 10-13.9kg','Clients given 6C weighing 10-13.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C weighing 10-13.9kg\n Clients given 6C weighing 10-13.9kg\n \n 2022-07-05 06:09:31 UTC\n \n 2022-07-05 06:12:33 UTC\n \n \n location\n \n org.openmrs.Location\n true\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n 1781\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:39:31',4,'2022-07-05 11:42:33',4,0,NULL,NULL,NULL,'bd61f262-344c-4834-846b-dbfd4b8f8454'),(1782,'Clients given 6C weighing 14-19.9kg','Clients given 6C weighing 14-19.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C weighing 14-19.9kg\n Clients given 6C weighing 14-19.9kg\n \n 2022-07-05 06:11:03 UTC\n \n 2022-07-05 06:14:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1782\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:41:03',4,'2022-07-05 11:44:18',4,0,NULL,NULL,NULL,'ef452600-16ec-4d05-bf02-a2f5da8c503d'),(1783,'Clients given 6C weighing 20-24.9kg','Clients given 6C weighing 20-24.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C weighing 20-24.9kg\n Clients given 6C weighing 20-24.9kg\n \n 2022-07-05 06:12:09 UTC\n \n 2022-07-05 06:14:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1783\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:42:09',4,'2022-07-05 11:44:44',4,0,NULL,NULL,NULL,'84b7e946-ef4b-498c-aa99-a7469d841d89'),(1784,'Clients given 6C weighing 25-34.9kg','Clients given 6C weighing 25-34.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C weighing 25-34.9kg\n Clients given 6C weighing 25-34.9kg\n \n 2022-07-05 06:13:57 UTC\n \n 2022-07-05 06:17:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1784\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:43:57',4,'2022-07-05 11:47:03',4,0,NULL,NULL,NULL,'d0662ec5-9909-46a1-8d42-4f13c5e08f54'),(1785,'Clients given 6C weighing >= 35kg','Clients given 6C weighing >= 35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C weighing >= 35kg\n Clients given 6C weighing >= 35kg\n \n 2022-07-05 06:17:43 UTC\n \n 2022-07-05 06:20:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1785\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:47:43',4,'2022-07-05 11:50:43',4,0,NULL,NULL,NULL,'e469295b-caa7-4154-b5ac-e2d0a7042d5b'),(1786,'Clients given 6D weighing 0-3.9kg','Clients given 6D weighing 0-3.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D weighing 0-3.9kg\n Clients given 6D weighing 0-3.9kg\n \n 2022-07-05 06:18:16 UTC\n \n 2022-07-05 06:19:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1786\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:48:16',4,'2022-07-05 11:49:53',4,0,NULL,NULL,NULL,'a6985c5b-86f8-4647-86ea-ddd69097681e'),(1787,'Clients given 6D weighing 4-5.9kg','Clients given 6D weighing 4-5.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D weighing 4-5.9kg\n Clients given 6D weighing 4-5.9kg\n \n 2022-07-05 06:18:43 UTC\n \n 2022-07-05 06:20:24 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1787\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:48:43',4,'2022-07-05 11:50:24',4,0,NULL,NULL,NULL,'3eec1d07-6d91-43dd-a942-24d23e4a0f9c'),(1788,'Clients given 6D weighing 6-9.9kg','Clients given 6D weighing 6-9.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D weighing 6-9.9kg\n Clients given 6D weighing 6-9.9kg\n \n 2022-07-05 06:21:17 UTC\n \n 2022-07-05 06:22:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1788\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:51:17',4,'2022-07-05 11:52:45',4,0,NULL,NULL,NULL,'37509f55-cbd9-4096-8522-1e7918b1a48c'),(1789,'Clients given 6D weighing 10-13.9kg','Clients given 6D weighing 10-13.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D weighing 10-13.9kg\n Clients given 6D weighing 10-13.9kg\n \n 2022-07-05 06:21:34 UTC\n \n 2022-07-05 06:23:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1789\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:51:34',4,'2022-07-05 11:53:04',4,0,NULL,NULL,NULL,'477311cf-0367-47e1-9717-4732fc0752f0'),(1790,'Clients given 6D weighing 14-19.9kg','Clients given 6D weighing 14-19.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D weighing 14-19.9kg\n Clients given 6D weighing 14-19.9kg\n \n 2022-07-05 06:21:55 UTC\n \n 2022-07-05 06:23:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1790\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:51:55',4,'2022-07-05 11:53:21',4,0,NULL,NULL,NULL,'62232334-aa48-4e29-92fc-c4f931bcfb01'),(1791,'Clients given 6D weighing 20-24.9kg','Clients given 6D weighing 20-24.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D weighing 20-24.9kg\n Clients given 6D weighing 20-24.9kg\n \n 2022-07-05 06:23:43 UTC\n \n 2022-07-05 06:25:33 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1791\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:53:43',4,'2022-07-05 11:55:33',4,0,NULL,NULL,NULL,'8b171cf1-4052-49f3-9b28-76161872f1ac'),(1792,'Clients given 6D weighing 25-34.9kg','Clients given 6D weighing 25-34.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D weighing 25-34.9kg\n Clients given 6D weighing 25-34.9kg\n \n 2022-07-05 06:24:03 UTC\n \n 2022-07-05 06:25:47 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1792\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:54:03',4,'2022-07-05 11:55:47',4,0,NULL,NULL,NULL,'20d6a8c0-12ee-420c-a3f6-22d2e7a829bd'),(1793,'Clients given 6D weighing >= 35kg','Clients given 6D weighing >= 35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D weighing >= 35kg\n Clients given 6D weighing >= 35kg\n \n 2022-07-05 06:24:35 UTC\n \n 2022-07-05 06:26:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1793\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:54:35',4,'2022-07-05 11:56:11',4,0,NULL,NULL,NULL,'41d104fe-8277-4caa-b55e-07ea346801a7'),(1794,'Clients given 6E weighing 0-3.9 kg','Clients given 6E weighing 0-3.9 kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E weighing 0-3.9 kg\n Clients given 6E weighing 0-3.9 kg\n \n 2022-07-05 06:27:58 UTC\n \n 2022-07-05 06:30:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1794\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:57:58',4,'2022-07-05 12:00:43',4,0,NULL,NULL,NULL,'ddcdfef8-c5fd-4bd2-9963-4d5d48702f57'),(1795,'Clients given 6E weighing 4-5.9 kg','Clients given 6E weighing 4-5.9 kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E weighing 4-5.9 kg\n Clients given 6E weighing 4-5.9 kg\n \n 2022-07-05 06:28:17 UTC\n \n 2022-07-05 06:32:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1795\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:58:17',4,'2022-07-05 12:02:01',4,0,NULL,NULL,NULL,'52757686-f3a7-4d53-84bb-76aea347f4d3'),(1796,'Clients given 6E weighing 6-9.9 kg','Clients given 6E weighing 6-9.9 kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E weighing 6-9.9 kg\n Clients given 6E weighing 6-9.9 kg\n \n 2022-07-05 06:30:03 UTC\n \n 2022-07-05 06:31:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1796\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${endDate}\n \n \n \n','2022-07-05 12:00:03',4,'2022-07-05 12:01:15',4,0,NULL,NULL,NULL,'d0682189-7d23-4c17-9648-ae39ea0f6916'),(1797,'Clients given 6E weighing 10-13.9 kg','Clients given 6E weighing 10-13.9 kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E weighing 10-13.9 kg\n Clients given 6E weighing 10-13.9 kg\n \n 2022-07-05 06:32:34 UTC\n \n 2022-07-05 06:34:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1797\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 12:02:34',4,'2022-07-05 12:04:30',4,0,NULL,NULL,NULL,'ad8a6b3c-88dd-4328-b042-076242f1ce54'),(1798,'Clients given 6E weighing 14-19.9 kg','Clients given 6E weighing 14-19.9 kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E weighing 14-19.9 kg\n Clients given 6E weighing 14-19.9 kg\n \n 2022-07-05 06:33:01 UTC\n \n 2022-07-05 06:34:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1798\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 12:03:01',4,'2022-07-05 12:04:51',4,0,NULL,NULL,NULL,'d58c1b55-d21c-497a-b201-c1f544c8264c'),(1799,'Clients given 6E weighing 20-24.9 kg','Clients given 6E weighing 20-24.9 kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E weighing 20-24.9 kg\n Clients given 6E weighing 20-24.9 kg\n \n 2022-07-05 06:33:24 UTC\n \n 2022-07-05 06:35:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1799\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 12:03:24',4,'2022-07-05 12:05:10',4,0,NULL,NULL,NULL,'e38de12c-6c72-4188-a8b7-b6d912e7baf2'),(1800,'Clients given 6E weighing 25-34.9 kg','Clients given 6E weighing 25-34.9 kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E weighing 25-34.9 kg\n Clients given 6E weighing 25-34.9 kg\n \n 2022-07-05 06:35:31 UTC\n \n 2022-07-05 06:37:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1800\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 12:05:31',4,'2022-07-05 12:07:03',4,0,NULL,NULL,NULL,'24def27b-738c-424e-b397-689a9fc28dd0'),(1801,'Clients given 6E weighing >= 35 kg','Clients given 6E weighing >= 35 kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E weighing >= 35 kg\n Clients given 6E weighing >= 35 kg\n \n 2022-07-05 06:35:59 UTC\n \n 2022-07-05 06:37:19 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1801\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 12:05:59',4,'2022-07-05 12:07:19',4,0,NULL,NULL,NULL,'bc732e0d-7aa7-412d-855c-76442487b9c9'),(1802,'Clients given 6F weighing 4-5.9kg','Clients given 6F weighing 4-5.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F weighing 4-5.9kg\n Clients given 6F weighing 4-5.9kg\n \n 2022-07-05 06:38:03 UTC\n \n 2022-07-05 06:42:09 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1802\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 12:08:03',4,'2022-07-05 12:12:09',4,0,NULL,NULL,NULL,'31aaf13e-0c70-472d-9d6f-8d288c6545d7'),(1803,'Clients given 6F weighing 0-3.9kg','Clients given 6F weighing 0-3.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F weighing 0-3.9kg\n Clients given 6F weighing 0-3.9kg\n \n 2022-07-05 06:38:38 UTC\n \n 2022-07-05 06:43:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1803\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 12:08:38',4,'2022-07-05 12:13:27',4,0,NULL,NULL,NULL,'ec58cc67-3866-4031-a385-d5f40bf5fa80'),(1804,'Clients given 6F weighing 6-9.9kg','Clients given 6F weighing 6-9.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F weighing 6-9.9kg\n Clients given 6F weighing 6-9.9kg\n \n 2022-07-05 06:40:34 UTC\n \n 2022-07-05 06:42:24 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1804\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${endDate}\n \n \n \n','2022-07-05 12:10:34',4,'2022-07-05 12:12:24',4,0,NULL,NULL,NULL,'ece7781b-8125-44f0-8189-6f4f66258b2c'),(1805,'Clients given 6F weighing 10-13.9kg','Clients given 6F weighing 10-13.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F weighing 10-13.9kg\n Clients given 6F weighing 10-13.9kg\n \n 2022-07-05 06:44:04 UTC\n \n 2022-07-05 06:47:25 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1805\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 12:14:04',4,'2022-07-05 12:17:25',4,0,NULL,NULL,NULL,'6cd6003e-fd2a-4acd-acbf-8025ed274332'),(1806,'Clients given 6F weighing 14-19.9kg','Clients given 6F weighing 14-19.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F weighing 14-19.9kg\n Clients given 6F weighing 14-19.9kg\n \n 2022-07-05 06:44:30 UTC\n \n 2022-07-05 06:50:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1806\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 12:14:30',4,'2022-07-05 12:20:01',4,0,NULL,NULL,NULL,'c465345e-8ab1-45d7-972a-d39b87dd1ade'),(1807,'Clients given 6F weighing 20-24.9kg','Clients given 6F weighing 20-24.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F weighing 20-24.9kg\n Clients given 6F weighing 20-24.9kg\n \n 2022-07-05 06:44:51 UTC\n \n 2022-07-05 06:46:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1807\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 12:14:51',4,'2022-07-05 12:16:42',4,0,NULL,NULL,NULL,'383ecc01-a8e6-42b4-83f3-eb9c2e48386b'),(1808,'Clients given 6F weighing 25-34.9kg','Clients given 6F weighing 25-34.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F weighing 25-34.9kg\n Clients given 6F weighing 25-34.9kg\n \n 2022-07-05 06:49:35 UTC\n \n 2022-07-05 06:54:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1808\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 12:19:35',4,'2022-07-05 12:24:29',4,0,NULL,NULL,NULL,'bacab6c2-b1d6-4a10-9f0d-ffb24844bae5'),(1809,'Clients given 6F weighing >= 35kg','Clients given 6F weighing >= 35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F weighing >= 35kg\n Clients given 6F weighing >= 35kg\n \n 2022-07-05 06:53:17 UTC\n \n 2022-07-05 06:56:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1809\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 12:23:17',4,'2022-07-05 12:26:41',4,0,NULL,NULL,NULL,'2614b81d-6441-4ee3-b4a7-a15f3ba36ace'),(1810,'Children ARV Regimen_2ndLine_2022','Children ARV Regimen_2ndLine','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_2022\n Children ARV Regimen_2ndLine\n \n 2022-07-06 07:16:05 UTC\n \n 2022-07-06 10:13:16 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1810\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2022-07-06 07:16:05',4,'2022-07-06 10:13:16',4,0,NULL,NULL,NULL,'dffce2c4-7adc-497e-8216-fa138d0201b1'),(1811,'Children ARV Regimen_2ndLine Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine Data Set\n \n 2022-07-06 07:16:44 UTC\n \n 2022-07-06 10:11:25 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1811\n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n 5A0to3.9\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Age\n Children 0to14\n \n \n \n \n \n 5A10to13.9\n \n \n \n \n \n \n \n \n \n 5A14to19.9\n \n \n \n \n \n \n \n \n \n 5A20to24.9\n \n \n \n \n \n \n \n \n \n 5A25to34.9\n \n \n \n \n \n \n \n \n \n 5A35plus\n \n \n \n \n \n \n \n \n \n 5A4to5.9\n \n \n \n \n \n \n \n \n \n 5A6to9.9\n \n \n \n \n \n \n \n \n \n 5B0to3.9\n \n \n \n \n \n \n \n \n \n 5B10to13.9\n \n \n \n \n \n \n \n \n \n 5B14to19.9\n \n \n \n \n \n \n \n \n \n 5B20to24.9\n \n \n \n \n \n \n \n \n \n 5B25to34.9\n \n \n \n \n \n \n \n \n \n 5B35plus\n \n \n \n \n \n \n \n \n \n 5B4to5.9\n \n \n \n \n \n \n \n \n \n 5B6to9.9\n \n \n \n \n \n \n \n \n \n 5C0to3.9\n \n \n \n \n \n \n \n \n \n 5C10to13.9\n \n \n \n \n \n \n \n \n \n 5C14to19.9\n \n \n \n \n \n \n \n \n \n 5C20to24.9\n \n \n \n \n \n \n \n \n \n 5C25to34.9\n \n \n \n \n \n \n \n \n \n 5C35plus\n \n \n \n \n \n \n \n \n \n 5C4to5.9\n \n \n \n \n \n \n \n \n \n 5C6to9.9\n \n \n \n \n \n \n \n \n \n 5D0to3.9\n \n \n \n \n \n \n \n \n \n 5D10to13.9\n \n \n \n \n \n \n \n \n \n 5D14to19.9\n \n \n \n \n \n \n \n \n \n 5D20to24.9\n \n \n \n \n \n \n \n \n \n 5D25to34.9\n \n \n \n \n \n \n \n \n \n 5D35plus\n \n \n \n \n \n \n \n \n \n 5D4to5.9\n \n \n \n \n \n \n \n \n \n 5D6to9.9\n \n \n \n \n \n \n \n \n \n 5E0to3.9\n \n \n \n \n \n \n \n \n \n 5E10to13.9\n \n \n \n \n \n \n \n \n \n 5E14to19.9\n \n \n \n \n \n \n \n \n \n 5E20to24.9\n \n \n \n \n \n \n \n \n \n 5E25to34.9\n \n \n \n \n \n \n \n \n \n 5E35plus\n \n \n \n \n \n \n \n \n \n 5E4to5.9\n \n \n \n \n \n \n \n \n \n 5E6to9.9\n \n \n \n \n \n \n \n \n \n 5F0to3.9\n \n \n \n \n \n \n \n \n \n 5F10to13.9\n \n \n \n \n \n \n \n \n \n 5F14to19.9\n \n \n \n \n \n \n 5F20to24.9\n \n \n \n \n \n \n \n \n \n 5F25to34.9\n \n \n \n \n \n \n \n \n \n 5F35plus\n \n \n \n \n \n \n \n \n \n 5F4to5.9\n \n \n \n \n \n \n \n \n \n 5F6to9.9\n \n \n \n \n \n \n \n \n \n 5G0to3.9\n \n \n \n \n \n \n \n \n \n 5G10to13.9\n \n \n \n \n \n \n \n \n \n 5G14to19.9\n \n \n \n \n \n \n \n \n \n 5G20to24.9\n \n \n \n \n \n \n \n \n \n 5G25to34.9\n \n \n \n \n \n \n \n \n \n 5G35plus\n \n \n \n \n \n \n \n \n \n 5G4to5.9\n \n \n \n \n \n \n \n \n \n 5G6to9.9\n \n \n \n \n \n \n \n \n \n 5H0to3.9\n \n \n \n \n \n \n \n \n \n 5H10to13.9\n \n \n \n \n \n \n \n \n \n 5H14to19.9\n \n \n \n \n \n \n \n \n \n 5H20to24.9\n \n \n \n \n \n \n \n \n \n 5H25to34.9\n \n \n \n \n \n \n \n \n \n 5H35plus\n \n \n \n \n \n \n \n \n \n 5H4to5.9\n \n \n \n \n \n \n \n \n \n 5H6to9.9\n \n \n \n \n \n \n \n \n \n','2022-07-06 07:16:44',4,'2022-07-06 10:11:25',4,0,NULL,NULL,NULL,'437a2414-1894-4eb5-8c13-356a8e2aa747'),(1812,'Children ARV Regimen_3rdLine_2022','Children ARV Regimen_3rdLine','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_2022\n Children ARV Regimen_3rdLine\n \n 2022-07-06 10:16:11 UTC\n \n 2022-07-06 10:16:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1812\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2022-07-06 10:16:11',4,'2022-07-06 10:16:23',4,0,NULL,NULL,NULL,'b6b0cf68-1305-49a2-8f43-30f3f175958d'),(1813,'Children ARV Regimen_3rdLine_2022 Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_2022 Data Set\n \n 2022-07-06 10:16:23 UTC\n \n 2022-07-06 14:44:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1813\n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n 6A0to3.9\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Age\n Children 0to14\n \n \n \n \n \n 6A10to13.9\n \n \n \n \n \n \n \n \n \n 6A14to19.9\n \n \n \n \n \n \n \n \n \n 6A20to24.9\n \n \n \n \n \n \n \n \n \n 6A25to34.9\n \n \n \n \n \n \n \n \n \n 6A35plus\n \n \n \n \n \n \n \n \n \n 6A4to5.9\n \n \n \n \n \n \n \n \n \n 6A6to9.9\n \n \n \n \n \n \n \n \n \n 6B0to3.9\n \n \n \n \n \n \n \n \n \n 6B10to13.9\n \n \n \n \n \n \n \n \n \n 6B14to19.9\n \n \n \n \n \n \n \n \n \n 6B20to24.9\n \n \n \n \n \n \n \n \n \n 6B25to34.9\n \n \n \n \n \n \n \n \n \n 6B35plus\n \n \n \n \n \n \n \n \n \n 6B4to5.9\n \n \n \n \n \n \n \n \n \n 6B6to9.9\n \n \n \n \n \n \n \n \n \n 6C0to3.9\n \n \n \n \n \n \n \n \n \n 6C10to13.9\n \n \n \n \n \n \n \n \n \n 6C14to19.9\n \n \n \n \n \n \n \n \n \n 6C20to24.9\n \n \n \n \n \n \n \n \n \n 6C25to34.9\n \n \n \n \n \n \n \n \n \n 6C35plus\n \n \n \n \n \n \n \n \n \n 6C4to5.9\n \n \n \n \n \n \n \n \n \n 6C6to9.9\n \n \n \n \n \n \n \n \n \n 6D0to3.9\n \n \n \n \n \n \n \n \n \n 6D10to13.9\n \n \n \n \n \n \n \n \n \n 6D14to19.9\n \n \n \n \n \n \n \n \n \n 6D20to24.9\n \n \n \n \n \n \n \n \n \n 6D25to34.9\n \n \n \n \n \n \n \n \n \n 6D35plus\n \n \n \n \n \n \n \n \n \n 6D4to5.9\n \n \n \n \n \n \n \n \n \n 6D6to9.9\n \n \n \n \n \n \n \n \n \n 6E0to3.9\n \n \n \n \n \n \n \n \n \n 6E10to13.9\n \n \n \n \n \n \n \n \n \n 6E14to19.9\n \n \n \n \n \n \n \n \n \n 6E20to24.9\n \n \n \n \n \n \n \n \n \n 6E25to34.9\n \n \n \n \n \n \n \n \n \n 6E35plus\n \n \n \n \n \n \n \n \n \n 6E4to5.9\n \n \n \n \n \n \n \n \n \n 6E6to9.9\n \n \n \n \n \n \n \n \n \n 6F0to3.9\n \n \n \n \n \n \n \n \n \n 6F10to13.9\n \n \n \n \n \n \n \n \n \n 6F14to19.9\n \n \n \n \n \n \n \n \n \n 6F20to24.9\n \n \n \n \n \n \n \n \n \n 6F25to34.9\n \n \n \n \n \n \n \n \n \n 6F35plus\n \n \n \n \n \n \n \n \n \n 6F4to5.9\n \n \n \n \n \n \n \n \n \n 6F6to9.9\n \n \n \n \n \n \n \n \n \n','2022-07-06 10:16:23',4,'2022-07-06 14:44:30',4,0,NULL,NULL,NULL,'3fa2b422-d556-4710-bfd7-bc8a5b0c9c0b'),(1814,'TX_ML-06 Clients who are current on ART at reporting period and experienced IIT_3-5 months','TX_ML-06 Clients who are current on ART at reporting period and experienced IIT_3-5 months','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TX_ML-06 Clients who are current on ART at reporting period and experienced IIT_3-5 months\n TX_ML-06 Clients who are current on ART at reporting period and experienced IIT_3-5 months\n \n 2022-08-10 11:03:51 UTC\n \n 2024-02-15 09:03:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1814\n select obs_ml_clients.person_id \nfrom obs os \ninner join location l on os.location_id = l.location_id \ninner join \n( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND patient.voided = 0 AND o.voided = 0 \n AND o.person_id in ( \n select person_id \n from \n (select oss.person_id, MAX(oss.obs_datetime) as max_observation, SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_datetime)), 20) AS latest_follow_up \n from obs oss \n inner join person p on oss.person_id=p.person_id and oss.concept_id = 3752 and oss.voided=0 \n and oss.obs_datetime < cast(:startDate as DATE) \n group by p.person_id \n having datediff(CAST(DATE_ADD(CAST(:startDate AS DATE), INTERVAL -1 DAY) AS DATE), latest_follow_up) < 29) as On_ART_Beginning_Quarter \n ) \n AND o.person_id in ( \n select person_id \n from \n (select oss.person_id, MAX(oss.obs_datetime) as max_observation, SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_datetime)), 20) AS latest_follow_up \n from obs oss \n inner join person p on oss.person_id=p.person_id and oss.concept_id = 3752 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as DATE) \n group by p.person_id \n having datediff(CAST(:endDate AS DATE), latest_follow_up) > 28) as Missed_Greater_Than_28Days \n ) \n INNER JOIN patient_identifier ON patient_identifier.patient_id = patient.patient_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n group by patient.patient_id \n UNION \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND patient.voided = 0 AND o.voided = 0 \n AND o.concept_id = 2249 and cast(o.value_datetime as date) >= cast(:startDate as DATE) and cast(o.value_datetime as date) <= cast(:endDate as DATE) \n AND o.person_id in ( \n select person_id \n from \n (select oss.person_id, MAX(oss.obs_datetime) as max_observation, SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_datetime)), 20) AS latest_follow_up \n from obs oss \n inner join person p on oss.person_id=p.person_id and oss.concept_id = 3752 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as DATE) \n group by p.person_id \n having datediff(CAST(:endDate AS DATE), latest_follow_up) > 28) as Missed_Greater_Than_28Days \n ) \n INNER JOIN patient_identifier ON patient_identifier.patient_id = patient.patient_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n group by patient.patient_id \n) as obs_ml_clients on os.person_id = obs_ml_clients.person_id \nINNER JOIN person ON person.person_id = obs_ml_clients.person_id AND person.voided = 0 \nINNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \nWHERE os.location_id =:location or parent_location =:location \n -- INITIATED ON ART BETWEEN 3 AND 5 MONTHS AGO \n AND obs_ml_clients.person_id in ( \n select distinct os.person_id \n from obs os \n where os.concept_id = 2249 \n AND datediff(CAST(:endDate AS DATE), os.value_datetime) BETWEEN 89 AND 180 \n ) \n -- NOT Transfered Out to Another Site \n AND obs_ml_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where os.concept_id = 4155 and os.value_coded = 2146 \n AND os.obs_datetime <= CAST(:endDate AS DATE) \n ) \n -- NOT DEAD \n AND obs_ml_clients.person_id not in ( \n select person_id \n from person \n where death_date <= CAST(:endDate AS DATE) \n and dead = 1 \n ) \nAND obs_ml_clients.person_id not in ( \n -- Visitors \n select o.person_id \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as examination_timing \n from obs oss \n where oss.concept_id = 3753 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where concept_id = 5416 \n and o.value_coded =1 and o.voided=0 \n and cast(o.obs_datetime as date) = cast(max_observation as date) \n )\n','2022-08-10 16:33:51',4,'2024-02-15 14:33:32',4,0,NULL,NULL,NULL,'e2a2e29e-040a-45b1-902d-fa25074d52a1'),(1815,'CI63:TxML IIT3-5','TxML IIT3-5','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CI63:TxML IIT3-5\n TxML IIT3-5\n \n 2022-08-10 11:07:17 UTC\n \n 2022-08-10 11:08:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1815\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-08-10 11:07:17',4,'2022-08-10 11:08:59',4,0,NULL,NULL,NULL,'781f34cd-9cce-41ef-acbe-b89b0e1257e4'),(1816,'TX_RTT-02 Clients with IIT for < 3 months in previous period who restarted ARV\'s during current period','TX_RTT-02 Clients with IIT for < 3 months in previous period who restarted ARV\'s during current period','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TX_RTT-02 Clients with IIT for < 3 months in previous period who restarted ARV's during current period\n TX_RTT-02 Clients with IIT for < 3 months in previous period who restarted ARV's during current period\n \n 2022-08-23 16:34:31 UTC\n \n 2024-02-15 08:22:47 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1816\n select distinct o.person_id \nfrom obs o \n-- PATIENTS WITH NO CLINICAL CONTACT OR ARV PICK-UP FOR GREATER THAN 28 DAYS \n-- SINCE THEIR LAST EXPECTED CONTACT WHO RESTARTED ARVs WITHIN THE REPORTING PERIOD \ninner join location l on o.location_id = l.location_id \nINNER JOIN patient ON o.person_id = patient.patient_id \nAND patient.voided = 0 AND o.voided = 0 \nAND o.person_id in ( \n select person_id \n from \n (select oss.person_id, MAX(oss.obs_datetime) as max_observation, SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_datetime)), 20) AS latest_follow_up \n from obs oss \n inner join person p on oss.person_id=p.person_id and oss.concept_id = 3752 and oss.voided=0 \n and oss.obs_datetime < cast(:startDate as DATE) \n group by p.person_id \n having datediff(CAST(DATE_ADD(CAST(:startDate AS DATE), INTERVAL -1 DAY) AS DATE), latest_follow_up) BETWEEN 29 and 90) as Missed_Greater_Than_28Days \n ) \n \n -- Client Seen: As either patient OR Treatment Buddy \n AND ( \n o.person_id in ( \n select distinct os.person_id \n from obs os \n where (os.concept_id = 3843 AND os.value_coded = 3841 OR os.value_coded = 3842) \n AND os.obs_datetime BETWEEN CAST(:startDate AS DATE) AND CAST(:endDate AS DATE) \n ) \n \n -- Client Seen and Date Restarted picked \n OR o.person_id in ( \n select distinct os.person_id \n from obs os \n where os.concept_id = 3708 AND os.value_datetime BETWEEN CAST(:startDate AS DATE) AND CAST(:endDate AS DATE) \n ) \n ) \n -- Still on treatment at the end of the reporting period \n AND o.person_id in ( \n select person_id \n from \n (select oss.person_id, MAX(oss.obs_datetime) as max_observation, SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_datetime)), 20) AS latest_follow_up \n from obs oss \n inner join person p on oss.person_id=p.person_id and oss.concept_id = 3752 and oss.voided=0 \n and oss.obs_datetime >= cast(:startDate as DATE) and oss.obs_datetime <= cast(:endDate as DATE) \n group by p.person_id \n having datediff(CAST(:endDate AS DATE), latest_follow_up) <= 28) as Still_On_Treatment_End_Period \n ) \n \n -- Transfered Out to Another Site during their latest encounter before the start date \n AND o.person_id not in ( \n select person_id \n from \n (select oss.person_id, MAX(oss.obs_datetime) as max_observation, SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) AS last_obs_tout \n from obs oss \n inner join person p on oss.person_id=p.person_id and oss.concept_id = 4155 and oss.voided=0 \n and oss.obs_datetime < cast(:startDate as DATE) \n group by p.person_id \n having last_obs_tout = 2146) as Transfered_Out_In_Last_Encounter \n ) \n \n-- NOT Transfered In from another Site \n AND o.person_id not in ( \n select os.person_id \n from obs os \n where (os.concept_id = 2253 AND DATE(os.value_datetime) BETWEEN CAST(:startDate AS DATE) AND CAST(:endDate AS DATE)) \n AND os.voided = 0 \n ) \n \n AND o.person_id not in ( \n select person_id \n from person \n where death_date <= CAST(:endDate AS DATE) \n and dead = 1 \n ) \n AND o.person_id not in ( \n -- Visitors \n select o.person_id \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as examination_timing \n from obs oss \n where oss.concept_id = 3753 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where concept_id = 5416 \n and o.value_coded =1 and o.voided=0 \n and cast(o.obs_datetime as date) = cast(max_observation as date) \n) \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \nWHERE (o.location_id =:location or parent_location =:location)\n','2022-08-23 22:04:31',4,'2024-02-15 13:52:47',4,0,NULL,NULL,NULL,'505841df-fa38-436c-8463-8a437f536b69'),(1817,'TX_RTT-03 Clients with IIT for 3-5 months in previous period who restarted ARV\'s during current period','TX_RTT-03 Clients with IIT for 3-5 months in previous period who restarted ARV\'s during current period','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TX_RTT-03 Clients with IIT for 3-5 months in previous period who restarted ARV's during current period\n TX_RTT-03 Clients with IIT for 3-5 months in previous period who restarted ARV's during current period\n \n 2022-08-23 16:42:57 UTC\n \n 2024-02-15 08:26:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1817\n select distinct o.person_id \nfrom obs o \n-- PATIENTS WITH NO CLINICAL CONTACT OR ARV PICK-UP FOR GREATER THAN 28 DAYS \n-- SINCE THEIR LAST EXPECTED CONTACT WHO RESTARTED ARVs WITHIN THE REPORTING PERIOD \ninner join location l on o.location_id = l.location_id \nINNER JOIN patient ON o.person_id = patient.patient_id \nAND patient.voided = 0 AND o.voided = 0 \nAND o.person_id in ( \n select person_id \n from \n (select oss.person_id, MAX(oss.obs_datetime) as max_observation, SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_datetime)), 20) AS latest_follow_up \n from obs oss \n inner join person p on oss.person_id=p.person_id and oss.concept_id = 3752 and oss.voided=0 \n and oss.obs_datetime < cast(:startDate as DATE) \n group by p.person_id \n having datediff(CAST(DATE_ADD(CAST(:startDate AS DATE), INTERVAL -1 DAY) AS DATE), latest_follow_up) BETWEEN 89 and 180) as Missed_Between_89_and_180Days \n ) \n \n -- Client Seen: As either patient OR Treatment Buddy \n AND ( \n o.person_id in ( \n select distinct os.person_id \n from obs os \n where (os.concept_id = 3843 AND os.value_coded = 3841 OR os.value_coded = 3842) \n AND os.obs_datetime BETWEEN CAST(:startDate AS DATE) AND CAST(:endDate AS DATE) \n ) \n \n -- Client Seen and Date Restarted picked \n OR o.person_id in ( \n select distinct os.person_id \n from obs os \n where os.concept_id = 3708 AND os.value_datetime BETWEEN CAST(:startDate AS DATE) AND CAST(:endDate AS DATE) \n ) \n ) \n -- Still on treatment at the end of the reporting period \n AND o.person_id in ( \n select person_id \n from \n (select oss.person_id, MAX(oss.obs_datetime) as max_observation, SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_datetime)), 20) AS latest_follow_up \n from obs oss \n inner join person p on oss.person_id=p.person_id and oss.concept_id = 3752 and oss.voided=0 \n and oss.obs_datetime >= cast(:startDate as DATE) and oss.obs_datetime <= cast(:endDate as DATE) \n group by p.person_id \n having datediff(CAST(:endDate AS DATE), latest_follow_up) <= 28) as Still_On_Treatment_End_Period \n ) \n \n -- Transfered Out to Another Site during their latest encounter before the start date \n AND o.person_id not in ( \n select person_id \n from \n (select oss.person_id, MAX(oss.obs_datetime) as max_observation, SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) AS last_obs_tout \n from obs oss \n inner join person p on oss.person_id=p.person_id and oss.concept_id = 4155 and oss.voided=0 \n and oss.obs_datetime < cast(:startDate as DATE) \n group by p.person_id \n having last_obs_tout = 2146) as Transfered_Out_In_Last_Encounter \n ) \n \n-- NOT Transfered In from another Site \n AND o.person_id not in ( \n select os.person_id \n from obs os \n where (os.concept_id = 2253 AND DATE(os.value_datetime) BETWEEN CAST(:startDate AS DATE) AND CAST(:endDate AS DATE)) \n AND os.voided = 0 \n ) \n \n AND o.person_id not in ( \n select person_id \n from person \n where death_date <= CAST(:endDate AS DATE) \n and dead = 1 \n ) \n AND o.person_id not in ( \n -- Visitors \n select o.person_id \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as examination_timing \n from obs oss \n where oss.concept_id = 3753 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where concept_id = 5416 \n and o.value_coded =1 and o.voided=0 \n and cast(o.obs_datetime as date) = cast(max_observation as date) \n ) \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \nWHERE (o.location_id =:location or parent_location =:location)\n','2022-08-23 22:12:57',4,'2024-02-15 13:56:51',4,0,NULL,NULL,NULL,'129f5049-8d6d-4cd9-8922-7cf72b623ab3'),(1818,' TX_RTT-04 Clients with IIT for >6 months in previous period who restarted ARV\'s during current period',' TX_RTT-04 Clients with IIT for >6 months in previous period who restarted ARV\'s during current period','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TX_RTT-04 Clients with IIT for >6 months in previous period who restarted ARV's during current period\n TX_RTT-04 Clients with IIT for >6 months in previous period who restarted ARV's during current period\n \n 2022-08-23 16:45:46 UTC\n \n 2024-02-15 08:42:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n endDateAS\n \n java.util.Date\n true\n \n \n 1818\n select distinct o.person_id \nfrom obs o \n-- PATIENTS WITH NO CLINICAL CONTACT OR ARV PICK-UP FOR GREATER THAN 28 DAYS \n-- SINCE THEIR LAST EXPECTED CONTACT WHO RESTARTED ARVs WITHIN THE REPORTING PERIOD \ninner join location l on o.location_id = l.location_id \nINNER JOIN patient ON o.person_id = patient.patient_id \nAND patient.voided = 0 AND o.voided = 0 \nAND o.person_id in ( \n select person_id \n from \n (select oss.person_id, MAX(oss.obs_datetime) as max_observation, SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_datetime)), 20) AS latest_follow_up \n from obs oss \n inner join person p on oss.person_id=p.person_id and oss.concept_id = 3752 and oss.voided=0 \n and oss.obs_datetime < cast(:startDate as DATE) \n group by p.person_id \n having datediff(CAST(DATE_ADD(CAST(:startDate AS DATE), INTERVAL -1 DAY) AS DATE), latest_follow_up) >= 180) as Missed_Greater_than_180Days \n ) \n \n -- Client Seen: As either patient OR Treatment Buddy \n AND ( \n o.person_id in ( \n select distinct os.person_id \n from obs os \n where (os.concept_id = 3843 AND os.value_coded = 3841 OR os.value_coded = 3842) \n AND os.obs_datetime BETWEEN CAST(:startDate AS DATE) AND CAST(:endDate AS DATE) \n ) \n \n -- Client Seen and Date Restarted picked \n OR o.person_id in ( \n select distinct os.person_id \n from obs os \n where os.concept_id = 3708 AND os.value_datetime BETWEEN CAST(:startDate AS DATE) AND CAST(:endDate AS DATE) \n ) \n ) \n -- Still on treatment at the end of the reporting period \n AND o.person_id in ( \n select person_id \n from \n (select oss.person_id, MAX(oss.obs_datetime) as max_observation, SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_datetime)), 20) AS latest_follow_up \n from obs oss \n inner join person p on oss.person_id=p.person_id and oss.concept_id = 3752 and oss.voided=0 \n and oss.obs_datetime >= cast(:startDate as DATE) and oss.obs_datetime <= cast(:endDate as DATE) \n group by p.person_id \n having datediff(CAST(:endDate AS DATE), latest_follow_up) <= 28) as Still_On_Treatment_End_Period \n ) \n \n -- Transfered Out to Another Site during their latest encounter before the start date \n AND o.person_id not in ( \n select person_id \n from \n (select oss.person_id, MAX(oss.obs_datetime) as max_observation, SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) AS last_obs_tout \n from obs oss \n inner join person p on oss.person_id=p.person_id and oss.concept_id = 4155 and oss.voided=0 \n and oss.obs_datetime < cast(:startDate as DATE) \n group by p.person_id \n having last_obs_tout = 2146) as Transfered_Out_In_Last_Encounter \n ) \n \n-- NOT Transfered In from another Site \n AND o.person_id not in ( \n select os.person_id \n from obs os \n where (os.concept_id = 2253 AND DATE(os.value_datetime) BETWEEN CAST(:startDate AS DATE) AND CAST(:endDate AS DATE)) \n AND os.voided = 0 \n ) \n \n AND o.person_id not in ( \n select person_id \n from person \n where death_date <= CAST(:endDate AS DATE) \n and dead = 1 \n ) \n AND o.person_id not in ( \n -- Visitors \n select o.person_id \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as examination_timing \n from obs oss \n where oss.concept_id = 3753 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where concept_id = 5416 \n and o.value_coded =1 and o.voided=0 \n and cast(o.obs_datetime as date) = cast(max_observation as date) \n ) \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \nWHERE (o.location_id =:location or parent_location =:location)\n','2022-08-23 22:15:46',4,'2024-02-15 14:12:31',4,0,NULL,NULL,NULL,'afc2a5d5-53e4-427a-9491-b3b1609bbe69'),(1819,'CI64:TxRTT IIT<3months','CI64:TxRTT IIT<3months','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CI64:TxRTT IIT<3months\n CI64:TxRTT IIT<3months\n \n 2022-08-24 07:46:14 UTC\n \n 2022-08-24 07:47:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1819\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-08-24 07:46:14',4,'2022-08-24 07:47:14',4,0,NULL,NULL,NULL,'6c4e2daf-e83f-4899-98f5-203f33ee4827'),(1820,'CI65:TxRTT IIT_3-5months','CI65:TxRTT IIT_3-5months','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CI65:TxRTT IIT_3-5months\n CI65:TxRTT IIT_3-5months\n \n 2022-08-24 07:47:56 UTC\n \n 2022-08-24 07:48:48 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1820\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-08-24 07:47:56',4,'2022-08-24 07:48:48',4,0,NULL,NULL,NULL,'714af509-9ade-48b5-b6f0-10d7499a6f15'),(1821,'CI66:TxRTT IIT_6+months','CI66:TxRTT IIT_6+months','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CI66:TxRTT IIT_6+months\n CI66:TxRTT IIT_6+months\n \n 2022-08-24 07:49:18 UTC\n \n 2022-08-24 07:49:56 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1821\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-08-24 07:49:18',4,'2022-08-24 07:49:56',4,0,NULL,NULL,NULL,'271261f4-75c6-4c64-a6f0-7be2d40c33c3'),(1822,'Pulmonary Bacteriologically Confirmed New','New Pulmonary Bacteriologically Confirmed clients','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Pulmonary Bacteriologically Confirmed New\n New Pulmonary Bacteriologically Confirmed clients\n \n 2023-03-27 10:50:04 UTC\n \n 2023-03-29 16:41:33 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1822\n select distinct o.person_id \n \n from obs o \ninner join location l on o.location_id = l.location_id \n \n -- Relapsed TB Client \nWHERE (o.location_id =:location or parent_location =:location) \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n -- TB Start Date \n where ob.concept_id = 2237 \n and ob.value_datetime >= :startDate \n and ob.value_datetime <= :endDate \n and ob.voided = 0 \n ) \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- New Clients \n select distinct person_id \n from obs \n where concept_id = 3785 and value_coded = 1034 \n and obs_datetime >= :startDate \n and obs_datetime <= :endDate \n ) \n ) \n \n \n AND o.person_id not in ( \n select distinct os.person_id \n from obs os \n -- Patient must not be a tranfer in \n where os.concept_id = 3772 and os.value_coded =2095 \n AND (os.obs_datetime BETWEEN :startDate AND :endDate) \n AND os.voided = 0 \n )\n','2023-03-27 12:50:04',4,'2023-03-29 18:41:33',4,0,NULL,NULL,NULL,'5ab3fc4d-0d1e-4a30-b0c7-d35c68f7f19a'),(1823,'NewRelapse_Tb_Treatment_History','Tb Treatment History - New and Relapse Patients','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n NewRelapse_Tb_Treatment_History\n Tb Treatment History - New and Relapse Patients\n \n 2023-03-27 11:51:48 UTC\n \n 2023-03-27 20:29:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1823\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in( \nSELECT Id \nFROM \n((SELECT distinct Id, patientIdentifier AS "Patient_Identifier", patientName AS "Patient_Name", Age , Gender, age_group, 'New Patient' AS 'TB_Treatment_History' \n FROM \n \n (select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n person.gender AS Gender, \n observed_age_group.name AS age_group, \n observed_age_group.sort_order AS sort_order \n \n from obs o \n -- New TB Patient \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n -- TB Start Date \n where ob.concept_id = 2237 \n and ob.value_datetime >= CAST(:startDate AS DATE) \n and ob.value_datetime <= CAST(:endDate AS DATE) \n and ob.voided = 0 \n ) \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- New Clients \n select distinct person_id \n from obs \n where concept_id = 3785 and value_coded = 1034 \n and obs_datetime >= CAST(:startDate AS DATE) \n and obs_datetime <= CAST(:endDate AS DATE) \n ) \n ) \n \n \n AND o.person_id not in ( \n select distinct os.person_id \n from obs os \n -- Patient must not be a tranfer in \n where os.concept_id = 3772 and os.value_coded =2095 \n AND (os.obs_datetime BETWEEN CAST(:startDate AS DATE) AND CAST(:endDate AS DATE)) \n AND patient.voided = 0 AND os.voided = 0 \n ) \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages') AS NEW_TB_CLIENTS \n ORDER BY NEW_TB_CLIENTS.Age) \n \n \n UNION \n \n (SELECT distinct Id, patientIdentifier AS "Patient_Identifier", patientName AS "Patient_Name", Age , Gender, age_group, 'Relapsed Patient' AS 'TB_Treatment_History' \n FROM \n (select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n person.gender AS Gender, \n observed_age_group.name AS age_group, \n observed_age_group.sort_order AS sort_order \n \n from obs o \n -- Relapsed TB Client \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n -- TB Start Date \n where ob.concept_id = 2237 \n and ob.value_datetime >= CAST(:startDate AS DATE) \n and ob.value_datetime <= CAST(:endDate AS DATE) \n ) \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- Relapsed Clients \n select distinct person_id \n from obs \n where concept_id = 3785 and value_coded = 1084 \n and ob.value_datetime >= CAST(:startDate AS DATE) \n and ob.value_datetime <= CAST(:endDate AS DATE) \n ) \n ) \n \n \n \n AND o.person_id not in ( \n select distinct os.person_id \n from obs os \n -- Client must not be a transfer in \n where os.concept_id = 3772 and os.value_coded =2095 \n AND os.obs_datetime >= CAST(:startDate AS DATE) \n and os.obs_datetime <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND os.voided = 0 \n ) \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages') AS RELAPSE_TB_CLIENTS \n ORDER BY RELAPSE_TB_CLIENTS.Age) \n) AS NewRelapsed)\n','2023-03-27 17:21:48',4,'2023-03-28 01:59:53',4,0,NULL,NULL,NULL,'7f8a23bd-eec0-40a6-8181-cda3d0aab0bd'),(1824,'Pulmonary Bacteriologically Confirmed Relapse','Pulmonary Bacteriologically Confirmed Relapse','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Pulmonary Bacteriologically Confirmed Relapse\n Pulmonary Bacteriologically Confirmed Relapse\n \n 2023-03-27 12:10:01 UTC\n \n 2023-03-29 16:45:37 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1824\n select o.person_id \n from obs o \ninner join location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \nWHERE (o.location_id =:location or parent_location =:location) \nAND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n -- TB Start Date \n where ob.concept_id = 2237 \n and ob.value_datetime >= :startDate \n and ob.value_datetime <= :endDate \n ) \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- Relapsed Clients \n select distinct person_id \n from obs \n where concept_id = 3785 and value_coded = 1084 \n and ob.value_datetime >= :startDate \n and ob.value_datetime <= :endDate \n ) \n ) \n \n \n \n AND o.person_id not in ( \n select distinct os.person_id \n from obs os \n -- Client must not be a transfer in \n where os.concept_id = 3772 and os.value_coded =2095 \n AND os.obs_datetime >= :startDate \n and os.obs_datetime <= :endDate \n AND patient.voided = 0 AND os.voided = 0 \n )\n','2023-03-27 14:10:01',4,'2023-03-29 18:45:37',4,0,NULL,NULL,NULL,'e495a330-c538-4fa2-9279-e0c03ec69b51'),(1825,'Pulmonary Bacteriologically Confirmed Excluding Relapse','Pulmonary Bacteriologically Confirmed Excluding Relapse','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Pulmonary Bacteriologically Confirmed Excluding Relapse\n Pulmonary Bacteriologically Confirmed Excluding Relapse\n \n 2023-03-27 17:01:52 UTC\n \n 2023-03-29 16:38:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1825\n select distinct o.person_id \n from obs o \ninner join location l on o.location_id = l.location_id \n \n -- Relapsed TB Client \nWHERE (o.location_id =:location or parent_location =:location) \n AND o.concept_id = 3785 and o.value_coded in (3786,1037) \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n -- TB Start Date \n where ob.concept_id = 2237 \n and ob.value_datetime >= :startDate \n and ob.value_datetime <= :endDate \n ) \n \n AND o.person_id not in ( \n select distinct os.person_id \n from obs os \n -- Client must not be a transfer in \n where os.concept_id = 3772 and os.value_coded = 3786 \n AND os.obs_datetime >= :startDate \n and os.obs_datetime <= :endDate \n AND os.voided = 0) \n\n','2023-03-27 19:01:52',4,'2023-03-29 18:38:41',4,0,NULL,NULL,NULL,'23ba6606-91b7-4f7c-9142-73d6a43769a3'),(1826,'New and Relapse with document HIV Status','New and Relapse patients with document HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n New and Relapse with document HIV Status\n New and Relapse patients with document HIV Status\n \n 2023-03-27 19:38:11 UTC\n \n 2023-03-27 21:21:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1826\n SELECT DISTINCT o.person_id \n from obs o \n -- New and Relapse with Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3785 and ob.value_coded in (1034, 1084) -- New and Relapse \n and ob.voided = 0 \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE)\n','2023-03-28 01:08:11',4,'2023-03-28 02:51:39',4,0,NULL,NULL,NULL,'ee4e2170-5dd7-423e-bc84-f0c13c3a9b4f'),(1827,'Retreatment with documented HIV status','Retreatment Excl. Relapse client with documented HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Retreatment with documented HIV status\n Retreatment Excl. Relapse client with documented HIV Status\n \n 2023-03-27 19:50:19 UTC\n \n 2023-03-27 19:53:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1827\n SELECT DISTINCT o.person_id \n from obs o \n -- New and Relapse with Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3785 and ob.value_coded in (3786, 1037) -- Retreatmentafter LTFU/Failure \n and ob.voided = 0 \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 01:20:19',4,'2023-03-28 01:23:28',4,0,NULL,NULL,NULL,'17edcc8f-3d38-49dd-a6f4-a5384cdb7245'),(1828,'Children < 15 with Documented HIV Status','Children (0 - 14) with documented HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children < 15 with Documented HIV Status\n Children (0 - 14) with documented HIV Status\n \n 2023-03-27 20:10:47 UTC\n \n 2023-03-27 20:11:20 UTC\n \n \n endDate\n \n java.util.Date\n true\n \n \n startDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1828\n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Documented HIV, Status \n inner join location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 \n AND o.voided = 0 \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n having Age < 15\n','2023-03-28 01:40:47',4,'2023-03-28 01:41:20',4,0,NULL,NULL,NULL,'ca5b1d37-8229-474d-8125-2486520685fd'),(1829,'Pulmonary Clinically Diagnosed New','Pulmonary Clinically Diagnosed New','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Pulmonary Clinically Diagnosed New\n Pulmonary Clinically Diagnosed New\n \n 2023-03-27 20:39:34 UTC\n \n 2023-03-28 08:18:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1829\n select distinct o.person_id \n FROM obs o \ninner join location l on o.location_id = l.location_id \n -- Clinical Diagnosis X-Ray \n and o.concept_id = 4673 and o.value_coded = 4171 \nAND o.person_id in ( \nselect o.person_id from obs o \nwhere o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n -- TB Start Date \n where ob.concept_id = 2237 \n and ob.value_datetime >= :startDate \n and ob.value_datetime <= :endDate \n and ob.voided = 0 \n ) \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- New Clients \n select distinct person_id \n from obs \n where concept_id = 3785 and value_coded = 1034 \n and obs_datetime >= :startDate \n and obs_datetime <= :endDate \n ) \n ) \n \n \n AND o.person_id not in ( \n select distinct os.person_id \n from obs os \n -- Patient must not be a tranfer in \n where os.concept_id = 3772 and os.value_coded =2095 \n AND (os.obs_datetime BETWEEN :startDate AND :endDate) \n and os.voided = 0 \n ) \n \n) \n and o.obs_datetime >= :startDate \n and o.obs_datetime <= :endDate \n and o.voided = 0 \n and o.person_id in ( \n select ob.person_id \n FROM obs ob \n -- Pulmonary TB \n where ob.concept_id = 3788 and ob.value_coded = 1018 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.voided = 0 \n ) \n or o.person_id in ( \n select ob.person_id \n FROM obs ob \n -- Pulmonary TB, Clinically Diagnosed \n where ob.concept_id = 2236 and ob.value_coded = 2235 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.voided = 0 \n )\n','2023-03-28 02:09:34',4,'2023-03-28 13:48:26',4,0,NULL,NULL,NULL,'34bcf70d-0178-4dcc-ab38-9046e4bcedd1'),(1830,'Miners with Documented HIV Status','High risk population of miners with documented HIV','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Miners with Documented HIV Status\n High risk population of miners with documented HIV\n \n 2023-03-27 20:45:17 UTC\n \n 2023-03-27 20:46:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1830\n select distinct o.person_id \n from obs o \n -- Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded = 3667 -- Population (Miner) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 02:15:17',4,'2023-03-28 02:16:08',4,0,NULL,NULL,NULL,'001d7c51-fa6b-45d5-9690-cc6dce14a608'),(1831,'Ex-Miners with Documented HIV Status','High risk population of Ex Miners with Documented HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Ex-Miners with Documented HIV Status\n High risk population of Ex Miners with Documented HIV Status\n \n 2023-03-27 20:47:57 UTC\n \n 2023-03-28 09:17:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1831\n select distinct o.person_id \n from obs o \n -- Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded = 3668 -- Population (Ex-Miner) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 02:17:57',4,'2023-03-28 14:47:41',4,0,NULL,NULL,NULL,'10248e4b-2f29-447e-814a-6d5b10398656'),(1832,'Factory Workers with Documented HIV Status','High risk population of Factory Workers with Documented HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Factory Workers with Documented HIV Status\n High risk population of Factory Workers with Documented HIV Status\n \n 2023-03-27 20:54:48 UTC\n \n 2023-03-27 20:55:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1832\n select distinct o.person_id \n from obs o \n -- Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded = 3669 -- Population (Factory Workers) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 02:24:48',4,'2023-03-28 02:25:05',4,0,NULL,NULL,NULL,'bb934645-58c2-4c19-bbd7-0ebf35fa3f7a'),(1833,'Public transport operators with Documented HIV Status','High risk population of Public transport operators with Documented HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Public transport operators with Documented HIV Status\n High risk population of Public transport operators with Documented HIV Status\n \n 2023-03-27 20:58:19 UTC\n \n 2023-03-28 20:14:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1833\n select distinct o.person_id \n from obs o \n -- Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded = 4654 -- Population (Public transport operators) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 02:28:19',4,'2023-03-29 01:44:32',4,0,NULL,NULL,NULL,'0c91b258-01ae-4928-be76-91201cadad93'),(1834,'Health workers with Documented HIV Status','High risk population of Health workers with Documented HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Health workers with Documented HIV Status\n High risk population of Health workers with Documented HIV Status\n \n 2023-03-27 21:04:15 UTC\n \n 2023-03-27 21:04:38 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1834\n select distinct o.person_id \n from obs o \n -- Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded = 4670 -- Population (Health workers) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 02:34:15',4,'2023-03-28 02:34:38',4,0,NULL,NULL,NULL,'7736630e-9da2-4ec0-b131-fe9e2ef01e00'),(1835,'Correctional Staff and inmates with Documented HIV Status','High risk population of Correctional Staff and inmates with Documented HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Correctional Staff and inmates with Documented HIV Status\n High risk population of Correctional Staff and inmates with Documented HIV Status\n \n 2023-03-27 21:06:32 UTC\n \n 2023-03-27 21:10:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1835\n select distinct o.person_id \n from obs o \n -- Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded in (3779, 3671) -- Population (Correctional Staff and inmates) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 02:36:32',4,'2023-03-28 02:40:03',4,0,NULL,NULL,NULL,'58ac8a09-0a12-4ab0-acb4-1fe8d1d81b77'),(1836,'RetreatmentExRelapse_Tb_Treatment_History','Retreatment Exclusive Relapse Tb Treatment History','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n RetreatmentExRelapse_Tb_Treatment_History\n Retreatment Exclusive Relapse Tb Treatment History\n \n 2023-03-27 21:07:51 UTC\n \n 2023-03-27 21:12:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1836\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(SELECT Id \nFROM \n((SELECT distinct Id, patientIdentifier AS "Patient_Identifier", patientName AS "Patient_Name" \n FROM \n \n (select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n person.gender AS Gender, \n observed_age_group.name AS age_group, \n observed_age_group.sort_order AS sort_order \n \n from obs o \n -- TB Retreatment Exclusive Relapse \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- TB Retreatment Exclusive Relapse \n select distinct person_id \n from obs \n where concept_id = 3785 and value_coded in (3786,1037) \n and obs_datetime >= CAST(:startDate AS DATE) \n and obs_datetime <= CAST(:endDate AS DATE) \n ) \n ) \n \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages') AS NEW_TB_CLIENTS \n ORDER BY NEW_TB_CLIENTS.Age) \n \n) AS RetreatmentExRelapse)\n','2023-03-28 02:37:51',4,'2023-03-28 02:42:07',4,0,NULL,NULL,NULL,'7263505b-34d2-4167-9d3f-4cdae66218f8'),(1837,'NewRelapse_Tb_Treatment_History','NewRelapse_Tb_Treatment_History','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n NewRelapse_Tb_Treatment_History\n NewRelapse_Tb_Treatment_History\n \n 2023-03-27 21:17:20 UTC\n \n 2023-03-27 21:20:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1837\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-28 02:47:20',4,'2023-03-28 02:50:31',4,0,NULL,NULL,NULL,'20879b46-ecbd-4ff9-818a-3c761bcf5ebd'),(1838,'New and Relapse with Positive HIV Status','New and Relapse with Positive HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n New and Relapse with Positive HIV Status\n New and Relapse with Positive HIV Status\n \n 2023-03-27 21:20:17 UTC\n \n 2023-03-29 20:36:19 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1838\n SELECT DISTINCT o.person_id \n from obs o \n -- New and Relapse with Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3785 and ob.value_coded in (1034, 1084) -- New/Relapse with HIV Status \n and ob.voided = 0 \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-27 23:20:17',4,'2023-03-29 22:36:19',4,0,NULL,NULL,NULL,'02c505a1-b724-422b-8c31-69440e233a0d'),(1839,'RetreatmentExRelapse_Tb_Treatment_History','Retreatment Exclusive Relapse - Tb Treatment History','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n RetreatmentExRelapse_Tb_Treatment_History\n Retreatment Exclusive Relapse - Tb Treatment History\n \n 2023-03-27 21:25:15 UTC\n \n 2023-03-27 21:26:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1839\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-28 02:55:15',4,'2023-03-28 02:56:10',4,0,NULL,NULL,NULL,'f901b38b-95e7-4bcc-ace1-ce86030ba88e'),(1840,'TB Notification - Block 2','TB Notification - Block 2','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Notification - Block 2\n TB Notification - Block 2\n \n 2023-03-27 21:45:01 UTC\n \n 2023-03-27 21:45:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1840\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-03-28 03:15:01',4,'2023-03-28 03:15:21',4,0,NULL,NULL,NULL,'8ab1160e-aca4-4d59-bd02-0269e8a3889a'),(1841,'TB Notification - Block 2 Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Notification - Block 2 Data Set\n \n 2023-03-27 21:45:21 UTC\n \n 2024-02-29 14:25:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1841\n \n \n DM_Sex\n \n \n \n \n \n \n DM_TB_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n NwRlpsF1-4\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_TB_Age\n 01-04yrs\n \n \n \n \n \n NwRlpsF5-9\n \n \n \n \n DM_Sex\n Females\n \n \n DM_TB_Age\n 05-09yrs\n \n \n \n \n \n NwRlpsM1-4\n \n \n \n \n DM_Sex\n Males\n \n \n DM_TB_Age\n 01-04yrs\n \n \n \n \n \n NwRlpsM5-9\n \n \n \n \n DM_Sex\n Males\n \n \n DM_TB_Age\n 05-09yrs\n \n \n \n \n \n NwRlpseF<1\n \n \n \n \n DM_Sex\n Females\n \n \n DM_TB_Age\n Under1yr\n \n \n \n \n \n NwRlpseM<1\n \n \n \n \n DM_Sex\n Males\n \n \n DM_TB_Age\n Under1yr\n \n \n \n \n \n NwRsF10-14\n \n \n \n \n DM_Sex\n Females\n \n \n DM_TB_Age\n 10-14yrs\n \n \n \n \n \n NwRsF15-19\n \n \n \n \n DM_Sex\n Females\n \n \n DM_TB_Age\n 15-19yrs\n \n \n \n \n \n NwRsF20-24\n \n \n \n \n DM_Sex\n Females\n \n \n DM_TB_Age\n 20-24yrs\n \n \n \n \n \n NwRsF25-34\n \n \n \n \n DM_Sex\n Females\n \n \n DM_TB_Age\n 25-34yrs\n \n \n \n \n \n NwRsF35-44\n \n \n \n \n DM_Sex\n Females\n \n \n DM_TB_Age\n 35-44yrs\n \n \n \n \n \n NwRsF45-49\n \n \n \n \n DM_Sex\n Females\n \n \n DM_TB_Age\n 45-49yrs\n \n \n \n \n \n NwRsF50-64\n \n \n \n \n DM_Sex\n Females\n \n \n DM_TB_Age\n 50-64yrs\n \n \n \n \n \n NwRsF65+\n \n \n \n \n DM_Sex\n Females\n \n \n DM_TB_Age\n 65Plus\n \n \n \n \n \n NwRsM10-14\n \n \n \n \n DM_Sex\n Males\n \n \n DM_TB_Age\n 10-14yrs\n \n \n \n \n \n NwRsM15-19\n \n \n \n \n DM_Sex\n Males\n \n \n DM_TB_Age\n 15-19yrs\n \n \n \n \n \n NwRsM20-24\n \n \n \n \n DM_Sex\n Males\n \n \n DM_TB_Age\n 20-24yrs\n \n \n \n \n \n NwRsM25-34\n \n \n \n \n DM_Sex\n Males\n \n \n DM_TB_Age\n 25-34yrs\n \n \n \n \n \n NwRsM35-44\n \n \n \n \n DM_Sex\n Males\n \n \n DM_TB_Age\n 35-44yrs\n \n \n \n \n \n NwRsM45-49\n \n \n \n \n DM_Sex\n Males\n \n \n DM_TB_Age\n 45-49yrs\n \n \n \n \n \n NwRsM50-64\n \n \n \n \n DM_Sex\n Males\n \n \n DM_TB_Age\n 50-64yrs\n \n \n \n \n \n NwRsM65+\n \n \n \n \n DM_Sex\n Males\n \n \n DM_TB_Age\n 65Plus\n \n \n \n \n \n RetreatF<1\n \n \n \n \n \n \n \n \n \n RetreatM<1\n \n \n \n \n \n \n RetrtF1-4\n \n \n \n \n \n \n RetrtF5-9\n \n \n \n \n \n \n RetrtM1-4\n \n \n \n \n \n \n RetrtM5-9\n \n \n \n \n \n \n RtrtF10-14\n \n \n \n \n \n \n RtrtF15-19\n \n \n \n \n \n \n RtrtF20-24\n \n \n \n \n \n \n RtrtF25-34\n \n \n \n \n \n \n RtrtF35-44\n \n \n \n \n \n \n RtrtF45-49\n \n \n \n \n \n \n RtrtF50-64\n \n \n \n \n \n \n RtrtF65+\n \n \n \n \n \n \n RtrtM10-14\n \n \n \n \n \n \n RtrtM15-19\n \n \n \n \n \n \n RtrtM20-24\n \n \n \n \n \n \n RtrtM25-34\n \n \n \n \n \n \n RtrtM35-44\n \n \n \n \n \n \n RtrtM45-49\n \n \n \n \n \n \n RtrtM50-64\n \n \n \n \n \n \n RtrtM65+\n \n \n \n \n \n \n','2023-03-28 03:15:21',4,'2024-02-29 19:55:50',4,0,NULL,NULL,NULL,'68f0aaca-a6a0-4cb5-aebb-e57d5ce5b2cd'),(1844,'Retreatment with Positive HIV status','Retreatment Excl. Relapse with Positive HIV status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Retreatment with Positive HIV status\n Retreatment Excl. Relapse with Positive HIV status\n \n 2023-03-28 08:28:56 UTC\n \n 2023-03-28 08:30:38 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1844\n SELECT DISTINCT o.person_id \n from obs o \n -- New and Relapse with Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3785 and ob.value_coded in (3786, 1037) -- Retreatmentafter LTFU/Failure with HIV Status \n and ob.voided = 0 \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 13:58:56',4,'2023-03-28 14:00:38',4,0,NULL,NULL,NULL,'d48e3545-1e4d-4d7a-a812-5fb7111cbf72'),(1845,'Pulmonary Clinically Diagnosed Relapse','Pulmonary Clinically Diagnosed Relapse','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Pulmonary Clinically Diagnosed Relapse\n Pulmonary Clinically Diagnosed Relapse\n \n 2023-03-28 08:30:26 UTC\n \n 2023-03-28 09:14:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1845\n select distinct o.person_id \n FROM obs o \n \n where o.concept_id = 4673 and o.value_coded = 4171 \n and o.obs_datetime >= :startDate \n and o.obs_datetime <= :endDate \n and o.person_id in ( \n select distinct o.person_id \n from obs o \n -- Relapsed TB Client \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n -- TB Start Date \n where ob.concept_id = 2237 \n and ob.value_datetime >= :startDate \n and ob.value_datetime <= :endDate \n ) \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- Relapsed Clients \n select distinct person_id \n from obs \n where concept_id = 3785 and value_coded = 1084 \n and ob.value_datetime >= :startDate \n and ob.value_datetime <= :endDate \n ) \n ) \n \n \n \n AND o.person_id not in ( \n select distinct os.person_id \n from obs os \n -- Client must not be a transfer in \n where os.concept_id = 3772 and os.value_coded =2095 \n AND os.obs_datetime >= :startDate \n and os.obs_datetime <= :endDate \n and os.voided = 0 \n ) \n ) \n \n and o.voided = 0 \n and o.person_id in ( \n select ob.person_id \n FROM obs ob \n -- Pulmonary TB \n where ob.concept_id = 3788 and ob.value_coded = 1018 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.voided = 0 \n ) \n or o.person_id in ( \n select ob.person_id \n FROM obs ob \n -- Pulmonary TB, Clinically Diagnosed \n where ob.concept_id = 2236 and ob.value_coded = 2235 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.voided = 0 \n ) \n \n \n','2023-03-28 14:00:26',4,'2023-03-28 14:44:26',4,0,NULL,NULL,NULL,'5d45f128-1037-42d6-939d-3ae6929bfd6c'),(1846,'DM_TB_Age','DM_TB_Age','org.openmrs.module.reporting.indicator.dimension.Dimension','org.openmrs.module.reporting.indicator.dimension.CohortDefinitionDimension','org.openmrs.module.reporting.serializer.ReportingSerializer','\n DM_TB_Age\n DM_TB_Age\n \n 2023-03-28 08:34:09 UTC\n \n 2024-02-29 14:04:18 UTC\n \n \n endDate\n \n java.util.Date\n true\n \n \n 1846\n \n \n 01-04yrs\n \n \n \n \n maxAge\n 4\n \n \n minAge\n 1\n \n \n effectiveDate\n ${endDate}\n \n \n \n \n \n 05-09yrs\n \n \n \n \n maxAge\n 9\n \n \n minAge\n 5\n \n \n effectiveDate\n ${endDate}\n \n \n \n \n \n 10-14yrs\n \n \n \n \n maxAge\n 14\n \n \n minAge\n 10\n \n \n effectiveDate\n ${endDate}\n \n \n \n \n \n 15-19yrs\n \n \n \n \n maxAge\n 19\n \n \n minAge\n 15\n \n \n effectiveDate\n ${endDate}\n \n \n \n \n \n 20-24yrs\n \n \n \n \n maxAge\n 24\n \n \n minAge\n 20\n \n \n effectiveDate\n ${endDate}\n \n \n \n \n \n 25-34yrs\n \n \n \n \n maxAge\n 34\n \n \n minAge\n 25\n \n \n effectiveDate\n ${endDate}\n \n \n \n \n \n 35-44yrs\n \n \n \n \n maxAge\n 44\n \n \n minAge\n 35\n \n \n effectiveDate\n ${endDate}\n \n \n \n \n \n 45-49yrs\n \n \n \n \n maxAge\n 49\n \n \n minAge\n 45\n \n \n effectiveDate\n ${endDate}\n \n \n \n \n \n 50-64yrs\n \n \n \n \n maxAge\n 64\n \n \n minAge\n 50\n \n \n effectiveDate\n ${endDate}\n \n \n \n \n \n 65Plus\n \n \n \n \n maxAge\n 120\n \n \n minAge\n 65\n \n \n effectiveDate\n ${endDate}\n \n \n \n \n \n Under1yr\n \n \n \n \n maxAge\n 0\n \n \n minAge\n 0\n \n \n effectiveDate\n ${endDate}\n \n \n \n \n \n','2023-03-28 14:04:09',4,'2024-02-29 19:34:18',4,0,NULL,NULL,NULL,'68d03856-4b9b-4d8d-ba8f-bc698222c9f2'),(1847,'Children < 15 with Positive HIV Status','High risk population for Children < 15 with Positive HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children < 15 with Positive HIV Status\n High risk population for Children < 15 with Positive HIV Status\n \n 2023-03-28 08:43:51 UTC\n \n 2023-03-28 08:54:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1847\n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- HIV PositiveStatus \n inner join location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n having Age < 15\n','2023-03-28 14:13:51',4,'2023-03-28 14:24:04',4,0,NULL,NULL,NULL,'63b6abab-6261-4d20-9601-74454ea10cd6'),(1848,'Miners with Positive HIV Status','High risk population of miners with Positive HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Miners with Positive HIV Status\n High risk population of miners with Positive HIV Status\n \n 2023-03-28 08:58:19 UTC\n \n 2023-03-28 09:01:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1848\n select distinct o.person_id \n from obs o \n -- Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded = 3667 -- Population (Miner) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 14:28:19',4,'2023-03-28 14:31:36',4,0,NULL,NULL,NULL,'d4d85343-09fc-473b-a650-50f444deee3e'),(1849,'Ex-Miners with Positive HIV Status',' High risk population of Ex Miners with Positive HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Ex-Miners with Positive HIV Status\n High risk population of Ex Miners with Positive HIV Status\n \n 2023-03-28 09:10:47 UTC\n \n 2023-03-28 09:17:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1849\n select distinct o.person_id \n from obs o \n -- Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded = 3668 -- Population (Ex-Miner) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 14:40:47',4,'2023-03-28 14:47:26',4,0,NULL,NULL,NULL,'33fa2a02-6cb8-4850-8d80-18d86f0516a8'),(1850,'Pulmonary Clinically Diagnosed Excluding Relapse','Pulmonary Clinically Diagnosed Excluding Relapse','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Pulmonary Clinically Diagnosed Excluding Relapse\n Pulmonary Clinically Diagnosed Excluding Relapse\n \n 2023-03-28 09:16:40 UTC\n \n 2023-03-28 09:55:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1850\n select distinct o.person_id \n FROM obs o \n \n where o.obs_datetime >= :startDate \n and o.obs_datetime <= :endDate \n AND o.concept_id = 3785 and o.value_coded in (3786,1037) \n and o.voided = 0 \n and o.person_id in ( \n select ob.person_id \n FROM obs ob \n -- Pulmonary TB \n where ob.concept_id = 3788 and ob.value_coded = 1018 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.voided = 0 \n ) \n or o.person_id in ( \n select ob.person_id \n FROM obs ob \n -- Pulmonary TB, Clinically Diagnosed \n where ob.concept_id = 2236 and ob.value_coded = 2235 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.voided = 0 \n ) \n \n \n','2023-03-28 14:46:40',4,'2023-03-28 15:25:11',4,0,NULL,NULL,NULL,'8a1f3d92-c5ec-4892-920b-5bae45020424'),(1851,'Factory Workers with Positive HIV Status','High risk population of Factory Workers with Positive HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Factory Workers with Positive HIV Status\n High risk population of Factory Workers with Positive HIV Status\n \n 2023-03-28 09:22:07 UTC\n \n 2023-03-28 09:23:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1851\n select distinct o.person_id \n from obs o \n -- Positive HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded = 3669 -- Population (Factory Workers) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 14:52:07',4,'2023-03-28 14:53:45',4,0,NULL,NULL,NULL,'e7f0599c-bb8c-4d2d-94a7-4b99e0f1f7af'),(1852,'Public transport with Positive HIV Status','High risk population of Public transport operators with Positive HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Public transport with Positive HIV Status\n High risk population of Public transport operators with Positive HIV Status\n \n 2023-03-28 09:26:12 UTC\n \n 2023-03-28 09:28:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1852\n select distinct o.person_id \n from obs o \n -- Positive HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded = 4654 -- Population (Public transport operators) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 14:56:12',4,'2023-03-28 14:58:18',4,0,NULL,NULL,NULL,'17f9486c-aefe-4a21-b3ad-d5c685280640'),(1853,'Health workers with Positive HIV Status',' High risk population of Health workers with Positive HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Health workers with Positive HIV Status\n High risk population of Health workers with Positive HIV Status\n \n 2023-03-28 09:31:54 UTC\n \n 2023-03-28 09:32:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1853\n select distinct o.person_id \n from obs o \n -- Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded = 4670 -- Population (Health workers) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 15:01:54',4,'2023-03-28 15:02:36',4,0,NULL,NULL,NULL,'e071852e-15c9-4eb6-92a9-c1c8157db41d'),(1854,'Correctional Staff and inmates with Positive HIV Status','High risk population of Correctional Staff and inmates with Positive HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Correctional Staff and inmates with Positive HIV Status\n High risk population of Correctional Staff and inmates with Positive HIV Status\n \n 2023-03-28 09:35:03 UTC\n \n 2023-03-28 09:35:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1854\n select distinct o.person_id \n from obs o \n -- Positive HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded in (3779, 3671) -- Population (Correctional Staff and inmates) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 15:05:03',4,'2023-03-28 15:05:43',4,0,NULL,NULL,NULL,'d6df7665-4e94-4ae6-886e-c1fb05a4a0b1'),(1855,'Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - New','Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - New','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - New\n Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - New\n \n 2023-03-28 10:05:40 UTC\n \n 2023-03-29 16:14:16 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1855\n select distinct ob.person_id \n FROM obs ob \ninner join location l on ob.location_id = l.location_id \n \n where ob.concept_id = 3788 and ob.value_coded = 2233 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.person_id in \n ( \n select distinct o.person_id \n \n from obs o \n -- New TB Patient \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n -- TB Start Date \n where ob.concept_id = 2237 \n and ob.value_datetime >= :startDate \n and ob.value_datetime <= :endDate \n and ob.voided = 0 \n ) \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- New Clients \n select distinct person_id \n from obs \n where concept_id = 3785 and value_coded = 1034 \n and obs_datetime >= :startDate \n and obs_datetime <= :endDate \n ) \n ) \n \n \n AND o.person_id not in ( \n select distinct os.person_id \n from obs os \n -- Patient must not be a tranfer in \n where os.concept_id = 3772 and os.value_coded =2095 \n AND (os.obs_datetime BETWEEN :startDate AND :endDate) \n ) \n ) \n and ob.voided = 0 \n or ob.person_id in ( \n select ob.person_id \n FROM obs ob \n -- Extra Pulmonary TB in ART Intake \n where ob.concept_id = 2236 and ob.value_coded = 2233 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.voided = 0 \n ) \n \n','2023-03-28 12:05:40',4,'2023-03-29 18:14:16',4,0,NULL,NULL,NULL,'155d4939-e304-4aa0-a2d4-efc18644affa'),(1856,'HHCM with Documented HIV Status','High risk population of HHCM with Documented HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM with Documented HIV Status\n High risk population of HHCM with Documented HIV Status\n \n 2023-03-28 10:39:40 UTC\n \n 2023-03-28 10:42:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1856\n select distinct o.person_id \n from obs o \n -- Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded =3777 -- Population (Household member of current miner) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 16:09:40',4,'2023-03-28 16:12:42',4,0,NULL,NULL,NULL,'6584ebef-9d17-4b53-80ba-7396b170919f'),(1857,'HHXM with Documented HIV Status','High risk population of HHXM with Documented HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM with Documented HIV Status\n High risk population of HHXM with Documented HIV Status\n \n 2023-03-28 10:46:20 UTC\n \n 2023-03-28 10:48:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1857\n select distinct o.person_id \n from obs o \n -- Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded =3778 -- Population (Household member of Ex miner) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 16:16:20',4,'2023-03-28 16:18:26',4,0,NULL,NULL,NULL,'f06272eb-e3f7-4d7e-82d1-1e3a391a8b9e'),(1858,'HHCM with Positive HIV Status','High risk population of HHCM with Positive HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM with Positive HIV Status\n High risk population of HHCM with Positive HIV Status\n \n 2023-03-28 10:54:07 UTC\n \n 2023-03-28 10:59:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1858\n select distinct o.person_id \n from obs o \n -- Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded =3777 -- Population (Household member of current miner) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 16:24:07',4,'2023-03-28 16:29:14',4,0,NULL,NULL,NULL,'2b06bd4f-a633-48d8-9a9a-12ae5f84001b'),(1859,'HHXM with Positive HIV Status','High risk population of HHXM with Positive HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM with Positive HIV Status\n High risk population of HHXM with Positive HIV Status\n \n 2023-03-28 11:03:32 UTC\n \n 2023-03-28 11:08:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1859\n select distinct o.person_id \n from obs o \n -- Positive, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded =3778 -- Population (Household member of Ex miner) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 16:33:32',4,'2023-03-28 16:38:06',4,0,NULL,NULL,NULL,'46bd9d48-49d2-4fd5-b433-f1123f217588'),(1860,'Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - Relapse','Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - Relapse','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - Relapse\n Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - Relapse\n \n 2023-03-28 11:42:29 UTC\n \n 2023-03-29 16:33:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1860\n select distinct ob.person_id \n FROM obs ob \ninner join location l on ob.location_id = l.location_id \n \n where ob.concept_id = 3788 and ob.value_coded = 2233 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.person_id in \n ( \n select distinct o.person_id \n \n from obs o \n -- New TB Patient \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n -- TB Start Date \n where ob.concept_id = 2237 \n and ob.value_datetime >= :startDate \n and ob.value_datetime <= :endDate \n and ob.voided = 0 \n ) \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- New Clients \n select distinct person_id \n from obs \n where concept_id = 3785 and value_coded = 1034 \n and obs_datetime >= :startDate \n and obs_datetime <= :endDate \n ) \n ) \n \n \n AND o.person_id not in ( \n select distinct os.person_id \n from obs os \n -- Patient must not be a tranfer in \n where os.concept_id = 3772 and os.value_coded =2095 \n AND (os.obs_datetime BETWEEN :startDate AND :endDate) \n ) \n ) \n and ob.voided = 0 \n or ob.person_id in ( \n select ob.person_id \n FROM obs ob \n -- Extra Pulmonary TB in ART Intake \n where ob.concept_id = 2236 and ob.value_coded = 2233 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.voided = 0 \n ) \n \n','2023-03-28 13:42:29',4,'2023-03-29 18:33:58',4,0,NULL,NULL,NULL,'b2905cf9-63d5-4b7b-9a72-0f76caf70da3'),(1861,'HHXM with HIV Positive on CPT/Dapzone','High risk population of HHXM with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM with HIV Positive on CPT/Dapzone\n High risk population of HHXM with HIV Positive on CPT/Dapzone\n \n 2023-03-28 13:51:41 UTC\n \n 2023-03-28 13:52:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1861\n select distinct o.person_id \n from obs o \n -- Positive, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded =3778 -- Population (Household member of Ex miner) \n AND ob.voided = 0 \n \n ) \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 5415 and ob.value_coded in (2330,4619) -- On Dapsone/CPT AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 19:21:41',4,'2023-03-28 19:22:17',4,0,NULL,NULL,NULL,'0133ee85-0abd-494a-86b7-6818670bd37b'),(1862,'Extra-pulmonary (bacteriologically confirmed or clinically diagnosed) - Exlude relapse','Extra-pulmonary (bacteriologically confirmed or clinically diagnosed) - Exlude relapse','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Extra-pulmonary (bacteriologically confirmed or clinically diagnosed) - Exlude relapse\n Extra-pulmonary (bacteriologically confirmed or clinically diagnosed) - Exlude relapse\n \n 2023-03-28 14:29:38 UTC\n \n 2023-03-29 16:36:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1862\n select distinct ob.person_id \n FROM obs ob \n \ninner join location l on ob.location_id = l.location_id \n \n -- Relapsed TB Client \nWHERE (ob.location_id =:location or parent_location =:location) \nand ob.concept_id = 3788 and ob.value_coded = 2233 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.person_id in \n ( \n select o.person_id \n from obs o \n where o.concept_id = 3785 and o.value_coded in (3786,1037) \n and o.obs_datetime >= :startDate \n and o.obs_datetime <= :endDate \n ) \n and ob.voided = 0 \n or ob.person_id in ( \n select ob.person_id \n FROM obs ob \n -- Extra Pulmonary TB in ART Intake \n where ob.concept_id = 2236 and ob.value_coded = 2233 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.voided = 0 \n ) \n \n','2023-03-28 16:29:38',4,'2023-03-29 18:36:39',4,0,NULL,NULL,NULL,'5023a0c3-15b8-4d16-ac54-09a77d01648d'),(1863,'HHCM with HIV Positive on CPT/Dapzone','High risk population of HHCM with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM with HIV Positive on CPT/Dapzone\n High risk population of HHCM with HIV Positive on CPT/Dapzone\n \n 2023-03-28 15:05:16 UTC\n \n 2023-03-28 15:09:54 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1863\n select distinct o.person_id \n from obs o \n -- Positive, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded =3777 -- Population (Household member of miner) \n AND ob.voided = 0 \n \n ) \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 5415 and ob.value_coded in (2330,4619) -- On Dapsone/CPT AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 20:35:16',4,'2023-03-28 20:39:54',4,0,NULL,NULL,NULL,'6365d73a-6fde-4e27-a75b-b5010023ddea'),(1864,'New and Relapse with HIV Positive on CPT/Dapzone','High risk population of New and Relapse with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n New and Relapse with HIV Positive on CPT/Dapzone\n High risk population of New and Relapse with HIV Positive on CPT/Dapzone\n \n 2023-03-28 15:14:37 UTC\n \n 2023-03-28 15:16:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1864\n select distinct o.person_id \n from obs o \n -- Positive, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded in (1034, 1084) -- Population (New and Relapse) \n AND ob.voided = 0 \n \n ) \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 5415 and ob.value_coded in (2330,4619) -- On Dapsone/CPT AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 20:44:37',4,'2023-03-28 20:46:55',4,0,NULL,NULL,NULL,'14343630-0c58-4f34-8bb5-1744e1618c31'),(1865,'Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : New','Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : New','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : New\n Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : New\n \n 2023-03-28 15:16:26 UTC\n \n 2023-03-29 16:47:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1865\n select distinct o.person_id \n FROM obs o \ninner join location l on o.location_id = l.location_id \n -- Bacteriologically confirmed Genotypic test results and Phenotypic test results \n where (o.location_id =:location or parent_location =:location) \n and o.concept_id in (3814, 3815) \n and o.obs_datetime >= :startDate \n and o.obs_datetime <= :endDate \n and o.voided = 0 \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- New Clients \n select distinct person_id \n from obs \n where concept_id = 3785 and value_coded = 1034 \n and obs_datetime >= :startDate \n and obs_datetime <= :endDate \n ) \n ) \n and o.person_id in ( \n select person_id \n from obs where concept_id = 3789 and value_coded= 3791 \n and obs_datetime >= :startDate \n and obs_datetime <= :endDate \n ) \n and o.person_id in ( \n select ob.person_id \n FROM obs ob \n -- Pulmonary TB \n where ob.concept_id = 3788 and ob.value_coded = 1018 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.voided = 0 \n ) \n or o.person_id in ( \n select ob.person_id \n FROM obs ob \n -- Pulmonary TB, Bacteriologically Confirmed \n where ob.concept_id = 2236 and ob.value_coded = 2234 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.voided = 0 \n )\n','2023-03-28 17:16:26',4,'2023-03-29 18:47:04',4,0,NULL,NULL,NULL,'273f38fa-7a41-4323-ac9d-24fd27c0c4cf'),(1866,'Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : Relapse','Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : Relapse','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : Relapse\n Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : Relapse\n \n 2023-03-28 15:21:59 UTC\n \n 2023-03-29 16:47:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1866\n select distinct o.person_id \n FROM obs o \n \ninner join location l on o.location_id = l.location_id \nWHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (3814, 3815) \n and o.obs_datetime >= :startDate \n and o.obs_datetime <= :endDate \n and o.voided = 0 \n AND o.person_id in \n ( \n \n -- Relapsed Clients \n select distinct oo.person_id \n from obs oo \n where oo.concept_id = 3785 and oo.value_coded = 1084 \n and oo.obs_datetime >= :startDate \n and oo.obs_datetime <= :endDate \n ) \n and o.person_id in ( \n select person_id \n from obs where concept_id = 3789 and value_coded= 3791 \n and obs_datetime >= :startDate \n and obs_datetime <= :endDate \n ) \n and o.person_id in ( \n select ob.person_id \n FROM obs ob \n -- Pulmonary TB \n where ob.concept_id = 3788 and ob.value_coded = 1018 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.voided = 0 \n ) \n or o.person_id in ( \n select ob.person_id \n FROM obs ob \n -- Pulmonary TB, Bacteriologically Confirmed \n where ob.concept_id = 2236 and ob.value_coded = 2234 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.voided = 0 \n )\n','2023-03-28 17:21:59',4,'2023-03-29 18:47:31',4,0,NULL,NULL,NULL,'300b2de6-1987-4ae2-a742-c2907f6bc2b7'),(1867,'Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : Excluding Relapse','Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : Excluding Relapse','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : Excluding Relapse\n Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : Excluding Relapse\n \n 2023-03-28 15:25:40 UTC\n \n 2023-03-30 15:34:09 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1867\n select distinct o.person_id \n FROM obs o \ninner join location l on o.location_id = l.location_id \nWHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (3814, 3815) \n and o.obs_datetime >= :startDate \n and o.obs_datetime <= :endDate \n and o.voided = 0 \n AND o.person_id in ( \n select person_id from obs \n where concept_id = 3788 and value_coded = 2233 \n and obs_datetime >= :startDate \n and obs_datetime <= :endDate \n \n ) \n AND o.person_id not in \n ( \n \n -- Relapsed Clients \n select distinct person_id \n from obs \n where concept_id = 3785 and value_coded = 1084 \n and obs_datetime >= :startDate \n and obs_datetime <= :endDate \n ) \n and o.person_id in ( \n select person_id \n from obs where concept_id = 3789 and value_coded= 3791 \n and obs_datetime >= :startDate \n and obs_datetime <= :endDate \n ) \n and o.person_id in ( \n select ob.person_id \n FROM obs ob \n -- Pulmonary TB \n where ob.concept_id = 3788 and ob.value_coded = 1018 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.voided = 0 \n ) \n or o.person_id in ( \n select ob.person_id \n FROM obs ob \n -- Pulmonary TB, Bacteriologically Confirmed \n where ob.concept_id = 2236 and ob.value_coded = 2234 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.voided = 0 \n )\n','2023-03-28 17:25:40',4,'2023-03-30 17:34:09',4,0,NULL,NULL,NULL,'fc1f07c9-e4d5-4d2f-97fb-98b26e6f66d0'),(1868,'Retreatment with HIV Positive on CPT/Dapzone','Retreatment Excl. Relapse with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Retreatment with HIV Positive on CPT/Dapzone\n Retreatment Excl. Relapse with HIV Positive on CPT/Dapzone\n \n 2023-03-28 15:28:13 UTC\n \n 2023-03-28 15:30:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1868\n select distinct o.person_id \n from obs o \n -- Positive, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded in (3786, 1037) -- Population (Retreatment Excl. Relapse) \n AND ob.voided = 0 \n \n ) \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 5415 and ob.value_coded in (2330,4619) -- On Dapsone/CPT AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 20:58:13',4,'2023-03-28 21:00:05',4,0,NULL,NULL,NULL,'fc64e900-ad46-45b3-9514-3d9aaefbd2cf'),(1869,'Children < 15 with Positive HIV on CPT/Dapzone','Children < 15 with Positive HIV on CPT/Dapzone','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children < 15 with Positive HIV on CPT/Dapzone\n Children < 15 with Positive HIV on CPT/Dapzone\n \n 2023-03-28 15:51:27 UTC\n \n 2023-03-29 21:44:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1869\n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- HIV Positive Status \n inner join location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 5415 and ob.value_coded in (2330,4619) -- On Dapsone/CPT AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n having Age < 15\n','2023-03-28 17:51:27',4,'2023-03-29 23:44:53',4,0,NULL,NULL,NULL,'36fe954a-f05e-431b-9037-4772a4b28383'),(1870,'Miners with HIV Positive on CPT/Dapzone','High risk population Miners with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Miners with HIV Positive on CPT/Dapzone\n High risk population Miners with HIV Positive on CPT/Dapzone\n \n 2023-03-28 15:55:23 UTC\n \n 2023-03-28 15:56:49 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1870\n select distinct o.person_id \n from obs o \n -- Positive, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded =3667 -- Population (miner) \n AND ob.voided = 0 \n \n ) \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 5415 and ob.value_coded in (2330,4619) -- On Dapsone/CPT AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 21:25:23',4,'2023-03-28 21:26:49',4,0,NULL,NULL,NULL,'354da83b-27c3-4124-9198-d1902fefb417'),(1871,'Ex Miner with HIV Positive on CPT/Dapzone',' High risk population of Ex Miner with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Ex Miner with HIV Positive on CPT/Dapzone\n High risk population of Ex Miner with HIV Positive on CPT/Dapzone\n \n 2023-03-28 16:02:40 UTC\n \n 2023-03-28 16:06:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1871\n select distinct o.person_id \n from obs o \n -- Positive, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded =3668 -- Population (Ex miner) \n AND ob.voided = 0 \n \n ) \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 5415 and ob.value_coded in (2330,4619) -- On Dapsone/CPT AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 21:32:40',4,'2023-03-28 21:36:28',4,0,NULL,NULL,NULL,'ff703f75-36cc-4487-afab-65df0ccbff68'),(1872,'Factory Workers with HIV Positive on CPT/Dapzone','High risk population of Factory Workers with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Factory Workers with HIV Positive on CPT/Dapzone\n High risk population of Factory Workers with HIV Positive on CPT/Dapzone\n \n 2023-03-28 16:08:16 UTC\n \n 2023-03-28 16:09:25 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1872\n select distinct o.person_id \n from obs o \n -- Positive, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded =3770 -- Population (Factory Workers) \n AND ob.voided = 0 \n \n ) \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 5415 and ob.value_coded in (2330,4619) -- On Dapsone/CPT AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 21:38:16',4,'2023-03-28 21:39:25',4,0,NULL,NULL,NULL,'ff030c28-e12b-45ed-80b0-330e353fdd29'),(1873,'Public transport operators with HIV Positive on CPT/Dapzone','High risk population of Public transport operators with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Public transport operators with HIV Positive on CPT/Dapzone\n High risk population of Public transport operators with HIV Positive on CPT/Dapzone\n \n 2023-03-28 16:14:01 UTC\n \n 2023-03-28 16:14:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1873\n select distinct o.person_id \n from obs o \n -- Positive, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded =4654 -- Population (Public transport operators) \n AND ob.voided = 0 \n \n ) \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 5415 and ob.value_coded in (2330,4619) -- On Dapsone/CPT AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 21:44:01',4,'2023-03-28 21:44:45',4,0,NULL,NULL,NULL,'b116d4a0-174f-49a7-be0f-3d5f79581b05'),(1874,'Health workers with HIV Positive on CPT/Dapzone',' High risk population of Health workers with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Health workers with HIV Positive on CPT/Dapzone\n High risk population of Health workers with HIV Positive on CPT/Dapzone\n \n 2023-03-28 16:16:21 UTC\n \n 2023-03-28 16:17:38 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1874\n select distinct o.person_id \n from obs o \n -- Positive, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded =3470 -- Population (Health workers) \n AND ob.voided = 0 \n \n ) \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 5415 and ob.value_coded in (2330,4619) -- On Dapsone/CPT AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 21:46:21',4,'2023-03-28 21:47:38',4,0,NULL,NULL,NULL,'4c4aa324-1728-4001-a94e-e857574126b1'),(1875,'Correctional Staff and inmates with HIV Positive on CPT/Dapzone','High risk population of Correctional Staff and inmates with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Correctional Staff and inmates with HIV Positive on CPT/Dapzone\n High risk population of Correctional Staff and inmates with HIV Positive on CPT/Dapzone\n \n 2023-03-28 16:20:31 UTC\n \n 2023-03-28 16:27:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1875\n select distinct o.person_id \n from obs o \n -- Positive, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded in (3779, 3671) -- Population (Correctional Staff and inmates) \n AND ob.voided = 0 \n \n ) \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 5415 and ob.value_coded in (2330,4619) -- On Dapsone/CPT AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 21:50:31',4,'2023-03-28 21:57:26',4,0,NULL,NULL,NULL,'423a7240-f359-41a2-929d-7b1cd7010807'),(1876,'TB among Miners','TB among Key Population Group Miners','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB among Miners\n TB among Key Population Group Miners\n \n 2023-03-28 17:11:27 UTC\n \n 2023-03-28 17:34:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1876\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in( \nSELECT Id \nFROM \n((SELECT distinct Id, patientIdentifier AS "Patient_Identifier", patientName AS "Patient_Name" \n FROM \n \n (select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n person.gender AS Gender, \n observed_age_group.name AS age_group, \n observed_age_group.sort_order AS sort_order \n \n from obs o \n -- Miners \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- Miners \n select distinct person_id \n from obs \n where concept_id = 3776 and value_coded = 3667 \n and obs_datetime >= CAST(:startDate AS DATE) \n and obs_datetime <= CAST(:endDate AS DATE) \n ) \n ) \n \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages') AS NEW_TB_CLIENTS \n ORDER BY NEW_TB_CLIENTS.Age) \n \n) AS Miner \n)\n','2023-03-28 22:41:27',4,'2023-03-28 23:04:23',4,0,NULL,NULL,NULL,'273e3515-f928-4164-be82-fc5235d66188'),(1877,'TB among Exminers','TB among Key Population Group Exminers','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB among Exminers\n TB among Key Population Group Exminers\n \n 2023-03-28 17:40:01 UTC\n \n 2023-03-28 17:41:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1877\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in( \nSELECT Id \nFROM \n((SELECT distinct Id, patientIdentifier AS "Patient_Identifier", patientName AS "Patient_Name" \n FROM \n \n (select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n person.gender AS Gender, \n observed_age_group.name AS age_group, \n observed_age_group.sort_order AS sort_order \n \n from obs o \n -- Exminers \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- Exminers \n select distinct person_id \n from obs \n where concept_id = 3776 and value_coded = 3668 \n and obs_datetime >= CAST(:startDate AS DATE) \n and obs_datetime <= CAST(:endDate AS DATE) \n ) \n ) \n \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages') AS NEW_TB_CLIENTS \n ORDER BY NEW_TB_CLIENTS.Age) \n \n) AS Exminer \n)\n','2023-03-28 23:10:01',4,'2023-03-28 23:11:15',4,0,NULL,NULL,NULL,'ecb47cb2-6af4-4932-8fee-076ba40afa87'),(1878,'TB among HHCM','TB among Key Population Group HHCM','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB among HHCM\n TB among Key Population Group HHCM\n \n 2023-03-28 19:19:59 UTC\n \n 2023-03-28 19:26:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1878\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in( \nSELECT Id \nFROM \n((SELECT distinct Id, patientIdentifier AS "Patient_Identifier", patientName AS "Patient_Name" \n FROM \n \n (select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n person.gender AS Gender, \n observed_age_group.name AS age_group, \n observed_age_group.sort_order AS sort_order \n \n from obs o \n -- HHCM \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- HHCM \n select distinct person_id \n from obs \n where concept_id = 3776 and value_coded = 3777 \n and obs_datetime >= CAST(:startDate AS DATE) \n and obs_datetime <= CAST(:endDate AS DATE) \n ) \n ) \n \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages') AS NEW_TB_CLIENTS \n ORDER BY NEW_TB_CLIENTS.Age) \n \n) As HHCM \n)\n','2023-03-29 00:49:59',4,'2023-03-29 00:56:17',4,0,NULL,NULL,NULL,'0da939c1-ae87-45c8-80ed-e56b82e5a62e'),(1879,'Correctional Staff and inmates on HIV Positive on ART','High risk population of Correctional Staff and inmates on HIV Positive on ART','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Correctional Staff and inmates on HIV Positive on ART\n High risk population of Correctional Staff and inmates on HIV Positive on ART\n \n 2023-03-28 19:25:59 UTC\n \n 2023-03-29 20:58:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1879\n select distinct o.person_id \n from obs o \n -- On ART \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4667 and o.value_coded in (4670, 4669) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded in (3779, 3671) -- Population (Correctional Staff and inmates) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \nAND o.obs_datetime >= CAST(:endDate AS DATE) \n\n','2023-03-28 21:25:59',4,'2023-03-29 22:58:43',4,0,NULL,NULL,NULL,'a6ebd7a8-631b-4e0e-bdfb-8be1b9fb9eec'),(1880,'New and Relapse with HIV Positive on ART','High risk population of New and Relapse with HIV Positive on ART','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n New and Relapse with HIV Positive on ART\n High risk population of New and Relapse with HIV Positive on ART\n \n 2023-03-28 19:29:52 UTC\n \n 2023-03-28 19:32:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1880\n SELECT DISTINCT o.person_id \n from obs o \n -- New and Relapse On ART \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4667 and o.value_coded in (4670, 4669) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3785 and ob.value_coded in (1034, 1084) -- New and Relapse \n and ob.voided = 0 \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE)\n','2023-03-29 00:59:52',4,'2023-03-29 01:02:02',4,0,NULL,NULL,NULL,'8067c849-4c81-475a-a26e-68a2e58b8067'),(1882,'Retreatment with HIV Positive on ART','High risk population of Retreatment Excl. Relapse HIV Positive on ART','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Retreatment with HIV Positive on ART\n High risk population of Retreatment Excl. Relapse HIV Positive on ART\n \n 2023-03-28 19:34:51 UTC\n \n 2023-03-28 19:45:46 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1882\n SELECT DISTINCT o.person_id \n from obs o \n -- Retreatmentafter LTFU/Failure on ART \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4667 and o.value_coded in (4670, 4669) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3785 and ob.value_coded in (3786, 1037) -- Retreatmentafter LTFU/Failure \n and ob.voided = 0 \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-29 01:04:51',4,'2023-03-29 01:15:46',4,0,NULL,NULL,NULL,'fe4f73c9-4b24-4458-9ae1-9d3fcad9f9cb'),(1883,'TB among HHXM','TB among Key Population Group HHXM','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB among HHXM\n TB among Key Population Group HHXM\n \n 2023-03-28 19:35:03 UTC\n \n 2023-03-28 19:37:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1883\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in( \nSELECT Id \nFROM \n((SELECT distinct Id, patientIdentifier AS "Patient_Identifier", patientName AS "Patient_Name" \n FROM \n \n (select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n person.gender AS Gender, \n observed_age_group.name AS age_group, \n observed_age_group.sort_order AS sort_order \n \n from obs o \n -- HHXM \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- HHXM \n select distinct person_id \n from obs \n where concept_id = 3776 and value_coded = 3778 \n and obs_datetime >= CAST(:startDate AS DATE) \n and obs_datetime <= CAST(:endDate AS DATE) \n ) \n ) \n \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages') AS NEW_TB_CLIENTS \n ORDER BY NEW_TB_CLIENTS.Age) \n \n) AS HHXM \n)\n','2023-03-29 01:05:03',4,'2023-03-29 01:07:06',4,0,NULL,NULL,NULL,'4715bb07-7b64-4001-b5cb-ea555b425a07'),(1884,'TB among Factory Workers','TB among Key Population Group Factory Workers','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB among Factory Workers\n TB among Key Population Group Factory Workers\n \n 2023-03-28 19:43:14 UTC\n \n 2023-03-28 19:45:00 UTC\n \n \n endDate\n \n java.util.Date\n true\n \n \n startDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1884\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in( \nSELECT Id \nFROM \n((SELECT distinct Id, patientIdentifier AS "Patient_Identifier", patientName AS "Patient_Name" \n FROM \n \n (select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n person.gender AS Gender, \n observed_age_group.name AS age_group, \n observed_age_group.sort_order AS sort_order \n \n from obs o \n -- FactoryWorkers \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- FactoryWorkers \n select distinct person_id \n from obs \n where concept_id = 3776 and value_coded = 3669 \n and obs_datetime >= CAST(:startDate AS DATE) \n and obs_datetime <= CAST(:endDate AS DATE) \n ) \n ) \n \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages') AS NEW_TB_CLIENTS \n ORDER BY NEW_TB_CLIENTS.Age) \n \n) AS FactoryWorkers \n)\n','2023-03-29 01:13:14',4,'2023-03-29 01:15:01',4,0,NULL,NULL,NULL,'6bed2c03-ba40-477b-9a9a-67f3fcd50ea3'),(1885,'TB among Correctional Staff & Inmates','TB among Key Population Group Correctional Staff & Inmates','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB among Correctional Staff & Inmates\n TB among Key Population Group Correctional Staff & Inmates\n \n 2023-03-28 19:47:06 UTC\n \n 2023-03-28 19:49:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1885\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in( \nSELECT Id \nFROM \n((SELECT distinct Id, patientIdentifier AS "Patient_Identifier", patientName AS "Patient_Name" \n FROM \n \n (select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n person.gender AS Gender, \n observed_age_group.name AS age_group, \n observed_age_group.sort_order AS sort_order \n \n from obs o \n -- Correctional Staff & Inmates \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- Correctional Staff & Inmates \n select distinct person_id \n from obs \n where concept_id = 3776 and value_coded in (3779,3671) \n and obs_datetime >= CAST(:startDate AS DATE) \n and obs_datetime <= CAST(:endDate AS DATE) \n ) \n ) \n \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages') AS NEW_TB_CLIENTS \n ORDER BY NEW_TB_CLIENTS.Age) \n \n) AS Correctional \n)\n','2023-03-29 01:17:06',4,'2023-03-29 01:19:30',4,0,NULL,NULL,NULL,'9016d0ef-4556-49e7-99bd-2bf2e7f5188f'),(1886,'Children < 15 with HIV Positive on ART','High risk population for Children < 15 with HIV Positive on ART','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children < 15 with HIV Positive on ART\n High risk population for Children < 15 with HIV Positive on ART\n \n 2023-03-28 19:47:46 UTC\n \n 2023-03-28 19:50:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1886\n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- HIV Positive on ART \n inner join location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4667 and o.value_coded in (4670, 4669) \n AND o.voided = 0 \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n having Age < 15\n','2023-03-29 01:17:46',4,'2023-03-29 01:20:02',4,0,NULL,NULL,NULL,'e724e30e-b9e1-4a19-afa9-d19aa8dc42f4'),(1887,'TB among Public Transport Operators ','TB among Key Population Group Public Transport Operators','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB among Public Transport Operators \n TB among Key Population Group Public Transport Operators\n \n 2023-03-28 19:51:36 UTC\n \n 2023-03-28 19:53:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1887\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in( \nSELECT Id \nFROM \n((SELECT distinct Id, patientIdentifier AS "Patient_Identifier", patientName AS "Patient_Name" \n FROM \n \n (select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n person.gender AS Gender, \n observed_age_group.name AS age_group, \n observed_age_group.sort_order AS sort_order \n \n from obs o \n -- Transport \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- Transport \n select distinct person_id \n from obs \n where concept_id = 3776 and value_coded = 4654 \n and obs_datetime >= CAST(:startDate AS DATE) \n and obs_datetime <= CAST(:endDate AS DATE) \n ) \n ) \n \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages') AS NEW_TB_CLIENTS \n ORDER BY NEW_TB_CLIENTS.Age) \n \n) AS Transport \n)\n','2023-03-29 01:21:36',4,'2023-03-29 01:23:32',4,0,NULL,NULL,NULL,'4aac5017-e28a-4f36-8805-0812476a9d7b'),(1888,'Miners with HIV Positive on ART','High risk population of Miners with HIV Positive on ART','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Miners with HIV Positive on ART\n High risk population of Miners with HIV Positive on ART\n \n 2023-03-28 19:55:27 UTC\n \n 2023-03-28 19:56:16 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1888\n select distinct o.person_id \n from obs o \n -- HIV Positive on ART \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded = 3667 -- Population (Miner) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-29 01:25:27',4,'2023-03-29 01:26:16',4,0,NULL,NULL,NULL,'a37a95b7-1365-4d73-8d21-28dd2e77196e'),(1889,'TB among Health Workers','TB among Key Population Group Health Workers','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB among Health Workers\n TB among Key Population Group Health Workers\n \n 2023-03-28 19:55:49 UTC\n \n 2023-03-28 19:57:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1889\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in( \nSELECT Id \nFROM \n((SELECT distinct Id, patientIdentifier AS "Patient_Identifier", patientName AS "Patient_Name" \n FROM \n \n (select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n person.gender AS Gender, \n observed_age_group.name AS age_group, \n observed_age_group.sort_order AS sort_order \n \n from obs o \n -- HealthWorkers \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- HealthWorkers \n select distinct person_id \n from obs \n where concept_id = 3776 and value_coded = 3670 \n and obs_datetime >= CAST(:startDate AS DATE) \n and obs_datetime <= CAST(:endDate AS DATE) \n ) \n ) \n \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages') AS NEW_TB_CLIENTS \n ORDER BY NEW_TB_CLIENTS.Age) \n \n) AS HealthWorkers \n)\n','2023-03-29 01:25:49',4,'2023-03-29 01:27:20',4,0,NULL,NULL,NULL,'04590a3f-4e59-45fe-a5c3-f5ae76ef805b'),(1890,'Ex Miner with with HIV Positive on ART','High risk population of Ex Miner with with HIV Positive on ART','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Ex Miner with with HIV Positive on ART\n High risk population of Ex Miner with with HIV Positive on ART\n \n 2023-03-28 19:58:00 UTC\n \n 2023-03-28 19:59:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1890\n select distinct o.person_id \n from obs o \n -- HIV Positive on ART \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4667 and o.value_coded in (4670, 4669) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded = 3668 -- Population (Ex-Miner) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-29 01:28:00',4,'2023-03-29 01:29:01',4,0,NULL,NULL,NULL,'1edf0f21-2fad-48c7-a24a-e21367f334c1'),(1891,'HHCM with with HIV Positive on ART','High risk population of HHCM with with HIV Positive on ART','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM with with HIV Positive on ART\n High risk population of HHCM with with HIV Positive on ART\n \n 2023-03-28 20:00:28 UTC\n \n 2023-03-28 20:03:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1891\n select distinct o.person_id \n from obs o \n -- HIV Positive on ART \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4667 and o.value_coded in (4670, 4669) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded =3777 -- Population (Household member of current miner) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-29 01:30:28',4,'2023-03-29 01:33:58',4,0,NULL,NULL,NULL,'14b8879f-49ef-492c-aeb0-fdd62fde084a'),(1892,'TB among Miners','TB among Key Population Group Miners','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB among Miners\n TB among Key Population Group Miners\n \n 2023-03-28 20:05:03 UTC\n \n 2023-03-28 20:12:22 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1892\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 01:35:03',4,'2023-03-29 01:42:22',4,0,NULL,NULL,NULL,'526100b3-2b2a-4f15-862e-4be06d73bdb3'),(1893,'HHXM with HIV Positive on ART','High risk population of HHXM with HIV Positive on ART','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM with HIV Positive on ART\n High risk population of HHXM with HIV Positive on ART\n \n 2023-03-28 20:05:19 UTC\n \n 2023-03-28 20:08:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1893\n select distinct o.person_id \n from obs o \n -- Positive, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4667 and o.value_coded in (4670, 4669) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded =3778 -- Population (Household member of Ex miner) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-29 01:35:19',4,'2023-03-29 01:38:02',4,0,NULL,NULL,NULL,'0d7e9652-b8fa-4264-859b-0b681452c462'),(1894,'Factory Workers with HIV Positive on ART','High risk population of Factory Workers with HIV Positive on ART','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Factory Workers with HIV Positive on ART\n High risk population of Factory Workers with HIV Positive on ART\n \n 2023-03-28 20:09:30 UTC\n \n 2023-03-28 20:10:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1894\n select distinct o.person_id \n from obs o \n -- Positive HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4667 and o.value_coded in (4670, 4669) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded = 3669 -- Population (Factory Workers) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-29 01:39:30',4,'2023-03-29 01:40:27',4,0,NULL,NULL,NULL,'67233a82-27bf-4615-948b-28fad7ad6322'),(1895,'Public transport operators with HIV Positive on ART','High risk population of Public transport operators with HIV Positive on ART','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Public transport operators with HIV Positive on ART\n High risk population of Public transport operators with HIV Positive on ART\n \n 2023-03-28 20:12:15 UTC\n \n 2023-03-28 20:14:34 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1895\n select distinct o.person_id \n from obs o \n -- Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded = 4654 -- Population (Public transport operators) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-29 01:42:15',4,'2023-03-29 01:44:34',4,0,NULL,NULL,NULL,'63418340-29fe-4106-83ad-a09538397f5f'),(1896,'TB among Exminers','TB among Key Population Group Ex Miners','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB among Exminers\n TB among Key Population Group Ex Miners\n \n 2023-03-28 20:13:33 UTC\n \n 2023-03-28 20:18:09 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1896\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 01:43:33',4,'2023-03-29 01:48:09',4,0,NULL,NULL,NULL,'2dcbfff3-70b6-4ed5-b727-a51fea71b8aa'),(1897,'Health workers with HIV Positive on ART','High risk population of Health workers with HIV Positive on ART','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Health workers with HIV Positive on ART\n High risk population of Health workers with HIV Positive on ART\n \n 2023-03-28 20:18:06 UTC\n \n 2023-03-28 20:18:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1897\n select distinct o.person_id \n from obs o \n -- Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4667 and o.value_coded in (4670, 4669) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded = 4670 -- Population (Health workers) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-29 01:48:06',4,'2023-03-29 01:48:39',4,0,NULL,NULL,NULL,'1340548d-896a-4473-ae26-4c8960dec630'),(1898,'TB among HHCM','TB among Key Population Group HHCM','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB among HHCM\n TB among Key Population Group HHCM\n \n 2023-03-28 20:19:17 UTC\n \n 2023-03-28 20:20:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1898\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 01:49:17',4,'2023-03-29 01:50:21',4,0,NULL,NULL,NULL,'dd0ada55-f903-426e-a60e-f83ceeb15cab'),(1899,'TB among HHXM','TB among Key Population Group HHXM','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB among HHXM\n TB among Key Population Group HHXM\n \n 2023-03-28 20:21:08 UTC\n \n 2023-03-28 20:23:24 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1899\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 01:51:08',4,'2023-03-29 01:53:24',4,0,NULL,NULL,NULL,'9558eb96-47f5-4cdd-ad4f-d07257529259'),(1900,'Pulmonary Bacteriologically Confirmed - Exlude Relapse','Pulmonary Bacteriologically Confirmed - Exlude Relapse','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Pulmonary Bacteriologically Confirmed - Exlude Relapse\n Pulmonary Bacteriologically Confirmed - Exlude Relapse\n \n 2023-03-29 03:39:55 UTC\n \n 2023-03-29 17:21:25 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1900\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 05:39:55',4,'2023-03-29 19:21:25',4,0,NULL,NULL,NULL,'8315a536-5b6e-4da8-bcf7-860b6b6bd8aa'),(1902,'Pulmonary Bacteriologically Confirmed New','Pulmonary Bacteriologically Confirmed New','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Pulmonary Bacteriologically Confirmed New\n Pulmonary Bacteriologically Confirmed New\n \n 2023-03-29 04:12:11 UTC\n \n 2023-03-29 05:37:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1902\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 09:42:11',4,'2023-03-29 11:07:28',4,0,NULL,NULL,NULL,'15e06979-0f27-4aba-87fb-bc5a6dc28da4'),(1903,'Pulmonary Clinically Diagnosed Excluding Relapse','Pulmonary Clinically Diagnosed Excluding Relapse','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Pulmonary Clinically Diagnosed Excluding Relapse\n Pulmonary Clinically Diagnosed Excluding Relapse\n \n 2023-03-29 06:06:35 UTC\n \n 2023-03-29 08:12:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1903\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 11:36:35',4,'2023-03-29 13:42:28',4,0,NULL,NULL,NULL,'b0ff3ba5-25df-46e4-8eae-bfca7d86b9dd'),(1904,'Pulmonary Bacteriologically Confirmed Relapse','Pulmonary Bacteriologically Confirmed Relapse','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Pulmonary Bacteriologically Confirmed Relapse\n Pulmonary Bacteriologically Confirmed Relapse\n \n 2023-03-29 06:08:27 UTC\n \n 2023-03-29 08:11:19 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1904\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 11:38:27',4,'2023-03-29 13:41:19',4,0,NULL,NULL,NULL,'f6797c59-e7e3-4492-ad5f-a67bf5e683bc'),(1905,'Pulmonary Clinically Diagnosed New','Pulmonary Clinically Diagnosed New','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Pulmonary Clinically Diagnosed New\n Pulmonary Clinically Diagnosed New\n \n 2023-03-29 08:14:51 UTC\n \n 2023-03-29 08:17:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1905\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 13:44:51',4,'2023-03-29 13:47:31',4,0,NULL,NULL,NULL,'63333694-f766-4047-830b-087496f8e5a8'),(1906,'Pulmonary Clinically Diagnosed Relapse','Pulmonary Clinically Diagnosed Relapse','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Pulmonary Clinically Diagnosed Relapse\n Pulmonary Clinically Diagnosed Relapse\n \n 2023-03-29 08:15:08 UTC\n \n 2023-03-29 08:18:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1906\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 13:45:08',4,'2023-03-29 13:48:31',4,0,NULL,NULL,NULL,'2ff007c1-993d-48fc-8df6-9ed7c66b42d3'),(1907,'Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - New','Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - New','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - New\n Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - New\n \n 2023-03-29 08:25:10 UTC\n \n 2023-03-29 08:49:47 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1907\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 13:55:10',4,'2023-03-29 14:19:47',4,0,NULL,NULL,NULL,'d1ce1a2c-338a-4926-a1d4-f7f79ac2b875'),(1908,'TB among Factory Workers','TB among Key Population Group Factory Workers','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB among Factory Workers\n TB among Key Population Group Factory Workers\n \n 2023-03-29 08:26:00 UTC\n \n 2023-03-29 08:52:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1908\n COUNT\n \n \n \n \n endDate\n ${startDate}\n \n \n location\n ${location}\n \n \n startDate\n ${endDate}\n \n \n \n','2023-03-29 13:56:00',4,'2023-03-29 14:22:40',4,0,NULL,NULL,NULL,'071a7d7a-f944-4965-978c-bfe740051b9a'),(1909,'Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - Relapse','Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - Relapse','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - Relapse\n Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - Relapse\n \n 2023-03-29 08:52:39 UTC\n \n 2023-03-29 08:54:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1909\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 14:22:39',4,'2023-03-29 14:24:28',4,0,NULL,NULL,NULL,'20c9a6fc-f845-4569-b018-b5f59c39948c'),(1910,'Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - Excluging Relapse','Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - Excluging Relapse','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - Excluging Relapse\n Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - Excluging Relapse\n \n 2023-03-29 08:53:19 UTC\n \n 2023-03-29 08:54:54 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1910\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 14:23:19',4,'2023-03-29 14:24:54',4,0,NULL,NULL,NULL,'422afe85-5763-4700-8a8b-bf17328901a8'),(1911,'TB among Correctional Staff & Inmates','TB among Key Population Group Correctional Staff & Inmates','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB among Correctional Staff & Inmates\n TB among Key Population Group Correctional Staff & Inmates\n \n 2023-03-29 08:53:58 UTC\n \n 2023-03-29 08:56:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1911\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 14:23:58',4,'2023-03-29 14:26:06',4,0,NULL,NULL,NULL,'8ac11f64-421a-4f48-9ac3-048ee6912eda'),(1912,'Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : Excluding Relapse','Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : Excluding Relapse','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : Excluding Relapse\n Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : Excluding Relapse\n \n 2023-03-29 08:55:36 UTC\n \n 2023-03-29 09:04:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1912\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 14:25:36',4,'2023-03-29 14:34:23',4,0,NULL,NULL,NULL,'83125cb9-0324-4e21-8f4d-b9fd51049909'),(1913,'TB among Public Transport Operators ','TB among Key Population Group Public Transport Operators','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB among Public Transport Operators \n TB among Key Population Group Public Transport Operators\n \n 2023-03-29 08:57:05 UTC\n \n 2023-03-29 08:59:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1913\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 14:27:05',4,'2023-03-29 14:29:07',4,0,NULL,NULL,NULL,'f3aabc74-880c-4502-94af-ff9fd0b95906'),(1914,'Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : New','Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : New','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : New\n Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : New\n \n 2023-03-29 08:59:37 UTC\n \n 2023-03-29 09:04:54 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1914\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 14:29:37',4,'2023-03-29 14:34:54',4,0,NULL,NULL,NULL,'c5e34544-e98f-42ce-82d1-3708ce5e5b80'),(1915,'TB among Health Workers','TB among Key Population Group Health Workers','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB among Health Workers\n TB among Key Population Group Health Workers\n \n 2023-03-29 09:02:15 UTC\n \n 2023-03-29 09:04:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1915\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 14:32:15',4,'2023-03-29 14:34:59',4,0,NULL,NULL,NULL,'76adf56b-486f-4a4c-b309-5c43372d94eb'),(1916,'TB Notification - Block 3','TB Notification - Block 3','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Notification - Block 3\n TB Notification - Block 3\n \n 2023-03-29 09:08:01 UTC\n \n 2023-03-29 09:08:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1916\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-03-29 14:38:01',4,'2023-03-29 14:38:31',4,0,NULL,NULL,NULL,'5a51f412-3b6f-4808-ae32-ed90141bb7e2'),(1917,'TB Notification - Block 3 Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Notification - Block 3 Data Set\n \n 2023-03-29 09:08:31 UTC\n \n 2023-03-29 10:08:22 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1917\n \n \n \n TB-HHCM\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n \n \n TB-HHXM\n \n \n \n \n \n \n \n \n \n TBExMiners\n \n \n \n \n \n \n \n \n \n TBFactoryW\n \n \n \n \n \n \n \n \n \n TBHealthW\n \n \n \n \n \n \n \n \n \n TBInmates\n \n \n \n \n \n \n \n \n \n TBMiners\n \n \n \n \n \n \n \n \n \n TBTrans\n \n \n \n \n \n \n \n \n \n','2023-03-29 14:38:31',4,'2023-03-29 15:38:22',4,0,NULL,NULL,NULL,'4e91ef91-ad5f-4717-b782-9ac61d52dc40'),(1919,'Block 1: All TB Patients diagnosed with TB during the current quarter, by history of treatment and anatomic site of disease Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Block 1: All TB Patients diagnosed with TB during the current quarter, by history of treatment and anatomic site of disease Data Set\n \n 2023-03-29 09:46:48 UTC\n \n 2023-03-29 15:30:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1919\n \n \n \n died1\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n \n \n died2\n \n \n \n \n \n \n \n \n \n died3\n \n \n \n \n \n \n \n \n \n extra1\n \n \n \n \n \n \n \n \n \n extra2\n \n \n \n \n \n \n \n \n \n extra3\n \n \n \n \n \n \n \n \n \n pul_ExPulm\n \n \n \n \n \n \n \n \n \n pul_clin1\n \n \n \n \n \n \n \n \n \n pul_diag2\n \n \n \n \n \n \n \n \n \n pul_new \n \n \n \n \n \n \n \n \n \n pul_newex\n \n \n \n \n \n \n \n \n \n pul_relaps\n \n \n \n \n \n \n \n \n \n','2023-03-29 11:46:48',4,'2023-03-29 17:30:32',4,0,NULL,NULL,NULL,'b7c3203a-888a-4139-9c3f-e9a8939bc811'),(1920,'New and Relapse with document HIV Status','','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n New and Relapse with document HIV Status\n \n \n 2023-03-29 14:22:45 UTC\n \n 2023-03-29 14:30:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1920\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 19:52:45',4,'2023-03-29 20:00:02',4,0,NULL,NULL,NULL,'18152a92-ded2-4f5a-af93-5dd01b51c839'),(1921,'Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : Relapse','Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : Relapse','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : Relapse\n Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : Relapse\n \n 2023-03-29 15:26:50 UTC\n \n 2023-03-29 15:28:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1921\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 17:26:50',4,'2023-03-29 17:28:11',4,0,NULL,NULL,NULL,'61cb2cc7-ee32-4da9-9c82-7bbc85f3e43c'),(1922,'TB Notification - Block 1 ','TB Notification - Block 1 ','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Notification - Block 1 \n TB Notification - Block 1 \n \n 2023-03-29 17:06:10 UTC\n \n 2023-03-29 17:06:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1922\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-03-29 19:06:10',4,'2023-03-29 19:06:58',4,0,NULL,NULL,NULL,'c7604f80-13cf-4773-abf5-b95f35fa1c92'),(1923,'TB Notification - Block 1 Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Notification - Block 1 Data Set\n \n 2023-03-29 17:06:58 UTC\n \n 2023-03-29 17:37:54 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1923\n \n \n \n died1\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n \n \n died2\n \n \n \n \n \n \n \n \n \n died3\n \n \n \n \n \n \n \n \n \n extra1\n \n \n \n \n \n \n \n \n \n extra2\n \n \n \n \n \n \n \n \n \n extra3\n \n \n \n \n \n \n \n \n \n pul1\n \n \n \n \n \n \n \n \n \n pul2\n \n \n \n \n \n \n \n \n \n pul3\n \n \n \n \n \n \n \n \n \n','2023-03-29 19:06:58',4,'2023-03-29 19:37:54',4,0,NULL,NULL,NULL,'d74aa49a-aa20-49e1-939a-5f1fb0c78d81'),(1924,'Children < 15 with Documented HIV Status','Children (0 - 14) with documented HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children < 15 with Documented HIV Status\n Children (0 - 14) with documented HIV Status\n \n 2023-03-29 17:07:40 UTC\n \n 2023-03-29 17:08:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1924\n COUNT\n \n \n \n \n endDate\n ${startDate}\n \n \n location\n ${location}\n \n \n startDate\n ${endDate}\n \n \n \n','2023-03-29 19:07:40',4,'2023-03-29 19:08:45',4,0,NULL,NULL,NULL,'777854f8-1e75-4b4c-9eb5-2b2a23acd1fd'),(1925,'Correctional Staff and inmates with Documented HIV Status','High risk population of Correctional Staff and inmates with Documented HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Correctional Staff and inmates with Documented HIV Status\n High risk population of Correctional Staff and inmates with Documented HIV Status\n \n 2023-03-29 17:11:52 UTC\n \n 2023-03-29 17:16:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1925\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 19:11:52',4,'2023-03-29 19:16:20',4,0,NULL,NULL,NULL,'8e2ae589-9a13-4aa5-bf9d-3cf376a59bf6'),(1926,'Ex-Miners with Documented HIV Status','High risk population of Ex Miners with Documented HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Ex-Miners with Documented HIV Status\n High risk population of Ex Miners with Documented HIV Status\n \n 2023-03-29 17:20:28 UTC\n \n 2023-03-29 17:23:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1926\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 19:20:28',4,'2023-03-29 19:23:06',4,0,NULL,NULL,NULL,'b2541e20-b6b8-4985-bd4a-9a980ee5ebf8'),(1927,'Factory Workers with Documented HIV Status','High risk population of Factory Workers with Documented HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Factory Workers with Documented HIV Status\n High risk population of Factory Workers with Documented HIV Status\n \n 2023-03-29 17:25:11 UTC\n \n 2023-03-29 17:29:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1927\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 19:25:11',4,'2023-03-29 19:29:17',4,0,NULL,NULL,NULL,'e95e9d48-01d5-4826-ab2c-82dbd2dfce44'),(1928,'Health workers with Documented HIV Status','High risk population of Health workers with Documented HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Health workers with Documented HIV Status\n High risk population of Health workers with Documented HIV Status\n \n 2023-03-29 17:31:28 UTC\n \n 2023-03-29 17:33:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1928\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 19:31:28',4,'2023-03-29 19:33:36',4,0,NULL,NULL,NULL,'38dd8693-21f8-40c2-ba3a-9f5d1a63959c'),(1929,'HHCM with Documented HIV Status','High risk population of HHCM with Documented HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM with Documented HIV Status\n High risk population of HHCM with Documented HIV Status\n \n 2023-03-29 17:34:59 UTC\n \n 2023-03-29 17:36:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1929\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 19:34:59',4,'2023-03-29 19:36:32',4,0,NULL,NULL,NULL,'12a86c02-9e39-4d69-8082-ecff9269d106'),(1930,'Miners with Documented HIV Status','High risk population of miners with documented HIV','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Miners with Documented HIV Status\n High risk population of miners with documented HIV\n \n 2023-03-29 17:39:04 UTC\n \n 2023-03-29 17:42:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1930\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 19:39:04',4,'2023-03-29 19:42:27',4,0,NULL,NULL,NULL,'625cc3fd-4dc5-4aee-9fba-2559b31470c8'),(1931,'Public transport operators with Documented HIV Status','High risk population of Public transport operators with Documented HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Public transport operators with Documented HIV Status\n High risk population of Public transport operators with Documented HIV Status\n \n 2023-03-29 19:32:07 UTC\n \n 2023-03-29 19:33:35 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1931\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 21:32:07',4,'2023-03-29 21:33:35',4,0,NULL,NULL,NULL,'9e48b5ef-99df-44e7-8946-2728727e08a1'),(1932,'Retreatment with documented HIV status','Retreatment Excl. Relapse client with documented HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Retreatment with documented HIV status\n Retreatment Excl. Relapse client with documented HIV Status\n \n 2023-03-29 19:35:36 UTC\n \n 2023-03-29 19:36:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1932\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 21:35:36',4,'2023-03-29 21:36:55',4,0,NULL,NULL,NULL,'5cc834ec-7c90-4063-b684-2c9da8ddc83e'),(1933,'Children < 15 with Positive HIV Status','High risk population for Children < 15 with Positive HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children < 15 with Positive HIV Status\n High risk population for Children < 15 with Positive HIV Status\n \n 2023-03-29 19:40:57 UTC\n \n 2023-03-29 19:42:25 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1933\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 21:40:57',4,'2023-03-29 21:42:25',4,0,NULL,NULL,NULL,'9ceb1ec0-0b28-49d8-a6ba-90297cae2968'),(1934,'Correctional Staff and inmates with Positive HIV Status',' High risk population of Correctional Staff and inmates with Positive HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Correctional Staff and inmates with Positive HIV Status\n High risk population of Correctional Staff and inmates with Positive HIV Status\n \n 2023-03-29 19:44:28 UTC\n \n 2023-03-29 19:45:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1934\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 21:44:28',4,'2023-03-29 21:45:44',4,0,NULL,NULL,NULL,'c9be5185-942d-41ae-8e15-c3ddea7bb22f'),(1935,'Ex-Miners with Positive HIV Status','High risk population of Ex Miners with Positive HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Ex-Miners with Positive HIV Status\n High risk population of Ex Miners with Positive HIV Status\n \n 2023-03-29 19:47:14 UTC\n \n 2023-03-29 19:50:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1935\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 21:47:14',4,'2023-03-29 21:50:01',4,0,NULL,NULL,NULL,'51933c5f-9020-417a-91fe-77cb0412d9ee'),(1936,'Factory Workers with Positive HIV Status','High risk population of Factory Workers with Positive HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Factory Workers with Positive HIV Status\n High risk population of Factory Workers with Positive HIV Status\n \n 2023-03-29 19:52:48 UTC\n \n 2023-03-29 19:56:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1936\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 21:52:48',4,'2023-03-29 21:56:43',4,0,NULL,NULL,NULL,'a72725b5-eac8-4f97-b285-3a9db174ab39'),(1937,'Health workers with Positive HIV Status',' High risk population of Health workers with Positive HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Health workers with Positive HIV Status\n High risk population of Health workers with Positive HIV Status\n \n 2023-03-29 19:59:20 UTC\n \n 2023-03-29 20:04:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1937\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 21:59:20',4,'2023-03-29 22:04:12',4,0,NULL,NULL,NULL,'317c0cce-c0d7-44da-9272-62cc9279a76c'),(1938,'HHCM with Positive HIV Status',' High risk population of HHCM with Positive HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM with Positive HIV Status\n High risk population of HHCM with Positive HIV Status\n \n 2023-03-29 20:05:19 UTC\n \n 2023-03-29 20:09:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1938\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 22:05:19',4,'2023-03-29 22:09:51',4,0,NULL,NULL,NULL,'7a7dee7e-a318-4819-96e9-a1c8fe3e0a4f'),(1939,'HHXM with Positive HIV Status','High risk population of HHXM with Positive HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM with Positive HIV Status\n High risk population of HHXM with Positive HIV Status\n \n 2023-03-29 20:10:54 UTC\n \n 2023-03-29 20:11:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1939\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 22:10:54',4,'2023-03-29 22:11:59',4,0,NULL,NULL,NULL,'4a4bc063-3233-4b3f-9776-8949a2a3104c'),(1940,'Miners with Positive HIV Status','High risk population of miners with Positive HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Miners with Positive HIV Status\n High risk population of miners with Positive HIV Status\n \n 2023-03-29 20:13:09 UTC\n \n 2023-03-29 20:15:52 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1940\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 22:13:09',4,'2023-03-29 22:15:52',4,0,NULL,NULL,NULL,'a555cd0b-41bf-4ba0-bc0a-bb84952305d7'),(1941,'New and Relapse with Positive HIV Status','New and Relapse with Positive HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n New and Relapse with Positive HIV Status\n New and Relapse with Positive HIV Status\n \n 2023-03-29 20:17:12 UTC\n \n 2023-03-29 20:37:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1941\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 22:17:12',4,'2023-03-29 22:37:39',4,0,NULL,NULL,NULL,'5212b24d-abdf-416a-812e-72b4f64b342d'),(1942,'Public transport with Positive HIV Status','High risk population of Public transport operators with Positive HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Public transport with Positive HIV Status\n High risk population of Public transport operators with Positive HIV Status\n \n 2023-03-29 20:38:50 UTC\n \n 2023-03-29 20:39:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1942\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 22:38:50',4,'2023-03-29 22:39:44',4,0,NULL,NULL,NULL,'3ada2309-e8f6-4301-ae89-63837fb6f36b'),(1943,'Retreatment with Positive HIV status','Retreatment Excl. Relapse with Positive HIV status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Retreatment with Positive HIV status\n Retreatment Excl. Relapse with Positive HIV status\n \n 2023-03-29 20:41:12 UTC\n \n 2023-03-29 20:42:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1943\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 22:41:12',4,'2023-03-29 22:42:06',4,0,NULL,NULL,NULL,'ee1b5901-9777-44c1-affd-37e3aba4746a'),(1944,'Children < 15 with HIV Positive on ART','High risk population for Children < 15 with HIV Positive on ART','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children < 15 with HIV Positive on ART\n High risk population for Children < 15 with HIV Positive on ART\n \n 2023-03-29 20:43:47 UTC\n \n 2023-03-29 20:55:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1944\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 22:43:47',4,'2023-03-29 22:55:26',4,0,NULL,NULL,NULL,'f636be9d-0527-4054-9822-6ab005267560'),(1945,'Correctional Staff and inmates on HIV Positive on ART','High risk population of Correctional Staff and inmates on HIV Positive on ART','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Correctional Staff and inmates on HIV Positive on ART\n High risk population of Correctional Staff and inmates on HIV Positive on ART\n \n 2023-03-29 20:56:54 UTC\n \n 2023-03-29 20:59:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1945\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 22:56:54',4,'2023-03-29 22:59:44',4,0,NULL,NULL,NULL,'2c07cd7e-cc23-4974-9964-602e576ef80d'),(1946,'Ex Miner with with HIV Positive on ART','High risk population of Ex Miner with with HIV Positive on ART','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Ex Miner with with HIV Positive on ART\n High risk population of Ex Miner with with HIV Positive on ART\n \n 2023-03-29 21:01:08 UTC\n \n 2023-03-29 21:05:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1946\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 23:01:08',4,'2023-03-29 23:05:53',4,0,NULL,NULL,NULL,'8df71093-9cb8-4d1d-9885-fb4415f8c1b2'),(1947,'Factory Workers with HIV Positive on ART','High risk population of Factory Workers with HIV Positive on ART','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Factory Workers with HIV Positive on ART\n High risk population of Factory Workers with HIV Positive on ART\n \n 2023-03-29 21:07:39 UTC\n \n 2023-03-29 21:11:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1947\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 23:07:39',4,'2023-03-29 23:11:51',4,0,NULL,NULL,NULL,'6d1a75ee-e860-483d-ad80-4308d1009c22'),(1948,'Health workers with HIV Positive on ART',' High risk population of Health workers with HIV Positive on ART','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Health workers with HIV Positive on ART\n High risk population of Health workers with HIV Positive on ART\n \n 2023-03-29 21:13:26 UTC\n \n 2023-03-29 21:17:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1948\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 23:13:26',4,'2023-03-29 23:17:08',4,0,NULL,NULL,NULL,'b3813228-7114-4e37-b997-6acebccd724a'),(1949,'HHCM with with HIV Positive on ART','High risk population of HHCM with with HIV Positive on ART','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM with with HIV Positive on ART\n High risk population of HHCM with with HIV Positive on ART\n \n 2023-03-29 21:18:20 UTC\n \n 2023-03-29 21:19:22 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1949\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 23:18:20',4,'2023-03-29 23:19:22',4,0,NULL,NULL,NULL,'360494e1-ccad-4e72-bf80-c564f2cfe18b'),(1950,'HHXM with HIV Positive on ART','High risk population of HHXM with HIV Positive on ART','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM with HIV Positive on ART\n High risk population of HHXM with HIV Positive on ART\n \n 2023-03-29 21:20:51 UTC\n \n 2023-03-29 21:25:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1950\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 23:20:51',4,'2023-03-29 23:25:50',4,0,NULL,NULL,NULL,'ce4eaae7-7985-4e89-ab65-3b0c1686f80e'),(1951,'Miners with HIV Positive on ART','High risk population of Miners with HIV Positive on ART','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Miners with HIV Positive on ART\n High risk population of Miners with HIV Positive on ART\n \n 2023-03-29 21:27:27 UTC\n \n 2023-03-29 21:30:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1951\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 23:27:27',4,'2023-03-29 23:30:27',4,0,NULL,NULL,NULL,'19d13a38-7625-4136-b870-a7facc92ecb3'),(1952,'New and Relapse with HIV Positive on ART','High risk population of New and Relapse with HIV Positive on ART','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n New and Relapse with HIV Positive on ART\n High risk population of New and Relapse with HIV Positive on ART\n \n 2023-03-29 21:33:41 UTC\n \n 2023-03-29 21:36:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1952\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 23:33:41',4,'2023-03-29 23:36:00',4,0,NULL,NULL,NULL,'86db5b09-049a-4be4-a35f-f02f9de644f6'),(1953,'Public transport operators with HIV Positive on ART','High risk population of Public transport operators with HIV Positive on ART','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Public transport operators with HIV Positive on ART\n High risk population of Public transport operators with HIV Positive on ART\n \n 2023-03-29 21:37:07 UTC\n \n 2023-03-29 21:38:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1953\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 23:37:07',4,'2023-03-29 23:38:05',4,0,NULL,NULL,NULL,'ebbb00b2-3779-47b8-8265-c8afea8a5ac1'),(1954,'Retreatment with HIV Positive on ART','High risk population of Retreatment Excl. Relapse HIV Positive on ART','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Retreatment with HIV Positive on ART\n High risk population of Retreatment Excl. Relapse HIV Positive on ART\n \n 2023-03-29 21:39:16 UTC\n \n 2023-03-29 21:40:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1954\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 23:39:16',4,'2023-03-29 23:40:08',4,0,NULL,NULL,NULL,'2ffdb12c-d02b-4e9a-a1dc-6e4974093b5a'),(1955,'Children < 15 with Positive HIV on CPT/Dapzone','Children < 15 with Positive HIV on CPT/Dapzone','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children < 15 with Positive HIV on CPT/Dapzone\n Children < 15 with Positive HIV on CPT/Dapzone\n \n 2023-03-29 21:44:42 UTC\n \n 2023-03-29 21:47:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1955\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 23:44:42',4,'2023-03-29 23:47:53',4,0,NULL,NULL,NULL,'78313782-541c-4568-956c-9fb7bf92c08b'),(1956,'Correctional Staff and inmates with HIV Positive on CPT/Dapzone','High risk population of Correctional Staff and inmates with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Correctional Staff and inmates with HIV Positive on CPT/Dapzone\n High risk population of Correctional Staff and inmates with HIV Positive on CPT/Dapzone\n \n 2023-03-29 21:54:08 UTC\n \n 2023-03-29 21:56:48 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1956\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 23:54:08',4,'2023-03-29 23:56:48',4,0,NULL,NULL,NULL,'46e76f2a-4fc0-40cf-be9d-61565edbe566'),(1957,'Ex Miner with HIV Positive on CPT/Dapzone','High risk population of Ex Miner with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Ex Miner with HIV Positive on CPT/Dapzone\n High risk population of Ex Miner with HIV Positive on CPT/Dapzone\n \n 2023-03-29 21:58:20 UTC\n \n 2023-03-29 21:59:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1957\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 23:58:20',4,'2023-03-29 23:59:20',4,0,NULL,NULL,NULL,'348df991-95e1-4724-8df6-e4d905d67b11'),(1958,'Factory Workers with HIV Positive on CPT/Dapzone','High risk population of Factory Workers with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Factory Workers with HIV Positive on CPT/Dapzone\n High risk population of Factory Workers with HIV Positive on CPT/Dapzone\n \n 2023-03-29 22:00:58 UTC\n \n 2023-03-29 22:02:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1958\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-30 00:00:58',4,'2023-03-30 00:02:05',4,0,NULL,NULL,NULL,'5ce50877-ee92-48de-bfa7-a863b735975e'),(1959,'Health workers with HIV Positive on CPT/Dapzone','High risk population of Health workers with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Health workers with HIV Positive on CPT/Dapzone\n High risk population of Health workers with HIV Positive on CPT/Dapzone\n \n 2023-03-29 22:03:33 UTC\n \n 2023-03-29 22:06:16 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1959\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-30 00:03:33',4,'2023-03-30 00:06:16',4,0,NULL,NULL,NULL,'e47447de-6a64-422f-abe3-c281d2b4431c'),(1960,'HHCM with HIV Positive on CPT/Dapzone','High risk population of HHCM with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM with HIV Positive on CPT/Dapzone\n High risk population of HHCM with HIV Positive on CPT/Dapzone\n \n 2023-03-29 22:08:00 UTC\n \n 2023-03-29 22:09:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1960\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-30 00:08:00',4,'2023-03-30 00:09:04',4,0,NULL,NULL,NULL,'02d9a185-dc0e-4852-8176-c4da69705d5d'),(1961,'HHXM with HIV Positive on CPT/Dapzone','High risk population of HHXM with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM with HIV Positive on CPT/Dapzone\n High risk population of HHXM with HIV Positive on CPT/Dapzone\n \n 2023-03-29 22:10:38 UTC\n \n 2023-03-29 22:11:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1961\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-30 00:10:38',4,'2023-03-30 00:11:51',4,0,NULL,NULL,NULL,'c86cc664-d513-4afe-97b9-8163b4bb39d1'),(1962,'Miners with HIV Positive on CPT/Dapzone','High risk population Miners with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Miners with HIV Positive on CPT/Dapzone\n High risk population Miners with HIV Positive on CPT/Dapzone\n \n 2023-03-29 22:13:17 UTC\n \n 2023-03-29 22:15:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1962\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-30 00:13:17',4,'2023-03-30 00:15:15',4,0,NULL,NULL,NULL,'7751e110-9e34-453e-bd9f-792272cbd895'),(1963,'New and Relapse with HIV Positive on CPT/Dapzone','High risk population of New and Relapse with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n New and Relapse with HIV Positive on CPT/Dapzone\n High risk population of New and Relapse with HIV Positive on CPT/Dapzone\n \n 2023-03-29 22:16:42 UTC\n \n 2023-03-29 22:18:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1963\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-30 00:16:42',4,'2023-03-30 00:18:40',4,0,NULL,NULL,NULL,'2ebc8503-89e4-41f4-bdaf-e9e1d041a147'),(1964,'Public transport operators with HIV Positive on CPT/Dapzone','High risk population of Public transport operators with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Public transport operators with HIV Positive on CPT/Dapzone\n High risk population of Public transport operators with HIV Positive on CPT/Dapzone\n \n 2023-03-30 08:39:11 UTC\n \n 2023-03-30 08:40:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1964\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-30 10:39:11',4,'2023-03-30 10:40:29',4,0,NULL,NULL,NULL,'575068b5-f0ca-4d5b-8181-663b5feded65'),(1965,'Retreatment with HIV Positive on CPT/Dapzone','Retreatment Excl. Relapse with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Retreatment with HIV Positive on CPT/Dapzone\n Retreatment Excl. Relapse with HIV Positive on CPT/Dapzone\n \n 2023-03-30 08:41:45 UTC\n \n 2023-03-30 08:48:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1965\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-30 10:41:45',4,'2023-03-30 10:48:08',4,0,NULL,NULL,NULL,'22dbd0dd-a4ca-42a5-986e-6c0012eb55b1'),(1966,'HHXM with Documented HIV Status','High risk population of HHXM with Documented HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM with Documented HIV Status\n High risk population of HHXM with Documented HIV Status\n \n 2023-03-30 09:03:54 UTC\n \n 2023-03-30 09:06:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1966\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-30 11:03:54',4,'2023-03-30 11:06:14',4,0,NULL,NULL,NULL,'e5de47f6-aa7a-4b2d-bd72-83e5458977d6'),(1967,'TB Notification - Block 4','TB Notification - Block 4','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Notification - Block 4\n TB Notification - Block 4\n \n 2023-03-30 09:18:19 UTC\n \n 2023-03-30 20:54:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1967\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-03-30 11:18:19',4,'2023-03-30 22:54:40',4,0,NULL,NULL,NULL,'0b9affca-ad93-42fb-bd49-57380f721a08'),(1968,'TBNotification - Block 4 Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TBNotification - Block 4 Data Set\n \n 2023-03-30 09:18:47 UTC\n \n 2023-03-30 20:50:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1968\n \n \n DM_Sex\n \n \n \n \n \n \n \n \n ARTChild_F\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n \n \n \n ARTChild_M\n \n \n \n \n DM_Sex\n Males\n \n \n \n \n \n ARTCo&In_F\n \n \n \n \n \n \n \n \n \n ARTCo&In_M\n \n \n \n \n \n \n ARTFacW_F\n \n \n \n \n \n \n \n \n \n ARTFacW_M\n \n \n \n \n \n \n ARTHHCM_F\n \n \n \n \n \n \n \n \n \n ARTHHCM_M\n \n \n \n \n \n \n ARTHHXM_F\n \n \n \n \n \n \n \n \n \n ARTHHXM_M\n \n \n \n \n \n \n ARTHeaW_F\n \n \n \n \n \n \n \n \n \n ARTHeaW_M\n \n \n \n \n \n \n ARTMiner_F\n \n \n \n \n \n \n \n \n \n ARTMiner_M\n \n \n \n \n \n \n ARTNw&Rl_F\n \n \n \n \n \n \n \n \n \n ARTNw&Rl_M\n \n \n \n \n \n \n ARTRetr_F\n \n \n \n \n \n \n \n \n \n ARTRetr_M\n \n \n \n \n \n \n ARTTrans_F\n \n \n \n \n \n \n \n \n \n ARTTrans_M\n \n \n \n \n \n \n ARTXMine_F\n \n \n \n \n \n \n \n \n \n ARTXMine_M\n \n \n \n \n \n \n DapChild_F\n \n \n \n \n \n \n \n \n \n DapChild_M\n \n \n \n \n \n \n DapCo&In_F\n \n \n \n \n \n \n \n \n \n DapCo&In_M\n \n \n \n \n \n \n DapFacW_F\n \n \n \n \n \n \n \n \n \n DapFacW_M\n \n \n \n \n \n \n DapHHCM_F\n \n \n \n \n \n \n \n \n \n DapHHCM_M\n \n \n \n \n \n \n DapHHXM_F\n \n \n \n \n \n \n \n \n \n DapHHXM_M\n \n \n \n \n \n \n DapHeaW_F\n \n \n \n \n \n \n \n \n \n DapHeaW_M\n \n \n \n \n \n \n DapMiner_F\n \n \n \n \n \n \n \n \n \n DapMiner_M\n \n \n \n \n \n \n DapNw&Rl_F\n \n \n \n \n \n \n \n \n \n DapNw&Rl_M\n \n \n \n \n \n \n DapRetre_F\n \n \n \n \n \n \n \n \n \n DapRetre_M\n \n \n \n \n \n \n DapTrans_F\n \n \n \n \n \n \n \n \n \n DapTrans_M\n \n \n \n \n \n \n DapXMine_F\n \n \n \n \n \n \n \n \n \n DapXMine_M\n \n \n \n \n \n \n PosChild_F\n \n \n \n \n \n \n \n \n \n PosChild_M\n \n \n \n \n \n \n PosCo&In_F\n \n \n \n \n \n \n \n \n \n PosCo&In_M\n \n \n \n \n \n \n PosFacW_F\n \n \n \n \n \n \n \n \n \n PosFacW_M\n \n \n \n \n \n \n PosHHCM_F\n \n \n \n \n \n \n \n \n \n PosHHCM_M\n \n \n \n \n \n \n PosHHXM_F\n \n \n \n \n \n \n \n \n \n PosHHXM_M\n \n \n \n \n \n \n PosHeaW_F\n \n \n \n \n \n \n \n \n \n PosHeaW_M\n \n \n \n \n \n \n PosMiner_F\n \n \n \n \n \n \n \n \n \n PosMiner_M\n \n \n \n \n \n \n PosNw&Rs_F\n \n \n \n \n \n \n \n \n \n PosNw&Rs_M\n \n \n \n \n \n \n PosRetr_F\n \n \n \n \n \n \n \n \n \n PosRetr_M\n \n \n \n \n \n \n PosTrans_F\n \n \n \n \n \n \n \n \n \n PosTrans_M\n \n \n \n \n \n \n PosXMine_F\n \n \n \n \n \n \n \n \n \n PosXMine_M\n \n \n \n \n \n \n StsChild_F\n \n \n \n \n \n \n \n \n \n StsChild_M\n \n \n \n \n \n \n StsCo&In_F\n \n \n \n \n \n \n \n \n \n StsCo&In_M\n \n \n \n \n \n \n StsFacW_F\n \n \n \n \n \n \n \n \n \n StsFacW_M\n \n \n \n \n \n \n StsHHCM_F\n \n \n \n \n \n \n \n \n \n StsHHCM_M\n \n \n \n \n \n \n StsHHXM_F\n \n \n \n \n \n \n \n \n \n StsHHXM_M\n \n \n \n \n \n \n StsHeaW_F\n \n \n \n \n \n \n \n \n \n StsHeaW_M\n \n \n \n \n \n \n StsMin_F\n \n \n \n \n \n \n \n \n \n StsMin_M\n \n \n \n \n \n \n StsNw&Rs_F\n \n \n \n \n \n \n \n \n \n StsNw&Rs_M\n \n \n \n \n \n \n StsRetre_F\n \n \n \n \n \n \n \n \n \n StsRetre_M\n \n \n \n \n \n \n StsTrans_F\n \n \n \n \n \n \n \n \n \n StsTrans_M\n \n \n \n \n \n \n StsXMin_F\n \n \n \n \n \n \n \n \n \n StsXMin_M\n \n \n \n \n \n \n','2023-03-30 11:18:47',4,'2023-03-30 22:50:08',4,0,NULL,NULL,NULL,'e08d273c-ba6d-4085-bf72-b7f6737396bf'),(1969,'TB_OUTCOMES','TB Outcomes','org.openmrs.module.reporting.indicator.dimension.Dimension','org.openmrs.module.reporting.indicator.dimension.CohortDefinitionDimension','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB_OUTCOMES\n TB Outcomes\n \n 2023-03-30 13:48:45 UTC\n \n 2023-03-30 14:06:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1969\n \n \n Competed\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-03-30 15:48:45',4,'2023-03-30 16:06:44',4,0,NULL,NULL,NULL,'2244b6f7-5dd0-4c8a-8a9e-67bac3fe7d9b'),(1970,'test','test','org.openmrs.module.reporting.indicator.dimension.Dimension','org.openmrs.module.reporting.indicator.dimension.CohortDefinitionDimension','org.openmrs.module.reporting.serializer.ReportingSerializer','\n test\n test\n \n 2023-03-30 14:06:01 UTC\n \n \n','2023-03-30 16:06:01',4,NULL,NULL,0,NULL,NULL,NULL,'a572d104-f644-42bb-ae58-7c83ac0747ad'),(1971,'TB New and Relapse Completed','TB New and Relapse Completed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB New and Relapse Completed\n TB New and Relapse Completed\n \n 2023-03-30 14:58:43 UTC\n \n 2023-03-30 14:59:47 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1971\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- TB History of previous treatment \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3785 and o.value_coded in (1034,1084) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 2242 and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 16:58:43',4,'2023-03-30 16:59:47',4,0,NULL,NULL,NULL,'1540870d-551a-4e11-baad-70ed9b13289a'),(1972,'TB New and Relapse Cured','TB New and Relapse Cured','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB New and Relapse Cured\n TB New and Relapse Cured\n \n 2023-03-30 15:04:42 UTC\n \n 2023-03-30 15:06:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1972\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- TB History of previous treatment(New AND Relapse) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3785 and o.value_coded in (1034,1084) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 1068 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 17:04:42',4,'2023-03-30 17:06:17',4,0,NULL,NULL,NULL,'22e1906b-16cd-4109-b529-a043e43ff3d4'),(1973,'TB New and Relapse Died','TB New and Relapse Died','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB New and Relapse Died\n TB New and Relapse Died\n \n 2023-03-30 15:08:32 UTC\n \n 2023-03-30 15:09:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1973\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- TB History of previous treatment(New AND Relapse) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3785 and o.value_coded in (1034,1084) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3650 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 17:08:32',4,'2023-03-30 17:09:15',4,0,NULL,NULL,NULL,'19636929-afd0-4ba0-acfa-bbe325e1f002'),(1974,'TB New and Relapse Lost to Follow-up','TB New and Relapse Lost to Follow-up','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB New and Relapse Lost to Follow-up\n TB New and Relapse Lost to Follow-up\n \n 2023-03-30 15:10:23 UTC\n \n 2023-03-30 15:10:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1974\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- TB History of previous treatment(New AND Relapse) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3785 and o.value_coded in (1034,1084) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 2302 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 17:10:23',4,'2023-03-30 17:10:58',4,0,NULL,NULL,NULL,'87260731-779f-4244-9480-f75169dd2fbf'),(1975,'TB New and Relapse Failed (Susceptible)','TB New and Relapse Failed (Susceptible)','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB New and Relapse Failed (Susceptible)\n TB New and Relapse Failed (Susceptible)\n \n 2023-03-30 15:11:55 UTC\n \n 2023-03-30 15:31:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1975\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- TB History of previous treatment(New AND Relapse) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3785 and o.value_coded in (1034,1084) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3793 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 17:11:55',4,'2023-03-30 17:31:39',4,0,NULL,NULL,NULL,'53aec520-fab0-4871-b46f-209c32b921c1'),(1976,'TB New and Relapse Not Evaluated','TB New and Relapse Not Evaluated','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB New and Relapse Not Evaluated\n TB New and Relapse Not Evaluated\n \n 2023-03-30 15:13:29 UTC\n \n 2023-03-30 16:05:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1976\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- TB History of previous treatment(New AND Relapse) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3785 and o.value_coded in (1034,1084) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id not in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded in (1068,2242,3650,2302,3793,3794) \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 17:13:29',4,'2023-03-30 18:05:12',4,0,NULL,NULL,NULL,'0af163fd-0d3c-4b6a-a84e-1648cd9bb042'),(1977,'exMiner_cured','Ex miner cured','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n exMiner_cured\n Ex miner cured\n \n 2023-03-30 15:21:40 UTC\n \n 2023-03-30 15:47:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1977\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3668 \n and ob.voided = 0 \n ) \n and o.person_id in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded = 1068 \n and b.voided = 0 \n ) \n\n','2023-03-30 17:21:40',4,'2023-03-30 17:47:23',4,0,NULL,NULL,NULL,'4c2c88ec-ee4e-4bad-962d-229983982f12'),(1978,'exMiner_completed','Ex miner completed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n exMiner_completed\n Ex miner completed\n \n 2023-03-30 15:24:54 UTC\n \n 2023-03-30 15:45:56 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1978\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3668 \n and ob.voided = 0 \n ) \n and o.person_id in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded = 2242 \n and b.voided = 0 \n ) \n\n','2023-03-30 17:24:54',4,'2023-03-30 17:45:56',4,0,NULL,NULL,NULL,'37afe774-0ef1-4152-8ab9-fe702f175f36'),(1979,'exMiner_died','Ex Miner died','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n exMiner_died\n Ex Miner died\n \n 2023-03-30 15:28:17 UTC\n \n 2023-04-03 07:35:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1979\n select distinct o.person_id \n \n \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3668 \n and ob.voided = 0 \n ) \n and o.person_id in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded = 3650 and b.voided = 0 \n ) \n\n','2023-03-30 17:28:17',4,'2023-04-03 09:35:05',4,0,NULL,NULL,NULL,'d08b3fb0-d1c2-455d-89a6-f3c9a1469a3e'),(1980,'TB New and Relapse Completed Moved to second line treatment','TB New and Relapse Completed Moved to second line treatment','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB New and Relapse Completed Moved to second line treatment\n TB New and Relapse Completed Moved to second line treatment\n \n 2023-03-30 15:33:00 UTC\n \n 2023-03-30 15:33:47 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1980\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- TB History of previous treatment(New AND Relapse) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3785 and o.value_coded in (1034,1084) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3794 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 17:33:00',4,'2023-03-30 17:33:47',4,0,NULL,NULL,NULL,'d2ff18e1-1cf3-4bff-9796-e35aaf019b40'),(1981,'exMiner_failedSusceptive','Ex miner failed suceptive','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n exMiner_failedSusceptive\n Ex miner failed suceptive\n \n 2023-03-30 15:40:13 UTC\n \n 2023-04-03 10:56:48 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1981\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3668 \n and ob.voided = 0 \n ) \n and o.person_id in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded = 3793 \n and b.voided = 0 \n ) \n\n','2023-03-30 17:40:13',4,'2023-04-03 12:56:48',4,0,NULL,NULL,NULL,'8c7c6720-c1aa-492a-be1b-47edc57cfd55'),(1982,'exMiner_lost','Ex miner lost','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n exMiner_lost\n Ex miner lost\n \n 2023-03-30 15:42:32 UTC\n \n 2023-03-30 15:49:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1982\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3668 \n and ob.voided = 0 \n ) \n and o.person_id in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded = 2302 \n and b.voided = 0 \n ) \n\n','2023-03-30 17:42:32',4,'2023-03-30 17:49:29',4,0,NULL,NULL,NULL,'cb57dd5b-22ae-42d9-a86a-6927e9aae9cb'),(1983,'TB Retreatment excluding Relapse and Completed','TB Retreatment excluding Relapse and Completed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Retreatment excluding Relapse and Completed\n TB Retreatment excluding Relapse and Completed\n \n 2023-03-30 15:43:38 UTC\n \n 2023-03-30 15:44:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1983\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- TB History of previous treatment(Retreatment Excluding Relapse) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3785 and o.value_coded in (3786,1037) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 2242 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 17:43:38',4,'2023-03-30 17:44:32',4,0,NULL,NULL,NULL,'93eefc43-0eba-4a27-8d7e-72958dc0b2f1'),(1984,'exMiner_movedSecondLIne','Ex miner moved to second line','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n exMiner_movedSecondLIne\n Ex miner moved to second line\n \n 2023-03-30 15:44:13 UTC\n \n 2023-03-30 15:44:34 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1984\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3668 \n and ob.voided = 0 \n ) \n and o.person_id in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded = 3794 \n and b.voided = 0 \n ) \n\n','2023-03-30 17:44:13',4,'2023-03-30 17:44:34',4,0,NULL,NULL,NULL,'846e0252-747b-4457-b0f4-6f23ed244706'),(1985,'TB Retreatment excluding Relapse and Cured','TB Retreatment excluding Relapse and Cured','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Retreatment excluding Relapse and Cured\n TB Retreatment excluding Relapse and Cured\n \n 2023-03-30 15:45:00 UTC\n \n 2023-03-30 15:45:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1985\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- TB History of previous treatment(Retreatment Excluding Relapse) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3785 and o.value_coded in (3786,1037) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 1068 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 17:45:00',4,'2023-03-30 17:45:29',4,0,NULL,NULL,NULL,'1cd8596a-21ba-4a7b-b3c6-c82fb756bf8f'),(1986,'TB Retreatment excluding Relapse and Died','TB Retreatment excluding Relapse and Died','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Retreatment excluding Relapse and Died\n TB Retreatment excluding Relapse and Died\n \n 2023-03-30 15:45:57 UTC\n \n 2023-03-30 15:46:22 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1986\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- TB History of previous treatment(Retreatment Excluding Relapse) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3785 and o.value_coded in (3786,1037) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3650 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 17:45:57',4,'2023-03-30 17:46:22',4,0,NULL,NULL,NULL,'50001a13-545a-4de2-9617-86c8b262eb9d'),(1987,'TB Retreatment excluding Relapse and Lost to Follow up','TB Retreatment excluding Relapse and Lost to Follow up','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Retreatment excluding Relapse and Lost to Follow up\n TB Retreatment excluding Relapse and Lost to Follow up\n \n 2023-03-30 15:47:18 UTC\n \n 2023-03-30 15:47:57 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1987\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- TB History of previous treatment(Retreatment Excluding Relapse) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3785 and o.value_coded in (3786,1037) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 2302 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 17:47:18',4,'2023-03-30 17:47:57',4,0,NULL,NULL,NULL,'46fbbe80-0f0e-4cf5-8f4d-04444b70d3bc'),(1988,'TB Retreatment excluding Relapse and Failed (Susceptible)','TB Retreatment excluding Relapse and Failed (Susceptible)','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Retreatment excluding Relapse and Failed (Susceptible)\n TB Retreatment excluding Relapse and Failed (Susceptible)\n \n 2023-03-30 15:49:14 UTC\n \n 2023-03-30 15:49:46 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1988\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- TB History of previous treatment(Retreatment Excluding Relapse) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3785 and o.value_coded in (3786,1037) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3793 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 17:49:14',4,'2023-03-30 17:49:46',4,0,NULL,NULL,NULL,'0b97c9a2-f4f0-460c-9a6a-943f0d0b9bac'),(1989,'TB Retreatment excluding Relapse and Not Evaluated','TB Retreatment excluding Relapse and Not Evaluated','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Retreatment excluding Relapse and Not Evaluated\n TB Retreatment excluding Relapse and Not Evaluated\n \n 2023-03-30 15:51:27 UTC\n \n 2023-03-30 16:03:56 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1989\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- TB History of previous treatment(Retreatment Excluding Relapse) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3785 and o.value_coded in (3786,1037) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id not in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded in (1068,2242,3650,2302,3793,3794) \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 17:51:27',4,'2023-03-30 18:03:56',4,0,NULL,NULL,NULL,'36e8a6f3-f70c-4d36-ab76-87fba12b426b'),(1990,'exMiner_notEvaluated','Ex miner not evaluated','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n exMiner_notEvaluated\n Ex miner not evaluated\n \n 2023-03-30 15:53:42 UTC\n \n 2023-03-30 16:13:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1990\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3668 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2302,1068,2242,3650,3793,3794) \n and b.voided = 0 \n ) \n\n','2023-03-30 17:53:42',4,'2023-03-30 18:13:01',4,0,NULL,NULL,NULL,'af666d60-a3d1-4f0f-8ac2-1ea8fddbf8cd'),(1991,'FactoryWorker_notEvaluated','Factory worker not evaluated ','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n FactoryWorker_notEvaluated\n Factory worker not evaluated \n \n 2023-03-30 16:17:17 UTC\n \n 2023-03-30 16:18:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1991\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3669 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2302,1068,2242,3650,3793,3794) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:17:17',4,'2023-03-30 18:18:05',4,0,NULL,NULL,NULL,'83566c8a-550c-447e-9745-0df04c89de07'),(1992,'FactoryWorker_curred','Factory worker curred','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n FactoryWorker_curred\n Factory worker curred\n \n 2023-03-30 16:18:46 UTC\n \n 2023-03-30 16:19:13 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1992\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3669 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (1068) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:18:46',4,'2023-03-30 18:19:13',4,0,NULL,NULL,NULL,'40dd9f46-8d30-4426-bffd-0eb772046374'),(1993,'All TB HIV Pos and Completed ','All TB HIV Pos and Completed ','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Pos and Completed \n All TB HIV Pos and Completed \n \n 2023-03-30 16:19:51 UTC\n \n 2023-03-30 16:20:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1993\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All HIV Positives \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 4666 and o.value_coded in (4323,4664) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 2242 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:19:51',4,'2023-03-30 18:20:08',4,0,NULL,NULL,NULL,'6b7c8fdf-00e6-4f52-b0fe-fab2cd9cc15e'),(1994,'FactoryWorker_completed','Factory worker copleted','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n FactoryWorker_completed\n Factory worker copleted\n \n 2023-03-30 16:19:51 UTC\n \n 2023-03-30 16:20:13 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1994\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3669 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2242) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:19:51',4,'2023-03-30 18:20:13',4,0,NULL,NULL,NULL,'4fb972d7-5378-4413-8faf-e9dfc9454cd6'),(1995,'All TB HIV Pos and Cured','All TB HIV Pos and Cured','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Pos and Cured\n All TB HIV Pos and Cured\n \n 2023-03-30 16:20:26 UTC\n \n 2023-03-30 16:20:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1995\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All HIV Positives \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 4666 and o.value_coded in (4323,4664) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 1068 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:20:26',4,'2023-03-30 18:20:55',4,0,NULL,NULL,NULL,'5bd61f52-4224-4de9-82cd-2c6334f665b1'),(1996,'FactoryWorker_died','Factory worker died','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n FactoryWorker_died\n Factory worker died\n \n 2023-03-30 16:21:09 UTC\n \n 2023-03-30 16:21:24 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1996\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3669 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3650) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:21:09',4,'2023-03-30 18:21:24',4,0,NULL,NULL,NULL,'f4cf99eb-4bb4-45c0-a403-086fd4b51c44'),(1997,'All TB HIV Pos and Died','All TB HIV Pos and Died','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Pos and Died\n All TB HIV Pos and Died\n \n 2023-03-30 16:21:20 UTC\n \n 2023-03-30 16:21:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1997\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All HIV Positives \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 4666 and o.value_coded in (4323,4664) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3650 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:21:20',4,'2023-03-30 18:21:50',4,0,NULL,NULL,NULL,'b41362c1-57e7-48a0-99ed-a6241cd9fb3d'),(1998,'FactoryWorker_lost','Factort worker lost to follow up','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n FactoryWorker_lost\n Factort worker lost to follow up\n \n 2023-03-30 16:22:18 UTC\n \n 2023-03-30 16:22:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1998\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3669 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2302) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:22:18',4,'2023-03-30 18:22:39',4,0,NULL,NULL,NULL,'f915f74e-1e06-4639-9070-6d1fa301b432'),(1999,'All TB HIV Pos and Lost to Follow up','All TB HIV Pos and Lost to Follow up','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Pos and Lost to Follow up\n All TB HIV Pos and Lost to Follow up\n \n 2023-03-30 16:22:31 UTC\n \n 2023-03-30 16:22:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1999\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All HIV Positives \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 4666 and o.value_coded in (4323,4664) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 2302 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:22:31',4,'2023-03-30 18:22:58',4,0,NULL,NULL,NULL,'16efd94d-da75-4a5c-8ca9-6364f2fc8396'),(2000,'All TB HIV Pos and Failed (Susceptible)','All TB HIV Pos and Failed (Susceptible)','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Pos and Failed (Susceptible)\n All TB HIV Pos and Failed (Susceptible)\n \n 2023-03-30 16:23:33 UTC\n \n 2023-03-30 16:24:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2000\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All HIV Positives \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 4666 and o.value_coded in (4323,4664) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3793 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:23:33',4,'2023-03-30 18:24:00',4,0,NULL,NULL,NULL,'4dc42500-c285-4548-92ff-842d1b357342'),(2001,'prison_worker_lost','Prison worker lost','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n prison_worker_lost\n Prison worker lost\n \n 2023-03-30 16:24:03 UTC\n \n 2023-03-30 16:24:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2001\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3779 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2302) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:24:03',4,'2023-03-30 18:24:36',4,0,NULL,NULL,NULL,'624478ae-cc98-4b93-b138-4e619755b41a'),(2002,'All TB HIV Pos and Not Evaluated','All TB HIV Pos and Not Evaluated','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Pos and Not Evaluated\n All TB HIV Pos and Not Evaluated\n \n 2023-03-30 16:24:48 UTC\n \n 2023-03-30 16:26:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2002\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All HIV Positives \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 4666 and o.value_coded in (4323,4664) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id not in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded in (1068,2242,3650,2302,3793,3794) \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:24:48',4,'2023-03-30 18:26:26',4,0,NULL,NULL,NULL,'4fe00951-413a-468e-ac7e-016dcf41bed6'),(2003,'FactoryWorker_moved','Facotory worker moved to second line','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n FactoryWorker_moved\n Facotory worker moved to second line\n \n 2023-03-30 16:26:31 UTC\n \n 2023-03-30 16:34:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2003\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3669 \n and ob.voided = 0 \n ) \n and o.person_id in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3794) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:26:31',4,'2023-03-30 18:34:39',4,0,NULL,NULL,NULL,'1a7a972b-4113-414d-8810-46c8df8137e7'),(2004,'All TB HIV Pos and Moved to Secondline','All TB HIV Pos and Moved to Secondline','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Pos and Moved to Secondline\n All TB HIV Pos and Moved to Secondline\n \n 2023-03-30 16:27:16 UTC\n \n 2023-03-30 16:27:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2004\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All HIV Positives \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 4666 and o.value_coded in (4323,4664) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3794 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:27:16',4,'2023-03-30 18:27:43',4,0,NULL,NULL,NULL,'57ddf49d-b53d-48ce-a67d-3ce6398f3e2c'),(2005,'All TB HIV Neg and Completed','All TB HIV Neg and Completed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Neg and Completed\n All TB HIV Neg and Completed\n \n 2023-03-30 16:29:02 UTC\n \n 2023-03-30 16:30:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2005\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All HIV Negatives \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 4666 and o.value_coded in (4324,4665) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 2242 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:29:02',4,'2023-03-30 18:30:27',4,0,NULL,NULL,NULL,'63a92814-2f34-4018-b7d0-47659892369d'),(2006,'All TB HIV Neg and Cured','All TB HIV Neg and Cured','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Neg and Cured\n All TB HIV Neg and Cured\n \n 2023-03-30 16:30:51 UTC\n \n 2023-03-30 16:31:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2006\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All HIV Negatives \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 4666 and o.value_coded in (4324,4665) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 1068 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:30:51',4,'2023-03-30 18:31:17',4,0,NULL,NULL,NULL,'8e552272-4654-43bb-b1af-20affab2de14'),(2007,'All TB HIV Neg and Died','All TB HIV Neg and Died','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Neg and Died\n All TB HIV Neg and Died\n \n 2023-03-30 16:31:44 UTC\n \n 2023-03-30 16:32:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2007\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All HIV Negatives \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 4666 and o.value_coded in (4324,4665) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3650 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:31:44',4,'2023-03-30 18:32:11',4,0,NULL,NULL,NULL,'3463adc8-19aa-4cc0-9daf-32ea09e0c1f0'),(2008,'All TB HIV Neg and Lost to Follow up','All TB HIV Neg and Lost to Follow up','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Neg and Lost to Follow up\n All TB HIV Neg and Lost to Follow up\n \n 2023-03-30 16:32:59 UTC\n \n 2023-03-30 16:33:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2008\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All HIV Negatives \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 4666 and o.value_coded in (4324,4665) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 2302 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:32:59',4,'2023-03-30 18:33:27',4,0,NULL,NULL,NULL,'06a5ff53-1949-444e-80b5-f4c99b38d5b1'),(2009,'All TB HIV Neg and Failed (Susceptible)','All TB HIV Neg and Failed (Susceptible)','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Neg and Failed (Susceptible)\n All TB HIV Neg and Failed (Susceptible)\n \n 2023-03-30 16:34:17 UTC\n \n 2023-03-30 16:35:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2009\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All HIV Negatives \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 4666 and o.value_coded in (4324,4665) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3793 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:34:17',4,'2023-03-30 18:35:01',4,0,NULL,NULL,NULL,'2ac7e18e-061b-4b34-bb63-63a2ec622a2b'),(2010,'All TB HIV Neg and Not Evaluated','All TB HIV Neg and Not Evaluated','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Neg and Not Evaluated\n All TB HIV Neg and Not Evaluated\n \n 2023-03-30 16:35:36 UTC\n \n 2023-03-30 16:37:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2010\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All HIV Negatives \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 4666 and o.value_coded in (4324,4665) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id not in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded in (1068,2242,3650,2302,3793,3794) \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:35:36',4,'2023-03-30 18:37:02',4,0,NULL,NULL,NULL,'c78c5a10-a320-43ce-b943-f9286e22ad1e'),(2011,'prison_worker_moved','Prison worker moved to second line','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n prison_worker_moved\n Prison worker moved to second line\n \n 2023-03-30 16:35:49 UTC\n \n 2023-03-30 16:36:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2011\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3779 \n and ob.voided = 0 \n ) \n and o.person_id in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3794) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:35:49',4,'2023-03-30 18:36:29',4,0,NULL,NULL,NULL,'76d5be40-a7e3-4f4f-968a-0346d0bd6513'),(2012,'prison_worker_died','Prison worker died','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n prison_worker_died\n Prison worker died\n \n 2023-03-30 16:37:07 UTC\n \n 2023-03-30 16:37:38 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2012\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3776 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3650) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:37:07',4,'2023-03-30 18:37:38',4,0,NULL,NULL,NULL,'c9a54e7c-34d1-4a1b-9214-0b9fa6eb6976'),(2013,'All TB HIV Neg and Moved to Secondline Treatment','All TB HIV Neg and Moved to Secondline Treatment','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Neg and Moved to Secondline Treatment\n All TB HIV Neg and Moved to Secondline Treatment\n \n 2023-03-30 16:37:41 UTC\n \n 2023-03-30 16:38:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2013\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All HIV Negatives \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 4666 and o.value_coded in (4324,4665) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3794 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:37:41',4,'2023-03-30 18:38:53',4,0,NULL,NULL,NULL,'2de9ce1c-6a79-43fe-ab19-1b9c9d2865d4'),(2014,'prison_worker_completed','Prison worker completed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n prison_worker_completed\n Prison worker completed\n \n 2023-03-30 16:38:29 UTC\n \n 2023-03-30 16:38:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2014\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3776 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2242) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:38:29',4,'2023-03-30 18:38:53',4,0,NULL,NULL,NULL,'9e174142-2794-43fc-95dd-9f3f92e4b379'),(2015,'prison_worker_curred','Prion worker curred','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n prison_worker_curred\n Prion worker curred\n \n 2023-03-30 16:40:22 UTC\n \n 2023-03-30 16:43:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2015\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3776 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (1068) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:40:22',4,'2023-03-30 18:43:23',4,0,NULL,NULL,NULL,'91f85b53-7dca-4730-a391-5198293d1cf9'),(2016,'All Childred and Completed','All Childred and Completed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All Childred and Completed\n All Childred and Completed\n \n 2023-03-30 16:43:19 UTC\n \n 2023-03-30 16:46:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2016\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All Children \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) < 15 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 2242 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:43:19',4,'2023-03-30 18:46:26',4,0,NULL,NULL,NULL,'f300ef4e-70b5-4c81-b993-7d45d23f299e'),(2017,'prison_worker_notEvaluated','Prison worker not evaluated','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n prison_worker_notEvaluated\n Prison worker not evaluated\n \n 2023-03-30 16:46:21 UTC\n \n 2023-03-30 16:46:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2017\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3776 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2302,1068,2242,3650,3793,3794) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:46:21',4,'2023-03-30 18:46:41',4,0,NULL,NULL,NULL,'1c0c7eab-e438-4787-982a-bfb448fe7455'),(2018,'All Childred and Cured','All Childred and Cured','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All Childred and Cured\n All Childred and Cured\n \n 2023-03-30 16:46:51 UTC\n \n 2023-03-30 16:47:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2018\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All Children \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) < 15 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 1068 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:46:51',4,'2023-03-30 18:47:08',4,0,NULL,NULL,NULL,'1f8f36b9-85d6-4e32-b078-6c7e098974b1'),(2019,'All Childred and Died','All Childred and Died','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All Childred and Died\n All Childred and Died\n \n 2023-03-30 16:47:31 UTC\n \n 2023-03-30 16:48:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2019\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All Children \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) < 15 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3650 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:47:31',4,'2023-03-30 18:48:00',4,0,NULL,NULL,NULL,'dd4822a7-86eb-4579-acda-bf0ff242eef5'),(2020,'health_worker_notEvaluated','Health worker not evaluated','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n health_worker_notEvaluated\n Health worker not evaluated\n \n 2023-03-30 16:47:35 UTC\n \n 2023-03-30 16:48:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2020\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3667 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2302,1068,2242,3650,3793,3794) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:47:35',4,'2023-03-30 18:48:03',4,0,NULL,NULL,NULL,'5d8bdedf-fc1e-46f8-b417-908519f3e645'),(2021,'All Childred and Lost to Follow up','All Childred and Lost to Follow up','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All Childred and Lost to Follow up\n All Childred and Lost to Follow up\n \n 2023-03-30 16:48:38 UTC\n \n 2023-03-30 16:49:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2021\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All Children \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) < 15 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 2302 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:48:38',4,'2023-03-30 18:49:04',4,0,NULL,NULL,NULL,'2665ef1b-edbd-4c9d-b9f6-3d2d2cc3b0ad'),(2022,'health_worker_curred','Health worker curred','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n health_worker_curred\n Health worker curred\n \n 2023-03-30 16:48:53 UTC\n \n 2023-03-30 16:49:19 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2022\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3667 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (1068) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:48:53',4,'2023-03-30 18:49:19',4,0,NULL,NULL,NULL,'63064b04-2cce-4944-b53d-ddb2cdce8a2d'),(2023,'All Childred and Failed (Susceptible)','All Childred and Failed (Susceptible)','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All Childred and Failed (Susceptible)\n All Childred and Failed (Susceptible)\n \n 2023-03-30 16:49:34 UTC\n \n 2023-03-30 16:50:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2023\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All Children \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) < 15 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3793 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:49:34',4,'2023-03-30 18:50:01',4,0,NULL,NULL,NULL,'1b710ad4-75b5-4b64-b916-1806dca0013d'),(2024,'health_worker_completed','Health worker completed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n health_worker_completed\n Health worker completed\n \n 2023-03-30 16:49:56 UTC\n \n 2023-04-03 20:37:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2024\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3667 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2242) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:49:56',4,'2023-04-03 22:37:45',4,0,NULL,NULL,NULL,'6555808c-1103-4a6d-b13f-fd0fad7ff09f'),(2025,'All Childred and Not evaluated','All Childred and Not evaluated','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All Childred and Not evaluated\n All Childred and Not evaluated\n \n 2023-03-30 16:50:30 UTC\n \n 2023-03-30 16:51:54 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2025\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All Children \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) < 15 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id not in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded in (1068,2242,3650,2302,3794,3793) \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:50:30',4,'2023-03-30 18:51:54',4,0,NULL,NULL,NULL,'1b9b16cf-f254-43b5-b952-4d54f431ae49'),(2026,'health_worker_died','Healh worker died','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n health_worker_died\n Healh worker died\n \n 2023-03-30 16:50:46 UTC\n \n 2023-03-30 16:51:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2026\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3667 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3650) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:50:46',4,'2023-03-30 18:51:00',4,0,NULL,NULL,NULL,'e9c9f85f-123c-4b2f-9951-7b8c2be340af'),(2027,'health_worker_lost','Health worker lost','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n health_worker_lost\n Health worker lost\n \n 2023-03-30 16:51:39 UTC\n \n 2023-03-30 16:51:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2027\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3667 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2302) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:51:39',4,'2023-03-30 18:51:55',4,0,NULL,NULL,NULL,'8b70ced1-8219-4206-b7ec-10c0242808c4'),(2028,'All Childred and Moved to Secondline Treatment','All Childred and Moved to Secondline Treatment','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All Childred and Moved to Secondline Treatment\n All Childred and Moved to Secondline Treatment\n \n 2023-03-30 16:52:27 UTC\n \n 2023-03-30 16:53:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2028\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All Children \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) < 15 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3794 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:52:27',4,'2023-03-30 18:53:11',4,0,NULL,NULL,NULL,'143c95e1-ae28-460c-92c2-3807e30dc704'),(2029,'health_worker_moved','Health worker moved to second line','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n health_worker_moved\n Health worker moved to second line\n \n 2023-03-30 16:52:49 UTC\n \n 2023-03-30 16:55:13 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2029\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3667 \n and ob.voided = 0 \n ) \n and o.person_id in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3794) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:52:49',4,'2023-03-30 18:55:13',4,0,NULL,NULL,NULL,'3a04d202-b320-463e-a233-40887022bfea'),(2030,'All TB Adolescent (10-19 yrs) and Completed ','All TB Adolescent (10-19 yrs) and Completed ','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Adolescent (10-19 yrs) and Completed \n All TB Adolescent (10-19 yrs) and Completed \n \n 2023-03-30 16:55:50 UTC\n \n 2023-03-30 16:56:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2030\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All Adolescent (10-19 yrs) \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) < 20 \n and floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) > 9 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 2242 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:55:50',4,'2023-03-30 18:56:27',4,0,NULL,NULL,NULL,'788061f8-b372-4d67-b493-c20b96b948bf'),(2031,'public_transport_Moved','Public Transport move to second line','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n public_transport_Moved\n Public Transport move to second line\n \n 2023-03-30 16:55:50 UTC\n \n 2023-03-30 16:56:22 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2031\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 4654 \n and ob.voided = 0 \n ) \n and o.person_id in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3794) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:55:50',4,'2023-03-30 18:56:22',4,0,NULL,NULL,NULL,'c2e7a54e-80e6-4535-a09f-32d93e8ce902'),(2032,'All TB Adolescent (10-19 yrs) and cured','All TB Adolescent (10-19 yrs) and cured','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Adolescent (10-19 yrs) and cured\n All TB Adolescent (10-19 yrs) and cured\n \n 2023-03-30 16:56:54 UTC\n \n 2023-03-30 16:57:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2032\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All Adolescent (10-19 yrs) \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) < 20 \n and floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) > 9 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 1068 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:56:54',4,'2023-03-30 18:57:31',4,0,NULL,NULL,NULL,'e620cd1b-bbe2-4c3d-93bb-fcbdc8b34d84'),(2033,'public_transport_lost','Public transport Lost','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n public_transport_lost\n Public transport Lost\n \n 2023-03-30 16:57:13 UTC\n \n 2023-03-30 16:57:37 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2033\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 4654 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2302) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:57:13',4,'2023-03-30 18:57:37',4,0,NULL,NULL,NULL,'0cc2e2d8-4cab-45c7-9b04-67c8bfd1bbfa'),(2034,'All TB Adolescent (10-19 yrs) and Died','All TB Adolescent (10-19 yrs) and Died','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Adolescent (10-19 yrs) and Died\n All TB Adolescent (10-19 yrs) and Died\n \n 2023-03-30 16:57:52 UTC\n \n 2023-03-30 16:58:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2034\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All Adolescent (10-19 yrs) \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) < 20 \n and floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) > 9 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3650 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:57:52',4,'2023-03-30 18:58:21',4,0,NULL,NULL,NULL,'53ef1628-fe11-4b21-bab5-897e27196e04'),(2035,'public_transport_died','Public transport died','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n public_transport_died\n Public transport died\n \n 2023-03-30 16:58:17 UTC\n \n 2023-03-30 16:58:34 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2035\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 4654 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3650) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:58:17',4,'2023-03-30 18:58:34',4,0,NULL,NULL,NULL,'bbc25dd6-f8ff-4c55-84e8-efd76d0ac281'),(2036,'All TB Adolescent (10-19 yrs) and Lost to Follow up','All TB Adolescent (10-19 yrs) and Lost to Follow up','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Adolescent (10-19 yrs) and Lost to Follow up\n All TB Adolescent (10-19 yrs) and Lost to Follow up\n \n 2023-03-30 16:58:49 UTC\n \n 2023-03-30 16:59:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2036\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All Adolescent (10-19 yrs) \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) < 20 \n and floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) > 9 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 2302 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:58:49',4,'2023-03-30 18:59:12',4,0,NULL,NULL,NULL,'509944d6-5988-405c-8aee-8a9329e1e141'),(2037,'public_transport_completed','Public transport completed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n public_transport_completed\n Public transport completed\n \n 2023-03-30 16:59:27 UTC\n \n 2023-03-30 17:00:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2037\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 4654 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2242) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:59:27',4,'2023-03-30 19:00:28',4,0,NULL,NULL,NULL,'d9a7884a-eabd-43cc-9757-64ae74a3cb9c'),(2038,'All TB Adolescent (10-19 yrs) and Failed (Susceptible)','All TB Adolescent (10-19 yrs) and Failed (Susceptible)','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Adolescent (10-19 yrs) and Failed (Susceptible)\n All TB Adolescent (10-19 yrs) and Failed (Susceptible)\n \n 2023-03-30 16:59:52 UTC\n \n 2023-03-30 17:00:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2038\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All Adolescent (10-19 yrs) \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) < 20 \n and floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) > 9 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3793 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:59:52',4,'2023-03-30 19:00:27',4,0,NULL,NULL,NULL,'dd3ac915-529a-44c4-b086-fe9e21bc7553'),(2039,'All TB Adolescent (10-19 yrs) and Moved to Secondline treatment','All TB Adolescent (10-19 yrs) and Moved to Secondline treatment','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Adolescent (10-19 yrs) and Moved to Secondline treatment\n All TB Adolescent (10-19 yrs) and Moved to Secondline treatment\n \n 2023-03-30 17:01:19 UTC\n \n 2023-03-30 17:01:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2039\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All Adolescent (10-19 yrs) \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) < 20 \n and floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) > 9 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3794 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 19:01:19',4,'2023-03-30 19:01:41',4,0,NULL,NULL,NULL,'216e1e3c-eed7-4802-96bb-fe3256161a08'),(2040,'public_transport_curred','Public transport curred','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n public_transport_curred\n Public transport curred\n \n 2023-03-30 17:01:20 UTC\n \n 2023-03-30 17:01:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2040\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 4654 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (1068) \n and b.voided = 0 \n ) \n\n','2023-03-30 19:01:20',4,'2023-03-30 19:01:41',4,0,NULL,NULL,NULL,'faf660cd-1ef3-48a9-86d5-805f14b23465'),(2041,'All TB Adolescent (10-19 yrs) and Not Evaluated','All TB Adolescent (10-19 yrs) and Not Evaluated','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Adolescent (10-19 yrs) and Not Evaluated\n All TB Adolescent (10-19 yrs) and Not Evaluated\n \n 2023-03-30 17:02:10 UTC\n \n 2023-03-30 17:03:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2041\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All Adolescent (10-19 yrs) \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) < 20 \n and floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) > 9 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id not in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded in (1068,2242,3650,2302,3794,3793) \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 19:02:10',4,'2023-03-30 19:03:44',4,0,NULL,NULL,NULL,'8fcd3cec-a879-4240-888f-42575228b47d'); +INSERT INTO `serialized_object` VALUES (2042,'public_transport_notEvaluated','Public transport note evaluated','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n public_transport_notEvaluated\n Public transport note evaluated\n \n 2023-03-30 17:02:53 UTC\n \n 2023-03-30 17:03:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2042\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 4654 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2302,1068,2242,3650,3793,3794) \n and b.voided = 0 \n ) \n\n','2023-03-30 19:02:53',4,'2023-03-30 19:03:45',4,0,NULL,NULL,NULL,'7037beac-7eba-4b7f-a3b7-6636d1d435bd'),(2043,'TB Females and Completed','TB Females and Completed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Females and Completed\n TB Females and Completed\n \n 2023-03-30 17:07:55 UTC\n \n 2023-03-30 17:08:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2043\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- Female \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where person.gender = 'F' \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 2242 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 19:07:55',4,'2023-03-30 19:08:14',4,0,NULL,NULL,NULL,'82abec75-7c2a-4607-b3b1-b3ef5c6c4361'),(2044,'TB Females and Cured','TB Females and Cured','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Females and Cured\n TB Females and Cured\n \n 2023-03-30 17:08:50 UTC\n \n 2023-03-30 17:09:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2044\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- Female \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where person.gender = 'F' \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 1068 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 19:08:50',4,'2023-03-30 19:09:12',4,0,NULL,NULL,NULL,'f746ec4b-a949-4b53-86c8-4e1a71843d72'),(2045,'HHCM_notEvaluated','HHCM Note Evaluated','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM_notEvaluated\n HHCM Note Evaluated\n \n 2023-03-30 17:09:07 UTC\n \n 2023-03-30 17:09:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2045\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3777 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2302,1068,2242,3650,3793,3794) \n and b.voided = 0 \n ) \n\n','2023-03-30 19:09:07',4,'2023-03-30 19:09:44',4,0,NULL,NULL,NULL,'d8caa7dd-326a-46f7-97ee-f7205689bfda'),(2046,'HHCM_curred','HHCM Curred','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM_curred\n HHCM Curred\n \n 2023-03-30 17:10:16 UTC\n \n 2023-03-30 17:10:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2046\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3777 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (1068) \n and b.voided = 0 \n ) \n\n','2023-03-30 19:10:16',4,'2023-03-30 19:10:39',4,0,NULL,NULL,NULL,'ea1cc81f-9ccc-4401-80e9-57a84da98f58'),(2047,'TB Females and Died','TB Females and Died','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Females and Died\n TB Females and Died\n \n 2023-03-30 17:11:17 UTC\n \n 2023-03-30 17:11:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2047\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- Female \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where person.gender = 'F' \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3650 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 19:11:17',4,'2023-03-30 19:11:45',4,0,NULL,NULL,NULL,'f55690e5-8b8d-43ce-b797-f0f8707d1222'),(2048,'HHCM_completed','HHCM Completed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM_completed\n HHCM Completed\n \n 2023-03-30 17:12:02 UTC\n \n 2023-03-30 17:12:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2048\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3777 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2242) \n and b.voided = 0 \n ) \n\n','2023-03-30 19:12:02',4,'2023-03-30 19:12:21',4,0,NULL,NULL,NULL,'7dbf3689-913d-4883-ae4b-5be2aee4ba37'),(2049,'TB Females and Lost to Follow up','TB Females and Lost to Follow up','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Females and Lost to Follow up\n TB Females and Lost to Follow up\n \n 2023-03-30 17:12:17 UTC\n \n 2023-03-30 17:13:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2049\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- Female \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where person.gender = 'F' \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 2302 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 19:12:17',4,'2023-03-30 19:13:14',4,0,NULL,NULL,NULL,'71a12f10-af92-4eba-88f2-176a2cb3ae14'),(2050,'HHCM_died','HHCM Died','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM_died\n HHCM Died\n \n 2023-03-30 17:12:43 UTC\n \n 2023-03-30 17:13:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2050\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3777 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3650) \n and b.voided = 0 \n ) \n\n','2023-03-30 19:12:43',4,'2023-03-30 19:13:08',4,0,NULL,NULL,NULL,'87c6de2e-d87a-430b-a15e-d5de45e36410'),(2051,'HHCM_lost','HHCM Lost','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM_lost\n HHCM Lost\n \n 2023-03-30 17:13:35 UTC\n \n 2023-03-30 17:14:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2051\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3777 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2302) \n and b.voided = 0 \n ) \n\n','2023-03-30 19:13:35',4,'2023-03-30 19:14:00',4,0,NULL,NULL,NULL,'543f25df-61ec-4cec-847f-816fec3268ec'),(2052,'TB Females and Failed (Susceptible)','TB Females and Failed (Susceptible)','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Females and Failed (Susceptible)\n TB Females and Failed (Susceptible)\n \n 2023-03-30 17:14:08 UTC\n \n 2023-03-30 17:14:24 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2052\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- Female \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where person.gender = 'F' \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3793 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 19:14:08',4,'2023-03-30 19:14:24',4,0,NULL,NULL,NULL,'d1085653-8aca-440b-ae5c-d899217ef3b5'),(2053,'HHCM_moved','HHCM Moved','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM_moved\n HHCM Moved\n \n 2023-03-30 17:14:34 UTC\n \n 2023-03-30 17:14:52 UTC\n \n \n endDate\n \n java.util.Date\n true\n \n \n startDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2053\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3777 \n and ob.voided = 0 \n ) \n and o.person_id in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3794) \n and b.voided = 0 \n ) \n\n','2023-03-30 19:14:34',4,'2023-03-30 19:14:52',4,0,NULL,NULL,NULL,'43bc5260-c525-4968-a427-01e7febdfef1'),(2054,'TB Females and Moved to SecondLine','TB Females and Moved to SecondLine','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Females and Moved to SecondLine\n TB Females and Moved to SecondLine\n \n 2023-03-30 17:14:53 UTC\n \n 2023-03-30 17:15:09 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2054\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- Female \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where person.gender = 'F' \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3794 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 19:14:53',4,'2023-03-30 19:15:09',4,0,NULL,NULL,NULL,'56836385-8ef8-49a4-bdc7-e7ac24baadb9'),(2055,'TB Females and Not Evaluated','TB Females and Not Evaluated','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Females and Not Evaluated\n TB Females and Not Evaluated\n \n 2023-03-30 17:15:40 UTC\n \n 2023-03-30 17:16:46 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2055\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- Female \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where person.gender = 'F' \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id not in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded in (1068,2242,3650,2302,3793,3794) \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 19:15:40',4,'2023-03-30 19:16:46',4,0,NULL,NULL,NULL,'d1ccfc19-7910-4d71-8ba4-1b31cfbc17b7'),(2056,'FactoryWorker_failed','Factory worker failed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n FactoryWorker_failed\n Factory worker failed\n \n 2023-04-03 07:36:11 UTC\n \n 2023-04-03 07:53:38 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2056\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3669 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3793) \n and b.voided = 0 \n ) \n\n','2023-04-03 09:36:11',4,'2023-04-03 09:53:38',4,0,NULL,NULL,NULL,'43e35844-a8eb-4cc5-a3cd-445a052316c2'),(2057,'prison_worker_failed','Prison worker failed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n prison_worker_failed\n Prison worker failed\n \n 2023-04-03 07:55:07 UTC\n \n 2023-04-03 07:56:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2057\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3779 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3793) \n and b.voided = 0 \n ) \n\n','2023-04-03 09:55:07',4,'2023-04-03 09:56:27',4,0,NULL,NULL,NULL,'a4dd9267-3676-4a8b-b56b-65b8683f1ba6'),(2058,'health_worker_failed','Health Worker Failed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n health_worker_failed\n Health Worker Failed\n \n 2023-04-03 07:57:33 UTC\n \n 2023-04-03 07:58:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2058\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3670 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3793) \n and b.voided = 0 \n ) \n\n','2023-04-03 09:57:33',4,'2023-04-03 09:58:07',4,0,NULL,NULL,NULL,'da9db0e3-0d78-489c-bd35-eb7c68e345d0'),(2059,'public_transport_failed','Public Transport Failed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n public_transport_failed\n Public Transport Failed\n \n 2023-04-03 07:58:45 UTC\n \n 2023-04-03 07:59:38 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2059\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 4654 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3793) \n and b.voided = 0 \n ) \n\n','2023-04-03 09:58:45',4,'2023-04-03 09:59:38',4,0,NULL,NULL,NULL,'33f5b01b-0001-4fbd-8d76-43b6616c4824'),(2060,'HHCM_failed','HHCM Failed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM_failed\n HHCM Failed\n \n 2023-04-03 09:18:29 UTC\n \n 2023-04-03 09:19:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2060\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3777 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3793) \n and b.voided = 0 \n ) \n\n','2023-04-03 11:18:29',4,'2023-04-03 11:19:51',4,0,NULL,NULL,NULL,'60d6cef7-079a-4825-b6e1-cb4eb655b864'),(2061,'Mine Workers Cured','Mine Workers Cured','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Mine Workers Cured\n Mine Workers Cured\n \n 2023-04-03 09:18:52 UTC\n \n 2023-04-04 12:32:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2061\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- Mine Worker \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3776 and o.value_coded = 3667 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 1068 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-04-03 11:18:52',4,'2023-04-04 14:32:36',4,0,NULL,NULL,NULL,'9fffbcb9-e2f8-43d2-b6ae-b257c80ff52c'),(2062,'Mine Workers Completed','Mine Workers Completed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Mine Workers Completed\n Mine Workers Completed\n \n 2023-04-03 09:20:24 UTC\n \n 2023-04-04 12:31:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2062\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- Mine Worker \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3776 and o.value_coded = 3667 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 2242 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-04-03 11:20:24',4,'2023-04-04 14:31:40',4,0,NULL,NULL,NULL,'22a95602-7db7-453f-8af1-d3314651365b'),(2063,'HHXM_completed','HHXM Completed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM_completed\n HHXM Completed\n \n 2023-04-03 09:20:26 UTC\n \n 2023-04-03 09:21:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2063\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3778 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2242) \n and b.voided = 0 \n ) \n\n','2023-04-03 11:20:26',4,'2023-04-03 11:21:05',4,0,NULL,NULL,NULL,'bc440ff8-a03c-42b4-b082-393873e19cc5'),(2064,'HHXM_failed','HHXM Failed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM_failed\n HHXM Failed\n \n 2023-04-03 09:21:50 UTC\n \n 2023-04-03 22:08:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2064\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3778 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3793) \n and b.voided = 0 \n ) \n\n','2023-04-03 11:21:50',4,'2023-04-04 00:08:02',4,0,NULL,NULL,NULL,'168f05ac-dc2e-4c53-a38b-0d1ac6bc3f4c'),(2065,'Mine Workers Died','Mine Workers Died','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Mine Workers Died\n Mine Workers Died\n \n 2023-04-03 09:22:05 UTC\n \n 2023-04-04 12:33:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2065\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- Mine Worker \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3776 and o.value_coded = 3667 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3650 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-04-03 11:22:05',4,'2023-04-04 14:33:00',4,0,NULL,NULL,NULL,'75e3ca1f-9e04-4d1c-91ae-f79f18f650ee'),(2066,'HHXM_cured','HHXM Curred\r\n','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM_cured\n HHXM Curred \n\n \n 2023-04-03 09:22:14 UTC\n \n 2023-04-03 09:22:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2066\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3778 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (1068) \n and b.voided = 0 \n ) \n\n','2023-04-03 11:22:14',4,'2023-04-03 11:22:50',4,0,NULL,NULL,NULL,'1895c8dd-bf2c-4bd3-a48f-08770e349ffe'),(2067,'HHXM_moved','HHXM Moved','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM_moved\n HHXM Moved\n \n 2023-04-03 09:24:40 UTC\n \n 2023-04-03 09:27:22 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2067\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3778 \n and ob.voided = 0 \n ) \n and o.person_id in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3794) \n and b.voided = 0 \n ) \n\n','2023-04-03 11:24:40',4,'2023-04-03 11:27:22',4,0,NULL,NULL,NULL,'458408ac-2fc6-45e2-a884-8b8a75cf1d94'),(2068,'HHXM_lost','HHXM Lost','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM_lost\n HHXM Lost\n \n 2023-04-03 09:26:54 UTC\n \n 2023-04-03 09:27:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2068\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3778 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2302) \n and b.voided = 0 \n ) \n\n','2023-04-03 11:26:54',4,'2023-04-03 11:27:10',4,0,NULL,NULL,NULL,'20694047-0786-4ce8-922b-df3b23f39c56'),(2069,'Mine Workers Lost to Follow up','Mine Workers Lost to Follow up','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Mine Workers Lost to Follow up\n Mine Workers Lost to Follow up\n \n 2023-04-03 09:26:54 UTC\n \n 2023-04-04 12:33:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2069\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- Mine Worker \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3776 and o.value_coded = 3667 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 2302 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-04-03 11:26:54',4,'2023-04-04 14:33:39',4,0,NULL,NULL,NULL,'9406df9e-8673-48f0-81eb-21b60a5ded97'),(2070,'hhxm_notEvaluated','HHXm Not Evaluated','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n hhxm_notEvaluated\n HHXm Not Evaluated\n \n 2023-04-03 09:28:30 UTC\n \n 2023-04-03 09:29:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2070\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3778 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2302,1068,2242,3650,3793,3794) \n and b.voided = 0 \n ) \n\n','2023-04-03 11:28:30',4,'2023-04-03 11:29:51',4,0,NULL,NULL,NULL,'0bd16759-6ff9-4cbf-a0b0-8e9fd1efd1be'),(2071,'Mine Workers Failed (Susceptible)','Mine Workers Failed (Susceptible)','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Mine Workers Failed (Susceptible)\n Mine Workers Failed (Susceptible)\n \n 2023-04-03 09:33:26 UTC\n \n 2023-04-04 12:33:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2071\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- Mine Worker \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3776 and o.value_coded = 3667 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3793 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-04-03 11:33:26',4,'2023-04-04 14:33:18',4,0,NULL,NULL,NULL,'4bba1fe8-13ad-4c18-b549-f0aff1e6bc3f'),(2072,'hhxm_died','HHXM Died','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n hhxm_died\n HHXM Died\n \n 2023-04-03 09:34:30 UTC\n \n 2023-04-03 10:13:34 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2072\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3778 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3650) \n and b.voided = 0 \n ) \n\n','2023-04-03 11:34:30',4,'2023-04-03 12:13:34',4,0,NULL,NULL,NULL,'173bca27-99d3-497c-b83f-902bd3502875'),(2073,'Mine Workers Moved to Secondline Treatment','Mine Workers Moved to Secondline Treatment','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Mine Workers Moved to Secondline Treatment\n Mine Workers Moved to Secondline Treatment\n \n 2023-04-03 09:36:03 UTC\n \n 2023-04-04 12:29:57 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2073\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- Mine Worker \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3776 and o.value_coded = 3667 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3794 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-04-03 11:36:03',4,'2023-04-04 14:29:57',4,0,NULL,NULL,NULL,'7f349b74-1609-4786-a666-6f26b3e0934c'),(2074,'Mine Workers Not Evaluated','Mine Workers Not Evaluated','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Mine Workers Not Evaluated\n Mine Workers Not Evaluated\n \n 2023-04-03 09:39:03 UTC\n \n 2023-04-03 09:39:38 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2074\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- Mine Worker \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3776 and o.value_coded = 3667 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id not in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded in (1068,2302,3650,3793,2242,3794) \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-04-03 11:39:03',4,'2023-04-03 11:39:38',4,0,NULL,NULL,NULL,'3f20bdd4-03b5-48eb-be2e-3e7d96d9608f'),(2075,'New and Relapse Completed','New and Relapse Completed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n New and Relapse Completed\n New and Relapse Completed\n \n 2023-04-03 09:46:12 UTC\n \n 2023-04-03 09:50:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2075\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 11:46:12',4,'2023-04-03 11:50:04',4,0,NULL,NULL,NULL,'bf8fffec-423b-4d4f-9082-a61937680e08'),(2076,'TB New and Relapse Cured','TB New and Relapse Cured','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB New and Relapse Cured\n TB New and Relapse Cured\n \n 2023-04-03 09:54:54 UTC\n \n 2023-04-03 10:09:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2076\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 11:54:54',4,'2023-04-03 12:09:07',4,0,NULL,NULL,NULL,'cc3e6b66-c906-4723-bf8b-f1e3bd9a4f48'),(2077,'TB New and Relapse Died','TB New and Relapse Died','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB New and Relapse Died\n TB New and Relapse Died\n \n 2023-04-03 10:09:39 UTC\n \n 2023-04-03 10:26:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2077\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 12:09:39',4,'2023-04-03 12:26:07',4,0,NULL,NULL,NULL,'cdd51d3f-4922-459d-a23e-a62718354d0f'),(2078,'TB New and Relapse Lost to Follow-up','TB New and Relapse Lost to Follow-up','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB New and Relapse Lost to Follow-up\n TB New and Relapse Lost to Follow-up\n \n 2023-04-03 10:13:30 UTC\n \n 2023-04-03 10:22:25 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2078\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 12:13:30',4,'2023-04-03 12:22:25',4,0,NULL,NULL,NULL,'e63623be-d56c-4e8a-9fb8-fcbfd651b326'),(2079,'Ex Miner - Died','Ex Miner Died','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Ex Miner - Died\n Ex Miner Died\n \n 2023-04-03 10:15:01 UTC\n \n 2023-04-03 10:18:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2079\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 12:15:01',4,'2023-04-03 12:18:31',4,0,NULL,NULL,NULL,'4c0567b3-bc02-4b62-be5b-4e348a8a17d5'),(2080,'Ex Miner - Lost','Ex Miner Lost','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Ex Miner - Lost\n Ex Miner Lost\n \n 2023-04-03 10:15:38 UTC\n \n 2023-04-03 10:20:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2080\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 12:15:38',4,'2023-04-03 12:20:44',4,0,NULL,NULL,NULL,'1001e669-922a-43ba-be6c-4e909e4d7f30'),(2081,'Ex Miner - Not Evaluated','Ex Miner Not Evaluated','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Ex Miner - Not Evaluated\n Ex Miner Not Evaluated\n \n 2023-04-03 10:16:26 UTC\n \n 2023-04-03 10:25:22 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2081\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 12:16:26',4,'2023-04-03 12:25:22',4,0,NULL,NULL,NULL,'95297d99-247c-4cb1-8454-8cde32e41699'),(2082,'Ex Miner - Completed','Ex Miner - Completed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Ex Miner - Completed\n Ex Miner - Completed\n \n 2023-04-03 10:21:16 UTC\n \n 2023-04-03 10:53:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2082\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 12:21:16',4,'2023-04-03 12:53:45',4,0,NULL,NULL,NULL,'6512f126-9e67-46ba-aaab-e783a36a4efa'),(2083,'Ex Miner - Moved Second Line','Ex Miner moved second line','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Ex Miner - Moved Second Line\n Ex Miner moved second line\n \n 2023-04-03 10:22:16 UTC\n \n 2023-04-03 10:24:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2083\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 12:22:16',4,'2023-04-03 12:24:44',4,0,NULL,NULL,NULL,'7de4354e-95cb-4f66-8d40-0bd243779ee4'),(2084,'TB New and Relapse Failed (Susceptible)','TB New and Relapse Failed (Susceptible)','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB New and Relapse Failed (Susceptible)\n TB New and Relapse Failed (Susceptible)\n \n 2023-04-03 10:26:32 UTC\n \n 2023-04-03 11:24:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2084\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 12:26:32',4,'2023-04-03 13:24:51',4,0,NULL,NULL,NULL,'e3218a64-d243-48aa-9b9a-bbcda0104ae7'),(2085,'Ex Miner - Failed','Ex Miner - Failed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Ex Miner - Failed\n Ex Miner - Failed\n \n 2023-04-03 10:27:35 UTC\n \n 2023-04-03 11:24:34 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2085\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 12:27:35',4,'2023-04-03 13:24:34',4,0,NULL,NULL,NULL,'aa17ed03-51ed-4fde-8ad9-164f975ded80'),(2086,'TB New and Relapse Moved to second line treatment','TB New and Relapse Moved to second line treatment','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB New and Relapse Moved to second line treatment\n TB New and Relapse Moved to second line treatment\n \n 2023-04-03 10:27:42 UTC\n \n 2023-04-03 10:29:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2086\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 12:27:42',4,'2023-04-03 12:29:11',4,0,NULL,NULL,NULL,'687406cb-8ffe-4b7a-a806-583e78f04e48'),(2087,'Ex Miner - Cured','Ex Miner - Cured','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Ex Miner - Cured\n Ex Miner - Cured\n \n 2023-04-03 10:28:42 UTC\n \n 2023-04-04 09:25:16 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2087\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 12:28:42',4,'2023-04-04 11:25:16',4,0,NULL,NULL,NULL,'6210a6de-cdbc-411c-b9fc-e6a6bf2f42bc'),(2088,'Factory Worker - Complete','Factory Worker - Complete','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Factory Worker - Complete\n Factory Worker - Complete\n \n 2023-04-03 11:31:19 UTC\n \n 2023-04-03 11:33:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2088\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 13:31:19',4,'2023-04-03 13:33:02',4,0,NULL,NULL,NULL,'d1ce4f4f-9869-4fdd-afa5-da1899ae3815'),(2089,'Factory Worker - Cured','Factory Worker - Cured','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Factory Worker - Cured\n Factory Worker - Cured\n \n 2023-04-03 11:35:29 UTC\n \n 2023-04-03 11:37:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2089\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 13:35:29',4,'2023-04-03 13:37:51',4,0,NULL,NULL,NULL,'b92fab4d-1381-445b-abb1-1ba06b0957d4'),(2090,'Factory Worker - Died','Factory Worker - Died','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Factory Worker - Died\n Factory Worker - Died\n \n 2023-04-03 11:37:01 UTC\n \n 2023-04-03 11:39:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2090\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 13:37:01',4,'2023-04-03 13:39:08',4,0,NULL,NULL,NULL,'ef65034d-ed9d-452d-af2f-ababeecfa6ad'),(2091,'Factory Worker - Lost','Factory Worker - Lost','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Factory Worker - Lost\n Factory Worker - Lost\n \n 2023-04-03 11:38:56 UTC\n \n 2023-04-03 11:58:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2091\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 13:38:56',4,'2023-04-03 13:58:59',4,0,NULL,NULL,NULL,'a9e56df4-43a7-4387-828d-10c9dfb89245'),(2092,'Factory Worker - Not Evaluated','Factory Worker - Not Evaluated','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Factory Worker - Not Evaluated\n Factory Worker - Not Evaluated\n \n 2023-04-03 11:43:52 UTC\n \n 2023-04-03 11:59:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2092\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 13:43:52',4,'2023-04-03 13:59:10',4,0,NULL,NULL,NULL,'77cd1821-951d-42ed-a866-5f08fd800a9c'),(2093,'TB New and Relapse Not Evaluated','TB New and Relapse Not Evaluated','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB New and Relapse Not Evaluated\n TB New and Relapse Not Evaluated\n \n 2023-04-03 11:45:15 UTC\n \n 2023-04-03 11:52:49 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2093\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 13:45:15',4,'2023-04-03 13:52:49',4,0,NULL,NULL,NULL,'8c3908aa-5ac3-4dc9-9261-cdd7fc07e365'),(2094,'Retreatment excluding Relapse Completed','Retreatment excluding Relapse Completed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Retreatment excluding Relapse Completed\n Retreatment excluding Relapse Completed\n \n 2023-04-03 19:27:03 UTC\n \n 2023-04-04 12:39:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2094\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 21:27:03',4,'2023-04-04 14:39:55',4,0,NULL,NULL,NULL,'f3df3cc6-11ba-4ef1-9b6b-eba700de0818'),(2095,'Factory Worker - Moved to 2nd line','Factory Worker - Moved to 2nd line','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Factory Worker - Moved to 2nd line\n Factory Worker - Moved to 2nd line\n \n 2023-04-03 19:33:19 UTC\n \n 2023-04-03 19:35:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2095\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 21:33:19',4,'2023-04-03 21:35:06',4,0,NULL,NULL,NULL,'9ac7ec7c-6fa1-4771-8cb3-bcfca51f5e4b'),(2096,'Retreatment excluding Relapse Cured','Retreatment excluding Relapse Cured','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Retreatment excluding Relapse Cured\n Retreatment excluding Relapse Cured\n \n 2023-04-03 19:37:22 UTC\n \n 2023-04-03 19:42:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2096\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 21:37:22',4,'2023-04-03 21:42:14',4,0,NULL,NULL,NULL,'af4ccd45-738a-452f-ab0e-aa7588ecd131'),(2097,'Factory Worker - Failed','Factory Worker - Failed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Factory Worker - Failed\n Factory Worker - Failed\n \n 2023-04-03 19:44:52 UTC\n \n 2023-04-03 19:49:24 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2097\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 21:44:52',4,'2023-04-03 21:49:24',4,0,NULL,NULL,NULL,'f353300f-5673-4742-9115-c5b0b7e398e8'),(2098,'Retreatment excluding Relapse Died','Retreatment excluding Relapse Died','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Retreatment excluding Relapse Died\n Retreatment excluding Relapse Died\n \n 2023-04-03 19:48:30 UTC\n \n 2023-04-03 19:51:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2098\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 21:48:30',4,'2023-04-03 21:51:58',4,0,NULL,NULL,NULL,'ae6d7e28-203a-4141-b338-0a2faadc3662'),(2099,'Prison Worker - Died','Prison Worker - Died','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Prison Worker - Died\n Prison Worker - Died\n \n 2023-04-03 19:50:39 UTC\n \n 2023-04-03 19:53:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2099\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 21:50:39',4,'2023-04-03 21:53:44',4,0,NULL,NULL,NULL,'93b06207-6e95-4711-aa58-31c3a88ef1c0'),(2100,'Prison Worker - Cured','Prison Worker - Cured','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Prison Worker - Cured\n Prison Worker - Cured\n \n 2023-04-03 19:53:11 UTC\n \n 2023-04-03 19:54:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2100\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 21:53:11',4,'2023-04-03 21:54:43',4,0,NULL,NULL,NULL,'2f32e1d7-b41d-4bb7-89a3-80c3243e4948'),(2101,'Retreatment excluding Relapse Lost to follow up','Retreatment excluding Relapse Lost to follow up','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Retreatment excluding Relapse Lost to follow up\n Retreatment excluding Relapse Lost to follow up\n \n 2023-04-03 19:53:33 UTC\n \n 2023-04-03 19:55:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2101\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 21:53:33',4,'2023-04-03 21:55:20',4,0,NULL,NULL,NULL,'e5c0a844-b04b-40b4-99a4-32232d7a740e'),(2102,'Prison Worker - Completed','Prison Worker - Completed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Prison Worker - Completed\n Prison Worker - Completed\n \n 2023-04-03 19:55:01 UTC\n \n 2023-04-03 20:00:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2102\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 21:55:01',4,'2023-04-03 22:00:15',4,0,NULL,NULL,NULL,'a4e75f76-e839-46af-bdc6-8218f3df823c'),(2103,'Retreatment excluding Relapse Failed','Retreatment excluding Relapse Failed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Retreatment excluding Relapse Failed\n Retreatment excluding Relapse Failed\n \n 2023-04-03 19:57:02 UTC\n \n 2023-04-03 20:01:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2103\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 21:57:02',4,'2023-04-03 22:01:44',4,0,NULL,NULL,NULL,'abea75a9-417c-4570-a63e-5739c02c765e'),(2104,'Prison Worker - Not Evaluated','Prison Worker - Not Evaluated','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Prison Worker - Not Evaluated\n Prison Worker - Not Evaluated\n \n 2023-04-03 19:59:02 UTC\n \n 2023-04-03 20:00:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2104\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 21:59:02',4,'2023-04-03 22:00:31',4,0,NULL,NULL,NULL,'5f8c563b-7314-4359-8bb4-4f9d51fe2257'),(2105,'TB Treatment Outcome - Block 2','Block 2: TB/HIV Activities','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Treatment Outcome - Block 2\n Block 2: TB/HIV Activities\n \n 2023-04-03 20:01:22 UTC\n \n 2023-04-03 20:01:46 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2105\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-04-03 22:01:22',4,'2023-04-03 22:01:46',4,0,NULL,NULL,NULL,'e24dad06-5de1-4215-b021-85b95585a56b'),(2106,'TB Treatment Outcome - Block 2 Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Treatment Outcome - Block 2 Data Set\n \n 2023-04-03 20:01:46 UTC\n \n 2023-04-03 20:33:35 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2106\n \n \n DM_Sex\n \n \n \n \n \n \n \n \n ARTNw&Rl_F\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n \n \n \n ARTNw&Rl_M\n \n \n \n \n DM_Sex\n Males\n \n \n \n \n \n ARTRetr_F\n \n \n \n \n \n \n \n \n \n ARTRetr_M\n \n \n \n \n \n \n DapNw&Rl_F\n \n \n \n \n \n \n \n \n \n DapNw&Rl_M\n \n \n \n \n \n \n DapRetre_F\n \n \n \n \n \n \n \n \n \n DapRetre_M\n \n \n \n \n \n \n PosNw&Rs_F\n \n \n \n \n \n \n \n \n \n PosNw&Rs_M\n \n \n \n \n \n \n PosRetr_F\n \n \n \n \n \n \n \n \n \n PosRetr_M\n \n \n \n \n \n \n StsNw&Rs_F\n \n \n \n \n \n \n \n \n \n StsNw&Rs_M\n \n \n \n \n \n \n StsRetre_F\n \n \n \n \n \n \n StsRetre_M\n \n \n \n \n \n \n','2023-04-03 22:01:46',4,'2023-04-03 22:33:35',4,0,NULL,NULL,NULL,'5730236a-dfc3-4bf5-8f18-3769e49f4519'),(2107,'Prison Worker - Failed','Prison Worker - Failed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Prison Worker - Failed\n Prison Worker - Failed\n \n 2023-04-03 20:01:47 UTC\n \n 2023-04-03 20:07:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2107\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:01:47',4,'2023-04-03 22:07:43',4,0,NULL,NULL,NULL,'832801ab-b41b-4695-b0df-ada7c5c34ff7'),(2108,'Retreatment excluding Relapse Not Evaluated','Retreatment excluding Relapse Not Evaluated','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Retreatment excluding Relapse Not Evaluated\n Retreatment excluding Relapse Not Evaluated\n \n 2023-04-03 20:02:36 UTC\n \n 2023-04-03 20:05:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2108\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:02:36',4,'2023-04-03 22:05:10',4,0,NULL,NULL,NULL,'9c3205c9-eb03-46c1-b7e8-a0e9fa4b4738'),(2109,'Prison Worker - Moved to 2nd line','Prison Worker - Moved to 2nd line','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Prison Worker - Moved to 2nd line\n Prison Worker - Moved to 2nd line\n \n 2023-04-03 20:02:41 UTC\n \n 2023-04-03 20:05:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2109\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:02:41',4,'2023-04-03 22:05:28',4,0,NULL,NULL,NULL,'cee1771f-3491-455f-9b0a-a35e99f25454'),(2110,'Retreatment excluding Relapse Moved to Secondline Treatment','Retreatment excluding Relapse Moved to Secondline Treatment','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Retreatment excluding Relapse Moved to Secondline Treatment\n Retreatment excluding Relapse Moved to Secondline Treatment\n \n 2023-04-03 20:06:37 UTC\n \n 2023-04-03 20:20:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2110\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:06:37',4,'2023-04-03 22:20:31',4,0,NULL,NULL,NULL,'ee732817-3760-4a2d-9d61-f7009cd0b256'),(2111,'Prison Worker - Lost','Prison Worker - Lost','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Prison Worker - Lost\n Prison Worker - Lost\n \n 2023-04-03 20:07:00 UTC\n \n 2023-04-03 20:10:16 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2111\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:07:00',4,'2023-04-03 22:10:16',4,0,NULL,NULL,NULL,'bfa5d083-f2ca-4c04-a6d3-193176de6d61'),(2112,'RetreatRetreatment excluding Relapse Moved to Secondline Treatment','RetreatRetreatment excluding Relapse Moved to Secondline Treatment','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n RetreatRetreatment excluding Relapse Moved to Secondline Treatment\n RetreatRetreatment excluding Relapse Moved to Secondline Treatment\n \n 2023-04-03 20:13:03 UTC\n \n 2023-04-03 20:14:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2112\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- Retreatment excluding Relapse \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3785 and o.value_coded in (3786,1037) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3794 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-04-03 22:13:03',4,'2023-04-03 22:14:36',4,0,NULL,NULL,NULL,'2573846a-4c51-4427-bcba-7ed91d2c0835'),(2113,'Health Worker - Died','Health Worker - Died','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Health Worker - Died\n Health Worker - Died\n \n 2023-04-03 20:14:38 UTC\n \n 2023-04-03 20:16:57 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2113\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:14:38',4,'2023-04-03 22:16:57',4,0,NULL,NULL,NULL,'15cca65b-c4f6-4e32-8b7d-18cb047f999a'),(2114,'Health Worker - Cured','Health Worker - Cured','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Health Worker - Cured\n Health Worker - Cured\n \n 2023-04-03 20:16:23 UTC\n \n 2023-04-03 20:18:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2114\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:16:23',4,'2023-04-03 22:18:17',4,0,NULL,NULL,NULL,'efe0083b-cc7c-4394-bf4d-e4129ee2d998'),(2115,'Prison Worker - Completed','Prison Worker - Completed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Prison Worker - Completed\n Prison Worker - Completed\n \n 2023-04-03 20:18:34 UTC\n \n 2023-04-03 20:22:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2115\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:18:34',4,'2023-04-03 22:22:51',4,0,NULL,NULL,NULL,'685d03a5-0f34-426e-aa83-e12e209284b4'),(2116,'Prison Worker - Failed','Prison Worker - Failed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Prison Worker - Failed\n Prison Worker - Failed\n \n 2023-04-03 20:20:00 UTC\n \n 2023-04-03 20:22:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2116\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:20:00',4,'2023-04-03 22:22:29',4,0,NULL,NULL,NULL,'792e1555-e40d-4ebf-8b96-ebbaa769f859'),(2117,'All TB HIV positive Completed','All TB HIV positive Completed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV positive Completed\n All TB HIV positive Completed\n \n 2023-04-03 20:21:28 UTC\n \n 2023-04-03 20:31:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2117\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:21:28',4,'2023-04-03 22:31:15',4,0,NULL,NULL,NULL,'18f345bc-6ed0-42d6-893a-05ba98b38e16'),(2118,'All TB HIV positive Cured','All TB HIV positive Cured','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV positive Cured\n All TB HIV positive Cured\n \n 2023-04-03 20:25:37 UTC\n \n 2023-04-03 20:32:16 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2118\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:25:37',4,'2023-04-03 22:32:16',4,0,NULL,NULL,NULL,'4b6e2cd9-29b6-4f7b-8af7-0ab18e2af838'),(2119,'Health Worker - Completed','Health Worker - Completed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Health Worker - Completed\n Health Worker - Completed\n \n 2023-04-03 20:32:38 UTC\n \n 2023-04-03 20:39:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2119\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:32:38',4,'2023-04-03 22:39:58',4,0,NULL,NULL,NULL,'b38f490e-8d26-411a-9073-2a7e5d17e235'),(2120,'All TB HIV positive and Died','All TB HIV positive and Died','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV positive and Died\n All TB HIV positive and Died\n \n 2023-04-03 20:32:43 UTC\n \n 2023-04-03 20:35:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2120\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:32:43',4,'2023-04-03 22:35:39',4,0,NULL,NULL,NULL,'f0b13ce3-b836-4a27-a7a4-d1b83c1eb900'),(2121,'Health Worker - Not Evaluated','Health Worker - Not Evaluated','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Health Worker - Not Evaluated\n Health Worker - Not Evaluated\n \n 2023-04-03 20:32:56 UTC\n \n 2023-04-03 20:35:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2121\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:32:56',4,'2023-04-03 22:35:43',4,0,NULL,NULL,NULL,'9f750645-0dc4-488d-8a94-05e31d6b4838'),(2122,'All TB HIV positive and Lost to Follow Up','All TB HIV positive and Lost to Follow Up','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV positive and Lost to Follow Up\n All TB HIV positive and Lost to Follow Up\n \n 2023-04-03 20:33:45 UTC\n \n 2023-04-03 20:36:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2122\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:33:45',4,'2023-04-03 22:36:08',4,0,NULL,NULL,NULL,'21738598-0974-4f31-9925-1c9606d66410'),(2123,'All TB HIV positive and Failed','All TB HIV positive and Failed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV positive and Failed\n All TB HIV positive and Failed\n \n 2023-04-03 20:36:30 UTC\n \n 2023-04-03 20:40:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2123\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:36:30',4,'2023-04-03 22:40:18',4,0,NULL,NULL,NULL,'2a7766be-418e-4a5a-a204-c5fa91e6b672'),(2124,'All TB HIV positive and Not Evaluated','All TB HIV positive and Not Evaluated','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV positive and Not Evaluated\n All TB HIV positive and Not Evaluated\n \n 2023-04-03 20:37:09 UTC\n \n 2023-04-03 20:39:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2124\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:37:09',4,'2023-04-03 22:39:20',4,0,NULL,NULL,NULL,'04c0074a-fd87-44da-8d96-68d533e488ea'),(2125,'Health Worker - Lost','Health Worker - Lost','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Health Worker - Lost\n Health Worker - Lost\n \n 2023-04-03 20:40:25 UTC\n \n 2023-04-03 20:44:16 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2125\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:40:25',4,'2023-04-03 22:44:16',4,0,NULL,NULL,NULL,'925a50ba-435b-4213-a03b-6272a468cd01'),(2126,'All TB HIV positive and Moved to Secondline Treatment','All TB HIV positive and Moved to Secondline Treatment','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV positive and Moved to Secondline Treatment\n All TB HIV positive and Moved to Secondline Treatment\n \n 2023-04-03 20:40:57 UTC\n \n 2023-04-03 20:42:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2126\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:40:57',4,'2023-04-03 22:42:27',4,0,NULL,NULL,NULL,'6ed079c9-5ad9-4852-9523-95fddcbc9959'),(2127,'Health Worker - Failed','Health Worker - Failed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Health Worker - Failed\n Health Worker - Failed\n \n 2023-04-03 20:42:41 UTC\n \n 2023-04-03 20:52:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2127\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:42:41',4,'2023-04-03 22:52:06',4,0,NULL,NULL,NULL,'4ec08d1c-6427-44e0-b604-b960e585b190'),(2128,'All TB HIV Negative and Completed','All TB HIV Negative and Completed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Negative and Completed\n All TB HIV Negative and Completed\n \n 2023-04-03 20:43:07 UTC\n \n 2023-04-03 20:53:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2128\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:43:07',4,'2023-04-03 22:53:20',4,0,NULL,NULL,NULL,'d5786c86-ca76-43b1-b0a6-1bd90817af65'),(2129,'All TB HIV Negative and Cured','All TB HIV Negative and Cured','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Negative and Cured\n All TB HIV Negative and Cured\n \n 2023-04-03 20:44:07 UTC\n \n 2023-04-03 20:49:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2129\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:44:07',4,'2023-04-03 22:49:20',4,0,NULL,NULL,NULL,'a564539f-267c-452a-99d2-0f61f7c88c4f'),(2130,'Health Worker - Moved to 2nd line','Health Worker - Moved to 2nd line','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Health Worker - Moved to 2nd line\n Health Worker - Moved to 2nd line\n \n 2023-04-03 20:48:45 UTC\n \n 2023-04-03 20:55:46 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2130\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:48:45',4,'2023-04-03 22:55:46',4,0,NULL,NULL,NULL,'c0d08cc2-25dc-48f6-a9bc-db0d9b376d17'),(2131,'All TB HIV Negative and Died','All TB HIV Negative and Died','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Negative and Died\n All TB HIV Negative and Died\n \n 2023-04-03 20:51:50 UTC\n \n 2023-04-03 20:55:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2131\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:51:50',4,'2023-04-03 22:55:29',4,0,NULL,NULL,NULL,'b375d3b0-9817-419c-ad36-5513383a0191'),(2132,'Public Transport - Died','Public Transport - Died','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Public Transport - Died\n Public Transport - Died\n \n 2023-04-03 20:55:26 UTC\n \n 2023-04-03 20:57:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2132\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:55:26',4,'2023-04-03 22:57:21',4,0,NULL,NULL,NULL,'09f945ef-6ced-4c7c-924b-d83368e5b544'),(2133,'All TB HIV Negative and Failed','All TB HIV Negative and Failed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Negative and Failed\n All TB HIV Negative and Failed\n \n 2023-04-03 20:56:21 UTC\n \n 2023-04-03 21:00:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2133\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:56:21',4,'2023-04-03 23:00:30',4,0,NULL,NULL,NULL,'bce54b53-dea6-4664-bc35-b436a74551f0'),(2134,'All TB HIV Negative and Lost to Follow Up','All TB HIV Negative and Lost to Follow Up','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Negative and Lost to Follow Up\n All TB HIV Negative and Lost to Follow Up\n \n 2023-04-03 20:56:44 UTC\n \n 2023-04-03 21:00:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2134\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:56:44',4,'2023-04-03 23:00:04',4,0,NULL,NULL,NULL,'7b40659a-ca9a-4034-832f-5fddb0421d26'),(2135,'Public Transport - Not Evaluated','Public Transport - Not Evaluated','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Public Transport - Not Evaluated\n Public Transport - Not Evaluated\n \n 2023-04-03 20:56:54 UTC\n \n 2023-04-03 20:59:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2135\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:56:54',4,'2023-04-03 22:59:03',4,0,NULL,NULL,NULL,'0b001306-febd-4630-acb7-03fedc1eca0d'),(2136,'Public Transport - Completed','Public Transport - Completed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Public Transport - Completed\n Public Transport - Completed\n \n 2023-04-03 20:58:25 UTC\n \n 2023-04-03 21:00:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2136\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:58:25',4,'2023-04-03 23:00:42',4,0,NULL,NULL,NULL,'cb8baffc-6e41-4464-91b4-478da43820ad'),(2137,'Public Transport - Lost','Public Transport - Lost','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Public Transport - Lost\n Public Transport - Lost\n \n 2023-04-03 21:00:25 UTC\n \n 2023-04-03 21:04:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2137\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:00:25',4,'2023-04-03 23:04:00',4,0,NULL,NULL,NULL,'68abf753-d909-4d9d-866b-d707b637b5f6'),(2138,'All TB HIV Negative and Not Evaluated','All TB HIV Negative and Not Evaluated','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Negative and Not Evaluated\n All TB HIV Negative and Not Evaluated\n \n 2023-04-03 21:00:53 UTC\n \n 2023-04-03 21:02:35 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2138\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:00:53',4,'2023-04-03 23:02:35',4,0,NULL,NULL,NULL,'56fc35af-e96c-4268-b7b4-0d63610a2d06'),(2139,'All TB HIV Negative and Moved to Secondline Treatment','All TB HIV Negative and Moved to Secondline Treatment','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Negative and Moved to Secondline Treatment\n All TB HIV Negative and Moved to Secondline Treatment\n \n 2023-04-03 21:01:36 UTC\n \n 2023-04-03 21:02:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2139\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:01:36',4,'2023-04-03 23:02:58',4,0,NULL,NULL,NULL,'bdf99672-96f9-4eda-ad34-a82f5b59ffbc'),(2140,'Public Transport - Cured','Public Transport - Cured','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Public Transport - Cured\n Public Transport - Cured\n \n 2023-04-03 21:02:12 UTC\n \n 2023-04-03 21:06:24 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2140\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:02:12',4,'2023-04-03 23:06:24',4,0,NULL,NULL,NULL,'185b4be8-a666-4211-b22d-56dc426cbbcd'),(2141,'All TB Children (0-14 yrs) and Completed','All TB Children (0-14 yrs) and Completed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Children (0-14 yrs) and Completed\n All TB Children (0-14 yrs) and Completed\n \n 2023-04-03 21:03:41 UTC\n \n 2023-04-03 21:05:56 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2141\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:03:41',4,'2023-04-03 23:05:56',4,0,NULL,NULL,NULL,'eb242fe9-dde6-4baa-b92f-7a7084920dd7'),(2142,'All TB Children (0-14 yrs) and Cured','All TB Children (0-14 yrs) and Cured','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Children (0-14 yrs) and Cured\n All TB Children (0-14 yrs) and Cured\n \n 2023-04-03 21:04:01 UTC\n \n 2023-04-03 21:06:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2142\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:04:01',4,'2023-04-03 23:06:20',4,0,NULL,NULL,NULL,'88c4f217-bf94-4e84-9d4b-15f6747276ae'),(2143,'Public Transport - Moved to 2nd line','Public Transport - Moved to 2nd line','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Public Transport - Moved to 2nd line\n Public Transport - Moved to 2nd line\n \n 2023-04-03 21:05:57 UTC\n \n 2023-04-03 21:10:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2143\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:05:57',4,'2023-04-03 23:10:23',4,0,NULL,NULL,NULL,'3d87ffb3-cfb1-4ac5-bf47-dcb3193e133b'),(2144,'All TB Children (0-14 yrs) and Died','All TB Children (0-14 yrs) and Died','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Children (0-14 yrs) and Died\n All TB Children (0-14 yrs) and Died\n \n 2023-04-03 21:06:48 UTC\n \n 2023-04-03 21:08:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2144\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:06:48',4,'2023-04-03 23:08:55',4,0,NULL,NULL,NULL,'30a341a8-2bf8-4e91-a9ee-41b6826e2cef'),(2145,'Public Transport - Failed','Public Transport - Failed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Public Transport - Failed\n Public Transport - Failed\n \n 2023-04-03 21:07:43 UTC\n \n 2023-04-03 21:09:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2145\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:07:43',4,'2023-04-03 23:09:40',4,0,NULL,NULL,NULL,'e9843f95-15c2-4d15-bd2c-bdfc19bc4767'),(2146,'All TB Children (0-14 yrs) and Lost to follow up','All TB Children (0-14 yrs) and Lost to follow up','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Children (0-14 yrs) and Lost to follow up\n All TB Children (0-14 yrs) and Lost to follow up\n \n 2023-04-03 21:08:17 UTC\n \n 2023-04-03 21:16:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2146\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:08:17',4,'2023-04-03 23:16:59',4,0,NULL,NULL,NULL,'33f4111b-438c-4da8-bc56-0c588f408444'),(2147,'All TB Children (0-14 yrs) and failed','All TB Children (0-14 yrs) and failed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Children (0-14 yrs) and failed\n All TB Children (0-14 yrs) and failed\n \n 2023-04-03 21:09:49 UTC\n \n 2023-04-03 21:17:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2147\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:09:49',4,'2023-04-03 23:17:30',4,0,NULL,NULL,NULL,'af568cf8-77aa-4d45-ab4f-ca39418ba77d'),(2148,'HHCM - Completed','HHCM - Completed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM - Completed\n HHCM - Completed\n \n 2023-04-03 21:11:12 UTC\n \n 2023-04-03 21:13:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2148\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:11:12',4,'2023-04-03 23:13:17',4,0,NULL,NULL,NULL,'23d932aa-9c33-4aff-89ec-9028c25a03ef'),(2149,'All TB Children (0-14 yrs) and not evaluated','All TB Children (0-14 yrs) and not evaluated','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Children (0-14 yrs) and not evaluated\n All TB Children (0-14 yrs) and not evaluated\n \n 2023-04-03 21:12:28 UTC\n \n 2023-04-03 21:15:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2149\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:12:28',4,'2023-04-03 23:15:26',4,0,NULL,NULL,NULL,'12a47e2e-735f-4b72-9e0c-f9fc792f3fc8'),(2150,'HHCM - Failed','HHCM - Failed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM - Failed\n HHCM - Failed\n \n 2023-04-03 21:13:03 UTC\n \n 2023-04-03 21:35:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2150\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:13:03',4,'2023-04-03 23:35:08',4,0,NULL,NULL,NULL,'ce1c1a8e-9760-4a56-a885-4bc25de4f892'),(2151,'HHCM - Lost','HHCM - Lost','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM - Lost\n HHCM - Lost\n \n 2023-04-03 21:14:35 UTC\n \n 2023-04-03 21:36:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2151\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:14:35',4,'2023-04-03 23:36:26',4,0,NULL,NULL,NULL,'b9ee3b47-b5d7-42ed-9a47-4f61f77b6eeb'),(2152,'All TB Children (0-14 yrs) and moved to secondline treatment','All TB Children (0-14 yrs) and moved to secondline treatment','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Children (0-14 yrs) and moved to secondline treatment\n All TB Children (0-14 yrs) and moved to secondline treatment\n \n 2023-04-03 21:18:05 UTC\n \n 2023-04-03 21:30:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2152\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:18:05',4,'2023-04-03 23:30:14',4,0,NULL,NULL,NULL,'692b0f3e-9c3e-4a71-bba3-b6ae50963679'),(2153,'All TB Adolescent (10-19 yrs) and Completed','All TB Adolescent (10-19 yrs) and Completed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Adolescent (10-19 yrs) and Completed\n All TB Adolescent (10-19 yrs) and Completed\n \n 2023-04-03 21:27:45 UTC\n \n 2023-04-03 21:29:16 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2153\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:27:45',4,'2023-04-03 23:29:16',4,0,NULL,NULL,NULL,'ad3dbe97-3718-4885-a76d-36982b68f507'),(2154,'All TB Adolescent (10-19 yrs) and Cured','All TB Adolescent (10-19 yrs) and Cured','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Adolescent (10-19 yrs) and Cured\n All TB Adolescent (10-19 yrs) and Cured\n \n 2023-04-03 21:28:37 UTC\n \n 2023-04-03 21:30:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2154\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:28:37',4,'2023-04-03 23:30:39',4,0,NULL,NULL,NULL,'ee2cd03a-51b0-4f81-81cc-40ab687629a8'),(2155,'All TB Adolescent (10-19 yrs) and Died','All TB Adolescent (10-19 yrs) and Died','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Adolescent (10-19 yrs) and Died\n All TB Adolescent (10-19 yrs) and Died\n \n 2023-04-03 21:30:59 UTC\n \n 2023-04-03 21:33:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2155\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:30:59',4,'2023-04-03 23:33:07',4,0,NULL,NULL,NULL,'f27e06d5-38ff-443b-8ce0-3cebb07f2eec'),(2156,'All TB Adolescent (10-19 yrs) and Lost to follow up','All TB Adolescent (10-19 yrs) and Lost to follow up','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Adolescent (10-19 yrs) and Lost to follow up\n All TB Adolescent (10-19 yrs) and Lost to follow up\n \n 2023-04-03 21:31:24 UTC\n \n 2023-04-03 21:33:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2156\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:31:24',4,'2023-04-03 23:33:27',4,0,NULL,NULL,NULL,'b7f7dbd4-f089-4ac4-9bc5-4c750a016a6c'),(2157,'All TB Adolescent (10-19 yrs) and failed','All TB Adolescent (10-19 yrs) and failed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Adolescent (10-19 yrs) and failed\n All TB Adolescent (10-19 yrs) and failed\n \n 2023-04-03 21:31:48 UTC\n \n 2023-04-03 21:38:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2157\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:31:48',4,'2023-04-03 23:38:15',4,0,NULL,NULL,NULL,'6ab5cc07-88e8-4b34-9cb6-8d451336945a'),(2158,'All TB Adolescent (10-19 yrs) and Not Evaluated','All TB Adolescent (10-19 yrs) and Not Evaluated','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Adolescent (10-19 yrs) and Not Evaluated\n All TB Adolescent (10-19 yrs) and Not Evaluated\n \n 2023-04-03 21:34:28 UTC\n \n 2023-04-03 21:36:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2158\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:34:28',4,'2023-04-03 23:36:44',4,0,NULL,NULL,NULL,'4465b2b0-282f-4b7a-8acc-ba9018cf82ca'),(2159,'All TB Adolescent (10-19 yrs) and Moved to Secondline treatment','All TB Adolescent (10-19 yrs) and Moved to Secondline treatment','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Adolescent (10-19 yrs) and Moved to Secondline treatment\n All TB Adolescent (10-19 yrs) and Moved to Secondline treatment\n \n 2023-04-03 21:34:49 UTC\n \n 2023-04-03 21:37:16 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2159\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:34:49',4,'2023-04-03 23:37:16',4,0,NULL,NULL,NULL,'fc47f473-d8f7-4b44-b969-4aee12de4036'),(2160,'HHCM - Not Evaluated','HHCM - Not Evaluated','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM - Not Evaluated\n HHCM - Not Evaluated\n \n 2023-04-03 21:37:03 UTC\n \n 2023-04-03 21:42:22 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2160\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:37:03',4,'2023-04-03 23:42:22',4,0,NULL,NULL,NULL,'f801b15a-b96f-491f-a8b5-1fbee8ba9c83'),(2161,'Female and Completed','Female and Completed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Female and Completed\n Female and Completed\n \n 2023-04-03 21:37:55 UTC\n \n 2023-04-03 21:44:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2161\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:37:55',4,'2023-04-03 23:44:21',4,0,NULL,NULL,NULL,'615ab43e-7d60-462d-bab7-3ea00babd032'),(2162,'Female and Cured','Female and Cured','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Female and Cured\n Female and Cured\n \n 2023-04-03 21:38:38 UTC\n \n 2023-04-03 21:46:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2162\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:38:38',4,'2023-04-03 23:46:42',4,0,NULL,NULL,NULL,'807438e3-b735-4310-9e68-24f15521e66d'),(2163,'HHCM - Cured','HHCM - Cured','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM - Cured\n HHCM - Cured\n \n 2023-04-03 21:38:56 UTC\n \n 2023-04-03 21:42:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2163\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:38:56',4,'2023-04-03 23:42:00',4,0,NULL,NULL,NULL,'352d4e3a-8ea5-4848-a515-ea4a3a091d8f'),(2164,'TB Female and Died','TB Female and Died','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Female and Died\n TB Female and Died\n \n 2023-04-03 21:39:57 UTC\n \n 2023-04-03 21:47:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2164\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:39:57',4,'2023-04-03 23:47:30',4,0,NULL,NULL,NULL,'ab84625a-199b-4a80-99b9-9b89c8c02ba4'),(2165,'HHCM - Died','HHCM - Died','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM - Died\n HHCM - Died\n \n 2023-04-03 21:43:38 UTC\n \n 2023-04-03 21:46:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2165\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:43:38',4,'2023-04-03 23:46:59',4,0,NULL,NULL,NULL,'144c7351-4092-442d-ab8d-91cf1d13698c'),(2166,'HHCM - Moved to 2nd line','HHCM - Moved to 2nd line','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM - Moved to 2nd line\n HHCM - Moved to 2nd line\n \n 2023-04-03 21:44:32 UTC\n \n 2023-04-03 21:48:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2166\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:44:32',4,'2023-04-03 23:48:15',4,0,NULL,NULL,NULL,'a7391f1f-e1b2-415c-bde5-52d06b5616ad'),(2167,'TB Female and Lost to Follow up','TB Female and Lost to Follow up','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Female and Lost to Follow up\n TB Female and Lost to Follow up\n \n 2023-04-03 21:46:14 UTC\n \n 2023-04-03 21:48:16 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2167\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:46:14',4,'2023-04-03 23:48:16',4,0,NULL,NULL,NULL,'6ad8a1fc-9753-4d52-b40a-68c6c9089141'),(2168,'TB Female and Failed','TB Female and Failed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Female and Failed\n TB Female and Failed\n \n 2023-04-03 21:47:53 UTC\n \n 2023-04-03 21:49:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2168\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:47:53',4,'2023-04-03 23:49:44',4,0,NULL,NULL,NULL,'676800f0-5583-436b-b7ab-815f7d884f96'),(2169,'TB Female and Not Evaluated','TB Female and Not Evaluated','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Female and Not Evaluated\n TB Female and Not Evaluated\n \n 2023-04-03 21:48:58 UTC\n \n 2023-04-03 21:53:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2169\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:48:58',4,'2023-04-03 23:53:30',4,0,NULL,NULL,NULL,'67a2aa65-3b21-45f8-bdba-fe284d683360'),(2170,'TB Female and moved to secondline','TB Female and moved to secondline','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Female and moved to secondline\n TB Female and moved to secondline\n \n 2023-04-03 21:49:27 UTC\n \n 2023-04-03 21:51:19 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2170\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:49:27',4,'2023-04-03 23:51:19',4,0,NULL,NULL,NULL,'eac53c81-f295-41ae-989d-26f66888caae'),(2171,'HHXM - Completed','HHXM - Completed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM - Completed\n HHXM - Completed\n \n 2023-04-03 21:51:36 UTC\n \n 2023-04-03 21:56:49 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2171\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:51:36',4,'2023-04-03 23:56:49',4,0,NULL,NULL,NULL,'558ce9d9-35d7-4d49-8b41-f4c8cc979bdf'),(2172,'HHXM - Cured','HHXM - Cured','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM - Cured\n HHXM - Cured\n \n 2023-04-03 21:51:55 UTC\n \n 2023-04-03 21:57:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2172\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:51:55',4,'2023-04-03 23:57:44',4,0,NULL,NULL,NULL,'56f5154b-cb21-456b-8e13-508a0dc032ff'),(2173,'TB Mine Workers and completed','TB Mine Workers and completed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Mine Workers and completed\n TB Mine Workers and completed\n \n 2023-04-03 21:53:08 UTC\n \n 2023-04-03 21:56:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2173\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:53:08',4,'2023-04-03 23:56:07',4,0,NULL,NULL,NULL,'a54130b0-7643-4865-9a0e-6c70215d3046'),(2174,'TB Mine Workers and cured','TB Mine Workers and cured','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Mine Workers and cured\n TB Mine Workers and cured\n \n 2023-04-03 21:53:49 UTC\n \n 2023-04-03 21:57:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2174\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:53:49',4,'2023-04-03 23:57:45',4,0,NULL,NULL,NULL,'f5957799-79ad-4f08-9a68-c359c4b69ce3'),(2175,'TB Mine Workers and died','TB Mine Workers and died','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Mine Workers and died\n TB Mine Workers and died\n \n 2023-04-03 21:55:02 UTC\n \n 2023-04-03 21:57:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2175\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:55:02',4,'2023-04-03 23:57:23',4,0,NULL,NULL,NULL,'fc3c4c67-738d-403a-9584-bd4a17942c24'),(2176,'HHXM - Died','HHXM - Died','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM - Died\n HHXM - Died\n \n 2023-04-03 21:56:35 UTC\n \n 2023-04-03 21:59:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2176\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:56:35',4,'2023-04-03 23:59:44',4,0,NULL,NULL,NULL,'2aaeab53-7906-480f-a51b-ebc9077a28ac'),(2177,'TB Mine Workers and lost to follow up','TB Mine Workers and lost to follow up','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Mine Workers and lost to follow up\n TB Mine Workers and lost to follow up\n \n 2023-04-03 21:58:16 UTC\n \n 2023-04-03 22:05:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2177\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:58:16',4,'2023-04-04 00:05:17',4,0,NULL,NULL,NULL,'2d37e108-26d4-4c69-aa41-dbcb4298d209'),(2178,'HHXM - Not Evaluated','HHXM - Not Evaluated','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM - Not Evaluated\n HHXM - Not Evaluated\n \n 2023-04-03 21:58:28 UTC\n \n 2023-04-03 22:01:46 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2178\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:58:28',4,'2023-04-04 00:01:46',4,0,NULL,NULL,NULL,'ffa409cc-0ce1-4ca0-9971-e339c3d29f8c'),(2179,'TB Mine Workers and failed','TB Mine Workers and failed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Mine Workers and failed\n TB Mine Workers and failed\n \n 2023-04-03 21:58:31 UTC\n \n 2023-04-03 22:00:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2179\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:58:31',4,'2023-04-04 00:00:58',4,0,NULL,NULL,NULL,'f866bee9-323a-4a71-8e35-94cceaa3550d'),(2180,'TB Mine Workers and not evaluated','TB Mine Workers and not evaluated','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Mine Workers and not evaluated\n TB Mine Workers and not evaluated\n \n 2023-04-03 21:58:52 UTC\n \n 2023-04-03 22:04:47 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2180\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:58:52',4,'2023-04-04 00:04:47',4,0,NULL,NULL,NULL,'b2a2038e-f629-45ee-8033-f797caa6ac39'),(2181,'HHXM - Lost','HHXM - Lost','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM - Lost\n HHXM - Lost\n \n 2023-04-03 22:00:45 UTC\n \n 2023-04-03 22:04:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2181\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-04 00:00:45',4,'2023-04-04 00:04:15',4,0,NULL,NULL,NULL,'11bcf608-b1dd-492d-ba8a-cd3c9e19748f'),(2182,'HHXM - Failed','HHXM - Failed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM - Failed\n HHXM - Failed\n \n 2023-04-03 22:01:29 UTC\n \n 2023-04-03 22:11:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2182\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-04 00:01:29',4,'2023-04-04 00:11:06',4,0,NULL,NULL,NULL,'a10dc54c-654e-4f57-9df8-be1b14c50a14'),(2183,'TB Mine Workers and moved to secondline ','TB Mine Workers and moved to secondline ','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Mine Workers and moved to secondline \n TB Mine Workers and moved to secondline \n \n 2023-04-03 22:02:20 UTC\n \n 2023-04-03 22:11:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2183\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${endDate}\n \n \n \n','2023-04-04 00:02:20',4,'2023-04-04 00:11:10',4,0,NULL,NULL,NULL,'e07ad771-1ec2-4d4a-a085-5433cc94b7de'),(2184,'HHXM - Moved to 2nd Line','HHXM - Moved to 2nd Line','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM - Moved to 2nd Line\n HHXM - Moved to 2nd Line\n \n 2023-04-03 22:03:46 UTC\n \n 2023-04-03 22:08:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2184\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-04 00:03:46',4,'2023-04-04 00:08:51',4,0,NULL,NULL,NULL,'b12d1160-3ba1-4b39-92b9-e765d0d9fe55'),(2185,'TB Treatment Outcome - Block 1','TB Treatment Outcome - Block 1','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Treatment Outcome - Block 1\n TB Treatment Outcome - Block 1\n \n 2023-04-03 22:07:23 UTC\n \n 2023-04-03 22:07:54 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2185\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-04-04 00:07:23',4,'2023-04-04 00:07:54',4,0,NULL,NULL,NULL,'a7cfcef1-57f5-4fbc-8a24-77fac2b219bf'),(2186,'TB Treatment Outcome - Block 1 Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Treatment Outcome - Block 1 Data Set\n \n 2023-04-03 22:07:54 UTC\n \n 2023-04-04 12:21:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2186\n \n \n \n Fmale2nd\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n \n \n FmaleComp\n \n \n \n \n \n \n \n \n \n FmaleCured\n \n \n \n \n \n \n \n \n \n FmaleDied\n \n \n \n \n \n \n \n \n \n FmaleFaile\n \n \n \n \n \n \n \n \n \n FmaleLost\n \n \n \n \n \n \n \n \n \n FmaleNtEv\n \n \n \n \n \n \n \n \n \n Miner2nd\n \n \n \n \n \n \n \n \n \n MinerComp\n \n \n \n \n \n \n \n \n \n MinerCured\n \n \n \n \n \n \n \n \n \n MinerDied\n \n \n \n \n \n \n \n \n \n MinerFail\n \n \n \n \n \n \n \n \n \n MinerLost\n \n \n \n \n \n \n \n \n \n MinerNtEv\n \n \n \n \n \n \n \n \n \n NwRlps2nd\n \n \n \n \n \n \n \n \n \n NwRlpsComp\n \n \n \n \n \n \n \n \n \n NwRlpsCure\n \n \n \n \n \n \n \n \n \n NwRlpsDied\n \n \n \n \n \n \n \n \n \n NwRlpsLost\n \n \n \n \n \n \n \n \n \n NwRlpsNtEv\n \n \n \n \n \n \n \n \n \n NwRlpsfail\n \n \n \n \n \n \n \n \n \n RtrtEx2nd\n \n \n \n \n \n \n \n \n \n RtrtExComp\n \n \n \n \n \n \n \n \n \n RtrtExCure\n \n \n \n \n \n \n \n \n \n RtrtExDied\n \n \n \n \n \n \n \n \n \n RtrtExFail\n \n \n \n \n \n \n \n \n \n RtrtExLost\n \n \n \n \n \n \n \n \n \n RtrtExNtEv\n \n \n \n \n \n \n \n \n \n TBAdol2nd\n \n \n \n \n \n \n \n \n \n TBAdolComp\n \n \n \n \n \n \n \n \n \n TBAdolCure\n \n \n \n \n \n \n \n \n \n TBAdolDied\n \n \n \n \n \n \n \n \n \n TBAdolFail\n \n \n \n \n \n \n \n \n \n TBAdolLost\n \n \n \n \n \n \n \n \n \n TBAdolNtEv\n \n \n \n \n \n \n \n \n \n TBChld2nd\n \n \n \n \n \n \n \n \n \n TBChldCure\n \n \n \n \n \n \n \n \n \n TBChldDied\n \n \n \n \n \n \n \n \n \n TBChldFail\n \n \n \n \n \n \n \n \n \n TBChldLost\n \n \n \n \n \n \n \n \n \n TBChldNtEv\n \n \n \n \n \n \n \n \n \n TBNeg2nd\n \n \n \n \n \n \n \n \n \n TBNegCompl\n \n \n \n \n \n \n \n \n \n TBNegCured\n \n \n \n \n \n \n \n \n \n TBNegDied\n \n \n \n \n \n \n \n \n \n TBNegFaile\n \n \n \n \n \n \n \n \n \n TBNegLost\n \n \n \n \n \n \n \n \n \n TBNegNtEv\n \n \n \n \n \n \n \n \n \n TBPos2nd\n \n \n \n \n \n \n \n \n \n TBPosCompl\n \n \n \n \n \n \n \n \n \n TBPosCured\n \n \n \n \n \n \n \n \n \n TBPosDied\n \n \n \n \n \n \n \n \n \n TBPosFaile\n \n \n \n \n \n \n \n \n \n TBPosLost\n \n \n \n \n \n \n \n \n \n TBPosNtEv\n \n \n \n \n \n \n \n \n \n TbChldComp\n \n \n \n \n \n \n \n \n \n exM_comple\n \n \n \n \n \n \n \n \n \n exM_cured\n \n \n \n \n \n \n \n \n \n exM_died\n \n \n \n \n \n \n \n \n \n exM_failed\n \n \n \n \n \n \n \n \n \n exM_lost\n \n \n \n \n \n \n \n \n \n exM_moved\n \n \n \n \n \n \n \n \n \n exM_noteEv\n \n \n \n \n \n \n \n \n \n fact_Died\n \n \n \n \n \n \n \n \n \n fact_compl\n \n \n \n \n \n \n \n \n \n fact_cured\n \n \n \n \n \n \n fact_fail\n \n \n \n \n \n \n \n \n \n fact_lost\n \n \n \n \n \n \n \n \n \n fact_moved\n \n \n \n \n \n \n \n \n \n fact_notEv\n \n \n \n \n \n \n \n \n \n hcw_comple\n \n \n \n \n \n \n \n \n \n hcw_cured\n \n \n \n \n \n \n \n \n \n hcw_died\n \n \n \n \n \n \n \n \n \n hcw_failed\n \n \n \n \n \n \n \n \n \n hcw_lost\n \n \n \n \n \n \n \n \n \n hcw_moved\n \n \n \n \n \n \n \n \n \n hcw_notEva\n \n \n \n \n \n \n \n \n \n hhcm_compl\n \n \n \n \n \n \n \n \n \n hhcm_cured\n \n \n \n \n \n \n \n \n \n hhcm_died\n \n \n \n \n \n \n \n \n \n hhcm_evalu\n \n \n \n \n \n \n \n \n \n hhcm_faile\n \n \n \n \n \n \n \n \n \n hhcm_lost\n \n \n \n \n \n \n \n \n \n hhcm_moved\n \n \n \n \n \n \n \n \n \n hhx_comple\n \n \n \n \n \n \n \n \n \n hhxm_cured\n \n \n \n \n \n \n \n \n \n hhxm_died\n \n \n \n \n \n \n \n \n \n hhxm_faile\n \n \n \n \n \n \n \n \n \n hhxm_lost\n \n \n \n \n \n \n \n \n \n hhxm_moved\n \n \n \n \n \n \n \n \n \n hhxm_notEv\n \n \n \n \n \n \n \n \n \n ptran_comp\n \n \n \n \n \n \n \n \n \n ptran_cure\n \n \n \n \n \n \n \n \n \n ptran_died\n \n \n \n \n \n \n \n \n \n ptran_eval\n \n \n \n \n \n \n \n \n \n ptran_fail\n \n \n \n \n \n \n \n \n \n ptran_lost\n \n \n \n \n \n \n \n \n \n ptran_move\n \n \n \n \n \n \n \n \n \n','2023-04-04 00:07:54',4,'2023-04-04 14:21:10',4,0,NULL,NULL,NULL,'71fbb539-96d9-420c-9b3c-1edeab07e722'),(2187,'Children ARV Regimen_1stLine_4C','Children ARV Regimen_1stLine_Regimen disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4C\n Children ARV Regimen_1stLine_Regimen disaggregated by weight, sex, age\n \n 2023-07-26 13:30:34 UTC\n \n 2023-07-26 13:32:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2187\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-07-26 13:30:34',4,'2023-07-26 13:32:50',4,0,NULL,NULL,NULL,'f97eba59-b593-4225-8140-5bbe62c4a836'),(2188,'Children ARV Regimen_1stLine_4D','Children ARV Regimen_1stLine_4D disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4D\n Children ARV Regimen_1stLine_4D disaggregated by weight, sex, age\n \n 2023-07-26 13:30:39 UTC\n \n 2023-07-27 13:48:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2188\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-07-26 15:30:39',4,'2023-07-27 15:48:06',4,0,NULL,NULL,NULL,'f0f167bb-dc9e-4121-9ceb-a2268861062f'),(2189,'Children ARV Regimen_1stLine_Transition Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_Transition Data Set\n \n 2023-07-26 13:31:12 UTC\n \n 2023-08-14 12:41:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2189\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4>=35\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4y10-13\n \n \n \n \n \n \n \n \n \n F1-4y14-19\n \n \n \n \n \n \n \n \n \n F1-4y20-24\n \n \n \n \n \n \n \n \n \n F1-4y25-34\n \n \n \n \n \n \n \n \n \n F1-4yr0-3\n \n \n \n \n \n \n \n \n \n F1-4yr4-5\n \n \n \n \n \n \n \n \n \n F1-4yr6-9\n \n \n \n \n \n \n \n \n \n F10-14y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14y10-\n \n \n \n \n \n \n F10-14y14-\n \n \n \n \n \n \n F10-14y20-\n \n \n \n \n \n \n F10-14y25-\n \n \n \n \n \n \n F10-14y4-5\n \n \n \n \n \n \n F10-14y6-9\n \n \n \n \n \n \n F10-14y>=3\n \n \n \n \n \n \n F5-9y10-13\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9y14-19\n \n \n \n \n \n \n F5-9y20-24\n \n \n \n \n \n \n F5-9y25-34\n \n \n \n \n \n \n F5-9y>=35\n \n \n \n \n \n \n F5-9yr0-3\n \n \n \n \n \n \n F5-9yr4-5\n \n \n \n \n \n \n F5-9yr6-9\n \n \n \n \n \n \n F<1y10-13\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1y14-19\n \n \n \n \n \n \n F<1y20-24\n \n \n \n \n \n \n F<1y25-34\n \n \n \n \n \n \n F<1y>=35\n \n \n \n \n \n \n F<1yr0-3\n \n \n \n \n \n \n F<1yr4-5\n \n \n \n \n \n \n F<1yr6-9\n \n \n \n \n \n \n M1-4y10-13\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4y14-19\n \n \n \n \n \n \n M1-4y20-24\n \n \n \n \n \n \n M1-4y25-34\n \n \n \n \n \n \n M1-4y>=35\n \n \n \n \n \n \n M1-4yr0-3\n \n \n \n \n \n \n M1-4yr4-5\n \n \n \n \n \n \n M1-4yr6-9\n \n \n \n \n \n \n M10-14y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14y10-\n \n \n \n \n \n \n M10-14y14-\n \n \n \n \n \n \n M10-14y20-\n \n \n \n \n \n \n M10-14y25-\n \n \n \n \n \n \n M10-14y4-5\n \n \n \n \n \n \n M10-14y6-9\n \n \n \n \n \n \n M10-14y>=3\n \n \n \n \n \n \n M5-9y10-13\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9y14-19\n \n \n \n \n \n \n M5-9y20-24\n \n \n \n \n \n \n M5-9y25-34\n \n \n \n \n \n \n M5-9y>=35\n \n \n \n \n \n \n M5-9yr0-3\n \n \n \n \n \n \n M5-9yr4-5\n \n \n \n \n \n \n M5-9yr6-9\n \n \n \n \n \n \n M<1y14-19\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1y20-24\n \n \n \n \n \n \n M<1y25-34\n \n \n \n \n \n \n M<1y>=35\n \n \n \n \n \n \n M<1yr0-3\n \n \n \n \n \n \n M<1yr10-13\n \n \n \n \n \n \n M<1yr4-5\n \n \n \n \n \n \n M<1yr6-9\n \n \n \n \n \n \n','2023-07-26 13:31:12',4,'2023-08-14 12:41:44',4,0,NULL,NULL,NULL,'da04bec0-be82-45a6-9136-716f46837537'),(2190,'Children ARV Regimen_1stLine_Transition Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_Transition Data Set\n \n 2023-07-26 13:31:22 UTC\n \n 2023-08-14 13:10:49 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2190\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4yr0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4yr10-1\n \n \n \n \n \n \n \n \n \n F1-4yr14-1\n \n \n \n \n \n \n \n \n \n F1-4yr20-2\n \n \n \n \n \n \n \n \n \n F1-4yr25-3\n \n \n \n \n \n \n \n \n \n F1-4yr4-5\n \n \n \n \n \n \n \n \n \n F1-4yr6-9\n \n \n \n \n \n \n \n \n \n F1-4yr>=35\n \n \n \n \n \n \n \n \n \n F10-14yr0-\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14yr10\n \n \n \n \n \n \n F10-14yr14\n \n \n \n \n \n \n F10-14yr20\n \n \n \n \n \n \n F10-14yr25\n \n \n \n \n \n \n F10-14yr35\n \n \n \n \n \n \n F10-14yr4-\n \n \n \n \n \n \n F10-14yr6-\n \n \n \n \n \n \n F5-9yr0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9yr10-1\n \n \n \n \n \n \n F5-9yr14-1\n \n \n \n \n \n \n F5-9yr20-2\n \n \n \n \n \n \n F5-9yr25-3\n \n \n \n \n \n \n F5-9yr4-5\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9yr6-9\n \n \n \n \n \n \n F5-9yr>=35\n \n \n \n \n \n \n F<1yr0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1yr10-13\n \n \n \n \n \n \n F<1yr14-19\n \n \n \n \n \n \n F<1yr20-14\n \n \n \n \n \n \n F<1yr25-34\n \n \n \n \n \n \n F<1yr4-5\n \n \n \n \n \n \n F<1yr6-9\n \n \n \n \n \n \n F<1yr>=35\n \n \n \n \n \n \n M1-4yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4yr10-1\n \n \n \n \n \n \n M1-4yr14-1\n \n \n \n \n \n \n M1-4yr20-2\n \n \n \n \n \n \n M1-4yr25-3\n \n \n \n \n \n \n M1-4yr4-5\n \n \n \n \n \n \n M1-4yr6-9\n \n \n \n \n \n \n M1-4yr>=35\n \n \n \n \n \n \n M10-14yr0-\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14yr10\n \n \n \n \n \n \n M10-14yr14\n \n \n \n \n \n \n M10-14yr20\n \n \n \n \n \n \n M10-14yr25\n \n \n \n \n \n \n M10-14yr35\n \n \n \n \n \n \n M10-14yr4-\n \n \n \n \n \n \n M10-14yr6-\n \n \n \n \n \n \n M5-9yr0-3\n \n \n \n \n \n \n M5-9yr10-1\n \n \n \n \n \n \n M5-9yr14-1\n \n \n \n \n \n \n M5-9yr20-2\n \n \n \n \n \n \n M5-9yr25-3\n \n \n \n \n \n \n M5-9yr4-5\n \n \n \n \n \n \n M5-9yr6-9\n \n \n \n \n \n \n M5-9yr>=35\n \n \n \n \n \n \n M<1yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1yr10-13\n \n \n \n \n \n \n M<1yr14-19\n \n \n \n \n \n \n M<1yr20-24\n \n \n \n \n \n \n M<1yr25-34\n \n \n \n \n \n \n M<1yr4-5\n \n \n \n \n \n \n M<1yr6-9\n \n \n \n \n \n \n M<1yr>=35\n \n \n \n \n \n \n','2023-07-26 13:31:22',4,'2023-08-14 13:10:49',4,0,NULL,NULL,NULL,'5de7def7-e11b-404b-b30a-1dd8dab09558'),(2191,'Children ARV Regimen_1stLine_4E','Children ARV Regimen_1stLine_4E','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4E\n Children ARV Regimen_1stLine_4E\n \n 2023-07-28 07:21:30 UTC\n \n 2023-07-28 07:21:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2191\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-07-28 09:21:30',4,'2023-07-28 09:21:51',4,0,NULL,NULL,NULL,'e3824d29-b132-4875-b0a9-b5dea1536b22'),(2192,'Children ARV Regimen_1stLine_4E Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4E Data Set\n \n 2023-07-28 07:21:51 UTC\n \n 2023-08-14 15:40:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2192\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4y0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4y10-13\n \n \n \n \n \n \n \n \n \n F1-4y14-19\n \n \n \n \n \n \n \n \n \n F1-4y20-24\n \n \n \n \n \n \n \n \n \n F1-4y25-34\n \n \n \n \n \n \n \n \n \n F1-4y35>=\n \n \n \n \n \n \n \n \n \n F1-4y4-5\n \n \n \n \n \n \n \n \n \n F1-4y6-9\n \n \n \n \n \n \n \n \n \n F10-14y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14y10-\n \n \n \n \n \n \n F10-14y14-\n \n \n \n \n \n \n F10-14y20-\n \n \n \n \n \n \n F10-14y25-\n \n \n \n \n \n \n F10-14y35>\n \n \n \n \n \n \n F10-14y4-5\n \n \n \n \n \n \n F10-14y6-9\n \n \n \n \n \n \n F5-9y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9y10-13\n \n \n \n \n \n \n F5-9y14-19\n \n \n \n \n \n \n F5-9y20-24\n \n \n \n \n \n \n F5-9y25-34\n \n \n \n \n \n \n F5-9y35>=\n \n \n \n \n \n \n F5-9y4-5\n \n \n \n \n \n \n F5-9y6-9\n \n \n \n \n \n \n F<1y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1y10-13\n \n \n \n \n \n \n F<1y14-19\n \n \n \n \n \n \n F<1y20-24\n \n \n \n \n \n \n F<1y25-34\n \n \n \n \n \n \n F<1y35>=\n \n \n \n \n \n \n F<1y4-5\n \n \n \n \n \n \n F<1y6-9\n \n \n \n \n \n \n M1-4Y25-34\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4y0-3\n \n \n \n \n \n \n M1-4y10-13\n \n \n \n \n \n \n M1-4y14-19\n \n \n \n \n \n \n M1-4y20-24\n \n \n \n \n \n \n M1-4y35>=\n \n \n \n \n \n \n M1-4y4-5\n \n \n \n \n \n \n M1-4y6-9\n \n \n \n \n \n \n M10-14y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14y10-\n \n \n \n \n \n \n M10-14y14-\n \n \n \n \n \n \n M10-14y20-\n \n \n \n \n \n \n M10-14y25-\n \n \n \n \n \n \n M10-14y35>\n \n \n \n \n \n \n M10-14y4-5\n \n \n \n \n \n \n M10-14y6-9\n \n \n \n \n \n \n M5-9y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9y10-13\n \n \n \n \n \n \n M5-9y14-19\n \n \n \n \n \n \n M5-9y20-24\n \n \n \n \n \n \n M5-9y25-34\n \n \n \n \n \n \n M5-9y35>=\n \n \n \n \n \n \n M5-9y4-5\n \n \n \n \n \n \n M5-9y6-9\n \n \n \n \n \n \n M<1y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1y10-13\n \n \n \n \n \n \n M<1y14-19\n \n \n \n \n \n \n M<1y20-24\n \n \n \n \n \n \n M<1y25-34\n \n \n \n \n \n \n M<1y35>=\n \n \n \n \n \n \n M<1y4-5\n \n \n \n \n \n \n M<1y6-9\n \n \n \n \n \n \n','2023-07-28 07:21:51',4,'2023-08-14 15:40:40',4,0,NULL,NULL,NULL,'27162fa8-89a6-405a-b3c2-d79250d1fa72'),(2194,'Children ARV Regimen_1stLine_4E Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4E Data Set\n \n 2023-07-28 07:29:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n \n \n','2023-07-28 09:29:51',4,NULL,NULL,0,NULL,NULL,NULL,'4c11a721-c504-4075-a7aa-68b823c3d7cb'),(2196,'Children ARV Regimen_1stLine_4F','Children ARV Regimen_1stLine_4F disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4F\n Children ARV Regimen_1stLine_4F disaggregated by weight, sex, age\n \n 2023-07-28 07:58:35 UTC\n \n 2023-07-28 07:59:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2196\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-07-28 09:58:35',4,'2023-07-28 09:59:11',4,0,NULL,NULL,NULL,'0ee0e4f3-4bf0-43ee-be59-cb45d9ab0328'),(2197,'Children ARV Regimen_1stLine_4F Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4F Data Set\n \n 2023-07-28 07:59:11 UTC\n \n 2023-08-14 16:08:09 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2197\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4>=35\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4y0-3\n \n \n \n \n \n \n \n \n \n F1-4y10-13\n \n \n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F1-4y14-19\n \n \n \n \n \n \n \n \n \n F1-4y20-24\n \n \n \n \n \n \n \n \n \n F1-4y25-34\n \n \n \n \n \n \n \n \n \n F1-4y4-5\n \n \n \n \n \n \n \n \n \n F1-4y6-9\n \n \n \n \n \n \n \n \n \n F10-14y0-3\n \n \n \n \n \n \n F10-14y10-\n \n \n \n \n \n \n F10-14y14-\n \n \n \n \n \n \n F10-14y20-\n \n \n \n \n \n \n F10-14y25-\n \n \n \n \n \n \n F10-14y4-5\n \n \n \n \n \n \n F10-14y6-9\n \n \n \n \n \n \n F10-14y>=3\n \n \n \n \n \n \n F5-9y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9y10-13\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9y14-19\n \n \n \n \n \n \n F5-9y20-24\n \n \n \n \n \n \n F5-9y25-34\n \n \n \n \n \n \n F5-9y4-5\n \n \n \n \n \n \n F5-9y6-9\n \n \n \n \n \n \n F5-9y>=35\n \n \n \n \n \n \n F<1y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1y10-13\n \n \n \n \n \n \n F<1y14-19\n \n \n \n \n \n \n F<1y20-24\n \n \n \n \n \n \n F<1y25-34\n \n \n \n \n \n \n F<1y4-5\n \n \n \n \n \n \n F<1y6-9\n \n \n \n \n \n \n F<1y>=35\n \n \n \n \n \n \n M1-4y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4y10-13\n \n \n \n \n \n \n M1-4y14-19\n \n \n \n \n \n \n M1-4y20-24\n \n \n \n \n \n \n M1-4y25-34\n \n \n \n \n \n \n M1-4y4-5\n \n \n \n \n \n \n M1-4y6-9\n \n \n \n \n \n \n M1-4y>=35\n \n \n \n \n \n \n M10-14y\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14y0-3\n \n \n \n \n \n \n M10-14y10-\n \n \n \n \n \n \n M10-14y14-\n \n \n \n \n \n \n M10-14y25-\n \n \n \n \n \n \n M10-14y4-5\n \n \n \n \n \n \n M10-14y6-9\n \n \n \n \n \n \n M10-14y>=3\n \n \n \n \n \n \n M5-9y0-3\n \n \n \n \n \n \n M5-9y10-13\n \n \n \n \n \n \n M5-9y14-19\n \n \n \n \n \n \n M5-9y20-24\n \n \n \n \n \n \n M5-9y25-34\n \n \n \n \n \n \n M5-9y4-5\n \n \n \n \n \n \n M5-9y6-9\n \n \n \n \n \n \n M5-9y>=35\n \n \n \n \n \n \n M<1y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1y10-13\n \n \n \n \n \n \n M<1y14-19\n \n \n \n \n \n \n M<1y20-24\n \n \n \n \n \n \n M<1y25-34\n \n \n \n \n \n \n M<1y4-5\n \n \n \n \n \n \n M<1y6-9\n \n \n \n \n \n \n M<1y>=35\n \n \n \n \n \n \n','2023-07-28 07:59:11',4,'2023-08-14 16:08:09',4,0,NULL,NULL,NULL,'88a32f53-ea23-4ad9-9673-98bde635a960'),(2198,'Children ARV Regimen_1stLine_4G','Children ARV Regimen_1stLine_4G','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4G\n Children ARV Regimen_1stLine_4G\n \n 2023-07-28 10:06:07 UTC\n \n 2023-07-28 10:06:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2198\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-07-28 12:06:07',4,'2023-07-28 12:06:18',4,0,NULL,NULL,NULL,'0827caea-7bbc-4d28-b47d-e04cebd43d96'),(2199,'Children ARV Regimen_1stLine_4G Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4G Data Set\n \n 2023-07-28 10:06:18 UTC\n \n 2023-08-14 16:22:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2199\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4y0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4y10-13\n \n \n \n \n \n \n \n \n \n F1-4y14-19\n \n \n \n \n \n \n \n \n \n F1-4y20-24\n \n \n \n \n \n \n \n \n \n F1-4y25-34\n \n \n \n \n \n \n \n \n \n F1-4y35>=\n \n \n \n \n \n \n \n \n \n F1-4y4-5\n \n \n \n \n \n \n \n \n \n F1-4y6-9\n \n \n \n \n \n \n \n \n \n F10-14y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14y10-\n \n \n \n \n \n \n F10-14y14-\n \n \n \n \n \n \n F10-14y20-\n \n \n \n \n \n \n F10-14y25-\n \n \n \n \n \n \n F10-14y35>\n \n \n \n \n \n \n F10-14y4-5\n \n \n \n \n \n \n F10-14y6-9\n \n \n \n \n \n \n F5-9y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9y10-13\n \n \n \n \n \n \n F5-9y14-19\n \n \n \n \n \n \n F5-9y20-24\n \n \n \n \n \n \n F5-9y25-34\n \n \n \n \n \n \n F5-9y35>=\n \n \n \n \n \n \n F5-9y4-5\n \n \n \n \n \n \n F5-9y6-9\n \n \n \n \n \n \n F<1y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1y10-13\n \n \n \n \n \n \n F<1y14-19\n \n \n \n \n \n \n F<1y20-24\n \n \n \n \n \n \n F<1y25-34\n \n \n \n \n \n \n F<1y35>=\n \n \n \n \n \n \n F<1y4-5\n \n \n \n \n \n \n F<1y6-9\n \n \n \n \n \n \n M1-4y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4y10-13\n \n \n \n \n \n \n M1-4y14-19\n \n \n \n \n \n \n M1-4y20-24\n \n \n \n \n \n \n M1-4y25-34\n \n \n \n \n \n \n M1-4y35>=\n \n \n \n \n \n \n M1-4y4-5\n \n \n \n \n \n \n M1-4y6-9\n \n \n \n \n \n \n M10-14y-25\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14y0-3\n \n \n \n \n \n \n M10-14y10-\n \n \n \n \n \n \n M10-14y14-\n \n \n \n \n \n \n M10-14y20-\n \n \n \n \n \n \n M10-14y35>\n \n \n \n \n \n \n M10-14y4-5\n \n \n \n \n \n \n M10-14y6-9\n \n \n \n \n \n \n M5-9y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9y10-13\n \n \n \n \n \n \n M5-9y14-19\n \n \n \n \n \n \n M5-9y20-24\n \n \n \n \n \n \n M5-9y25-34\n \n \n \n \n \n \n M5-9y35>=\n \n \n \n \n \n \n M5-9y4-5\n \n \n \n \n \n \n M5-9y6-9\n \n \n \n \n \n \n M<1y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1y10-13\n \n \n \n \n \n \n M<1y14-19\n \n \n \n \n \n \n M<1y20-24\n \n \n \n \n \n \n M<1y24-34\n \n \n \n \n \n \n M<1y35>=\n \n \n \n \n \n \n M<1y4-5\n \n \n \n \n \n \n M<1y6-9\n \n \n \n \n \n \n','2023-07-28 10:06:18',4,'2023-08-14 16:22:43',4,0,NULL,NULL,NULL,'f61713b8-60c1-48f1-bab8-d0bf3046b3e1'),(2200,'Children ARV Regimen_1stLine_4H','Children ARV Regimen_1stLine_4H','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4H\n Children ARV Regimen_1stLine_4H\n \n 2023-07-28 10:19:42 UTC\n \n 2023-07-28 10:19:49 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2200\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-07-28 12:19:42',4,'2023-07-28 12:19:49',4,0,NULL,NULL,NULL,'f672b96f-7df9-48fa-b49e-a9946b7540e8'),(2201,'Children ARV Regimen_1stLine_4H Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4H Data Set\n \n 2023-07-28 10:19:49 UTC\n \n 2023-08-14 16:43:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2201\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4yr0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4yr10-1\n \n \n \n \n \n \n \n \n \n F1-4yr14-1\n \n \n \n \n \n \n \n \n \n F1-4yr20-2\n \n \n \n \n \n \n \n \n \n F1-4yr25-3\n \n \n \n \n \n \n \n \n \n F1-4yr4-5\n \n \n \n \n \n \n \n \n \n F1-4yr6-9\n \n \n \n \n \n \n \n \n \n F1-4yr>=35\n \n \n \n \n \n \n \n \n \n F10-14yr0-\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14yr10\n \n \n \n \n \n \n F10-14yr14\n \n \n \n \n \n \n F10-14yr20\n \n \n \n \n \n \n F10-14yr25\n \n \n \n \n \n \n F10-14yr35\n \n \n \n \n \n \n F10-14yr4-\n \n \n \n \n \n \n F10-14yr6-\n \n \n \n \n \n \n F5-9yr0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9yr10-1\n \n \n \n \n \n \n F5-9yr14-1\n \n \n \n \n \n \n F5-9yr20-2\n \n \n \n \n \n \n F5-9yr25-3\n \n \n \n \n \n \n F5-9yr4-5\n \n \n \n \n \n \n F5-9yr6-9\n \n \n \n \n \n \n F5-9yr>=35\n \n \n \n \n \n \n F<1yr0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1yr10-13\n \n \n \n \n \n \n F<1yr14-19\n \n \n \n \n \n \n F<1yr20-24\n \n \n \n \n \n \n F<1yr25-34\n \n \n \n \n \n \n F<1yr4-5\n \n \n \n \n \n \n F<1yr6-9\n \n \n \n \n \n \n F<1yr>=35\n \n \n \n \n \n \n M1-4yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4yr10-1\n \n \n \n \n \n \n M1-4yr14-1\n \n \n \n \n \n \n M1-4yr20-2\n \n \n \n \n \n \n M1-4yr25-3\n \n \n \n \n \n \n M1-4yr4-5\n \n \n \n \n \n \n M1-4yr6-9\n \n \n \n \n \n \n M1-4yr>=35\n \n \n \n \n \n \n M10-14yr0-\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14yr10\n \n \n \n \n \n \n M10-14yr14\n \n \n \n \n \n \n M10-14yr20\n \n \n \n \n \n \n M10-14yr25\n \n \n \n \n \n \n M10-14yr35\n \n \n \n \n \n \n M10-14yr4-\n \n \n \n \n \n \n M10-14yr6-\n \n \n \n \n \n \n M5-9yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9yr10-1\n \n \n \n \n \n \n M5-9yr14-1\n \n \n \n \n \n \n M5-9yr20-2\n \n \n \n \n \n \n M5-9yr25-3\n \n \n \n \n \n \n M5-9yr4-5\n \n \n \n \n \n \n M5-9yr6-9\n \n \n \n \n \n \n M5-9yr>=35\n \n \n \n \n \n \n M<1yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1yr10-13\n \n \n \n \n \n \n M<1yr14-19\n \n \n \n \n \n \n M<1yr20-24\n \n \n \n \n \n \n M<1yr25-34\n \n \n \n \n \n \n M<1yr4-5\n \n \n \n \n \n \n M<1yr6-9\n \n \n \n \n \n \n M<1yr>=35\n \n \n \n \n \n \n','2023-07-28 10:19:49',4,'2023-08-14 16:43:42',4,0,NULL,NULL,NULL,'014c9e79-d8d0-4226-8d86-869e879fb6ce'),(2202,'Children ARV Regimen_1stLine_4J',' Children ARV Regimen_1stLine_4J disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4J\n Children ARV Regimen_1stLine_4J disaggregated by weight, sex, age\n \n 2023-07-28 10:40:17 UTC\n \n 2023-07-28 10:40:24 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2202\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-07-28 12:40:17',4,'2023-07-28 12:40:24',4,0,NULL,NULL,NULL,'4390ec11-9cbe-42bd-888e-e681da953912'),(2203,'Children ARV Regimen_1stLine_4J Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4J Data Set\n \n 2023-07-28 10:40:24 UTC\n \n 2023-08-14 17:17:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2203\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4y0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4y10-13\n \n \n \n \n \n \n \n \n \n F1-4y14-19\n \n \n \n \n \n \n \n \n \n F1-4y20-24\n \n \n \n \n \n \n \n \n \n F1-4y25-34\n \n \n \n \n \n \n \n \n \n F1-4y35>=\n \n \n \n \n \n \n \n \n \n F1-4y4-5\n \n \n \n \n \n \n \n \n \n F1-4y6-9\n \n \n \n \n \n \n \n \n \n F10-14y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14y10-\n \n \n \n \n \n \n F10-14y14-\n \n \n \n \n \n \n F10-14y20-\n \n \n \n \n \n \n F10-14y25-\n \n \n \n \n \n \n F10-14y35>\n \n \n \n \n \n \n F10-14y4-5\n \n \n \n \n \n \n F10-14y6-9\n \n \n \n \n \n \n F5-9y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9y10-13\n \n \n \n \n \n \n F5-9y14-19\n \n \n \n \n \n \n F5-9y20-24\n \n \n \n \n \n \n F5-9y25-34\n \n \n \n \n \n \n F5-9y35>=\n \n \n \n \n \n \n F5-9y4-5\n \n \n \n \n \n \n F5-9y6-9\n \n \n \n \n \n \n F<1y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1y10-13\n \n \n \n \n \n \n F<1y14-19\n \n \n \n \n \n \n F<1y20-24\n \n \n \n \n \n \n F<1y25-34\n \n \n \n \n \n \n F<1y35>=\n \n \n \n \n \n \n F<1y6-9\n \n \n \n \n \n \n F<1yr4-5\n \n \n \n \n \n \n M1-4y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4y10-13\n \n \n \n \n \n \n M1-4y14-19\n \n \n \n \n \n \n M1-4y20-24\n \n \n \n \n \n \n M1-4y25-34\n \n \n \n \n \n \n M1-4y35>=\n \n \n \n \n \n \n M1-4y4-5\n \n \n \n \n \n \n M1-4y6-9\n \n \n \n \n \n \n M10-14y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14y10-\n \n \n \n \n \n \n M10-14y14-\n \n \n \n \n \n \n M10-14y20-\n \n \n \n \n \n \n M10-14y25-\n \n \n \n \n \n \n M10-14y35>\n \n \n \n \n \n \n M10-14y4-5\n \n \n \n \n \n \n M10-14y6-9\n \n \n \n \n \n \n M5-9y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9y10-13\n \n \n \n \n \n \n M5-9y14-19\n \n \n \n \n \n \n M5-9y20-24\n \n \n \n \n \n \n M5-9y25-34\n \n \n \n \n \n \n M5-9y35>=\n \n \n \n \n \n \n M5-9y4-5\n \n \n \n \n \n \n M5-9y6-9\n \n \n \n \n \n \n M<1y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1y10-13\n \n \n \n \n \n \n M<1y14-19\n \n \n \n \n \n \n M<1y20-24\n \n \n \n \n \n \n M<1y25-34\n \n \n \n \n \n \n M<1y35>=\n \n \n \n \n \n \n M<1y6-9\n \n \n \n \n \n \n M<1yr4-5\n \n \n \n \n \n \n','2023-07-28 10:40:24',4,'2023-08-14 17:17:03',4,0,NULL,NULL,NULL,'b1b5ff26-4220-44b4-856e-88b7e9d39451'),(2204,'Children ARV Regimen_1stLine_4K','Children ARV Regimen_1stLine_4K disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4K\n Children ARV Regimen_1stLine_4K disaggregated by weight, sex, age\n \n 2023-07-31 11:04:52 UTC\n \n 2023-07-31 11:04:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2204\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-07-31 13:04:52',4,'2023-07-31 13:04:59',4,0,NULL,NULL,NULL,'635157c8-9203-475c-bc08-998a880fa244'),(2205,'Children ARV Regimen_1stLine_4K Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4K Data Set\n \n 2023-07-31 11:04:59 UTC\n \n 2023-08-14 17:30:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2205\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4>=35\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4y0-3\n \n \n \n \n \n \n \n \n \n F1-4y10-13\n \n \n \n \n \n \n \n \n \n F1-4y14-19\n \n \n \n \n \n \n \n \n \n F1-4y20-24\n \n \n \n \n \n \n \n \n \n F1-4y25-34\n \n \n \n \n \n \n \n \n \n F1-4y4-5\n \n \n \n \n \n \n \n \n \n F1-4y6-9\n \n \n \n \n \n \n \n \n \n F10-14y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14y10-\n \n \n \n \n \n \n F10-14y14-\n \n \n \n \n \n \n F10-14y20-\n \n \n \n \n \n \n F10-14y25-\n \n \n \n \n \n \n F10-14y4-5\n \n \n \n \n \n \n F10-14y6-9\n \n \n \n \n \n \n F10-14y>=3\n \n \n \n \n \n \n F5-9y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9y10-13\n \n \n \n \n \n \n F5-9y14-19\n \n \n \n \n \n \n F5-9y20-24\n \n \n \n \n \n \n F5-9y25-34\n \n \n \n \n \n \n F5-9y4-5\n \n \n \n \n \n \n F5-9y6-9\n \n \n \n \n \n \n F5-9y>=35\n \n \n \n \n \n \n F<1y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1y10-13\n \n \n \n \n \n \n F<1y14-19\n \n \n \n \n \n \n F<1y20-24\n \n \n \n \n \n \n F<1y25-34\n \n \n \n \n \n \n F<1y4-5\n \n \n \n \n \n \n F<1y6-9\n \n \n \n \n \n \n F<1y>=35\n \n \n \n \n \n \n M1-4y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4y10-13\n \n \n \n \n \n \n M1-4y14-19\n \n \n \n \n \n \n M1-4y20-24\n \n \n \n \n \n \n M1-4y25-34\n \n \n \n \n \n \n M1-4y4-5\n \n \n \n \n \n \n M1-4y6-9\n \n \n \n \n \n \n M1-4y>=35\n \n \n \n \n \n \n M10-14y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14y10-\n \n \n \n \n \n \n M10-14y14-\n \n \n \n \n \n \n M10-14y20-\n \n \n \n \n \n \n M10-14y25-\n \n \n \n \n \n \n M10-14y4-5\n \n \n \n \n \n \n M10-14y6-9\n \n \n \n \n \n \n M10-14y>=3\n \n \n \n \n \n \n M5-9y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9y10-13\n \n \n \n \n \n \n M5-9y14-19\n \n \n \n \n \n \n M5-9y20-24\n \n \n \n \n \n \n M5-9y25-34\n \n \n \n \n \n \n M5-9y4-5\n \n \n \n \n \n \n M5-9y6-9\n \n \n \n \n \n \n M5-9y>=35\n \n \n \n \n \n \n M<1y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1y10-13\n \n \n \n \n \n \n M<1y14-19\n \n \n \n \n \n \n M<1y20-24\n \n \n \n \n \n \n M<1y25-34\n \n \n \n \n \n \n M<1y4-5\n \n \n \n \n \n \n M<1y6-9\n \n \n \n \n \n \n M<1y>=35\n \n \n \n \n \n \n','2023-07-31 11:04:59',4,'2023-08-14 17:30:12',4,0,NULL,NULL,NULL,'a3a4b9a1-0d71-4c08-9e4e-486f87840b6e'),(2206,'Children ARV Regimen_1stLine_4L','Children ARV Regimen_1stLine_4L','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4L\n Children ARV Regimen_1stLine_4L\n \n 2023-07-31 11:19:07 UTC\n \n 2023-07-31 11:19:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2206\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-07-31 13:19:07',4,'2023-07-31 13:19:14',4,0,NULL,NULL,NULL,'646bc981-856b-4f66-b545-eb5843952af7'),(2207,'Children ARV Regimen_1stLine_4L Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4L Data Set\n \n 2023-07-31 11:19:14 UTC\n \n 2023-08-14 17:43:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2207\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4yr0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4yr10-1\n \n \n \n \n \n \n \n \n \n F1-4yr14-1\n \n \n \n \n \n \n \n \n \n F1-4yr20-2\n \n \n \n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4yr25-3\n \n \n \n \n \n \n \n \n \n F1-4yr4-5\n \n \n \n \n \n \n \n \n \n F1-4yr6-9\n \n \n \n \n \n \n \n \n \n F1-4yr>=35\n \n \n \n \n \n \n \n \n \n F10-14yr0-\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14yr10\n \n \n \n \n \n \n F10-14yr14\n \n \n \n \n \n \n F10-14yr20\n \n \n \n \n \n \n F10-14yr25\n \n \n \n \n \n \n F10-14yr35\n \n \n \n \n \n \n F10-14yr4-\n \n \n \n \n \n \n F10-14yr6-\n \n \n \n \n \n \n F5-9yr0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9yr10-1\n \n \n \n \n \n \n F5-9yr14-1\n \n \n \n \n \n \n F5-9yr20-2\n \n \n \n \n \n \n F5-9yr25-3\n \n \n \n \n \n \n F5-9yr4-5\n \n \n \n \n \n \n F5-9yr6-9\n \n \n \n \n \n \n F5-9yr>=35\n \n \n \n \n \n \n F<1yr0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1yr10-13\n \n \n \n \n \n \n F<1yr14-19\n \n \n \n \n \n \n F<1yr20-24\n \n \n \n \n \n \n F<1yr25-34\n \n \n \n \n \n \n F<1yr4-5\n \n \n \n \n \n \n F<1yr6-9\n \n \n \n \n \n \n F<1yr>=35\n \n \n \n \n \n \n M1-4yr0-3\n \n \n \n \n \n \n M1-4yr10-1\n \n \n \n \n \n \n M1-4yr14-1\n \n \n \n \n \n \n M1-4yr20-2\n \n \n \n \n \n \n M1-4yr25-3\n \n \n \n \n \n \n M1-4yr4-5\n \n \n \n \n \n \n M1-4yr6-9\n \n \n \n \n \n \n M1-4yr>=35\n \n \n \n \n \n \n M10-14yr0-\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14yr10\n \n \n \n \n \n \n M10-14yr14\n \n \n \n \n \n \n M10-14yr20\n \n \n \n \n \n \n M10-14yr25\n \n \n \n \n \n \n M10-14yr35\n \n \n \n \n \n \n M10-14yr4-\n \n \n \n \n \n \n M10-14yr6-\n \n \n \n \n \n \n M5-9yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9yr10-1\n \n \n \n \n \n \n M5-9yr14-1\n \n \n \n \n \n \n M5-9yr20-2\n \n \n \n \n \n \n M5-9yr25-3\n \n \n \n \n \n \n M5-9yr4-5\n \n \n \n \n \n \n M5-9yr6-9\n \n \n \n \n \n \n M5-9yr>=35\n \n \n \n \n \n \n M<1yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1yr10-13\n \n \n \n \n \n \n M<1yr14-19\n \n \n \n \n \n \n M<1yr20-24\n \n \n \n \n \n \n M<1yr25-34\n \n \n \n \n \n \n M<1yr4-5\n \n \n \n \n \n \n M<1yr6-9\n \n \n \n \n \n \n M<1yr>=35\n \n \n \n \n \n \n','2023-07-31 11:19:14',4,'2023-08-14 17:43:21',4,0,NULL,NULL,NULL,'f228bb0b-0af6-48b3-afeb-8b1e4e21feb3'),(2208,'Clients given 4C with >=20 copies viral load','Clients given 4C with >=20 copies viral load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C with >=20 copies viral load\n Clients given 4C with >=20 copies viral load\n \n 2023-08-07 11:49:27 UTC\n \n 2023-08-14 11:19:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2208\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2202)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \n \n \non Active_Patients.Id = greaterThan20.Id \n)) \n \n\n','2023-08-07 11:49:27',4,'2023-08-14 11:19:55',4,0,NULL,NULL,NULL,'5a765ffd-b4ff-4899-ba79-aae76385d5d9'),(2209,'Clients given 4C with >=20 copies viral load','Clients given 4C with >=20 copies viral load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C with >=20 copies viral load\n Clients given 4C with >=20 copies viral load\n \n 2023-08-07 14:15:14 UTC\n \n 2023-08-07 14:18:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2209\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 16:15:14',4,'2023-08-07 16:18:06',4,0,NULL,NULL,NULL,'6942c194-b069-44c3-a161-b77891d7f06c'),(2210,'Children ARV Regimen_1stLine_Viral_Load','Children ARV Regimen_1stLine_Viral_Load','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_Viral_Load\n Children ARV Regimen_1stLine_Viral_Load\n \n 2023-08-07 14:19:54 UTC\n \n 2023-08-08 20:10:19 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2210\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-07 16:19:54',4,'2023-08-08 22:10:19',4,0,NULL,NULL,NULL,'400088e7-a254-4fac-8a59-eac6dc9d177b'),(2211,'Children ARV Regimen_1stLine_4C_>20Copies_Viraload Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4C_>20Copies_Viraload Data Set\n \n 2023-08-07 14:20:07 UTC\n \n 2023-12-20 07:10:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2211\n \n \n \n 4C<20\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n \n \n 4C>=20\n \n \n \n \n \n \n \n \n \n 4CUndetect\n \n \n \n \n \n \n \n \n \n 4D<20\n \n \n \n \n \n \n \n \n \n 4D>=20\n \n \n \n \n \n \n \n \n \n 4DUndetect\n \n \n \n \n \n \n \n \n \n 4E<20\n \n \n \n \n \n \n \n \n \n 4E>=20\n \n \n \n \n \n \n \n \n \n 4EUndetect\n \n \n \n \n \n \n \n \n \n 4F<20\n \n \n \n \n \n \n \n \n \n 4F>=20\n \n \n \n \n \n \n \n \n \n 4FUndetect\n \n \n \n \n \n \n \n \n \n 4G<20\n \n \n \n \n \n \n \n \n \n 4G>=20\n \n \n \n \n \n \n \n \n \n 4GUndetect\n \n \n \n \n \n \n \n \n \n 4H<20\n \n \n \n \n \n \n \n \n \n 4H>=20\n \n \n \n \n \n \n \n \n \n 4HUndetect\n \n \n \n \n \n \n \n \n \n 4J<20\n \n \n \n \n \n \n \n \n \n 4J>=20\n \n \n \n \n \n \n \n \n \n 4JUndetect\n \n \n \n \n \n \n \n \n \n 4K<20\n \n \n \n \n \n \n \n \n \n 4K>=20\n \n \n \n \n \n \n \n \n \n 4KUndetect\n \n \n \n \n \n \n \n \n \n 4L<20\n \n \n \n \n \n \n \n \n \n 4L>=20\n \n \n \n \n \n \n \n \n \n 4LUndetect\n \n \n \n \n \n \n \n \n \n','2023-08-07 16:20:07',4,'2023-12-20 09:10:01',4,0,NULL,NULL,NULL,'96eef8c5-dc41-4f3f-9e62-4004c11fb291'),(2212,'Clients given 4D with >=20 Copies Viral Load','Clients given 4D with >=20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D with >=20 Copies Viral Load\n Clients given 4D with >=20 Copies Viral Load\n \n 2023-08-07 14:40:38 UTC\n \n 2023-08-14 11:22:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2212\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4d \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2204)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n -- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-07 14:40:38',4,'2023-08-14 11:22:44',4,0,NULL,NULL,NULL,'41de8523-3ab9-4284-a0b1-f0298f2da510'),(2213,'Clients given 4E with >=20 Copies Viral Load','Clients given 4E with >=20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E with >=20 Copies Viral Load\n Clients given 4E with >=20 Copies Viral Load\n \n 2023-08-07 14:50:06 UTC\n \n 2023-08-14 11:23:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2213\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3679)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-07 14:50:06',4,'2023-08-14 11:23:53',4,0,NULL,NULL,NULL,'c1f2fd48-a980-4af6-93f0-08598fd57995'),(2214,'Clients given 4F with >=20 copies viral load','Clients given 4F with >=20 copies viral load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F with >=20 copies viral load\n Clients given 4F with >=20 copies viral load\n \n 2023-08-07 15:02:48 UTC\n \n 2023-08-14 11:29:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2214\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3680)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n -- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-07 15:02:48',4,'2023-08-14 11:29:08',4,0,NULL,NULL,NULL,'1605d858-dca2-4c0d-bb6f-967424aed8ad'),(2215,'Clients given 4H with >=20 Copies Viral Load','Clients given 4H with >=20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H with >=20 Copies Viral Load\n Clients given 4H with >=20 Copies Viral Load\n \n 2023-08-07 15:11:34 UTC\n \n 2023-08-14 11:47:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2215\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4685)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n -- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-07 15:11:34',4,'2023-08-14 11:47:45',4,0,NULL,NULL,NULL,'07781cf0-2cc5-497b-b9a3-dafc63842da1'),(2216,'Clients given 4J with >=20 Copies Viral Load','Clients given 4J weighing >=20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J with >=20 Copies Viral Load\n Clients given 4J weighing >=20 Copies Viral Load\n \n 2023-08-07 15:32:07 UTC\n \n 2023-08-14 11:49:33 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2216\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4J \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-07 15:32:07',4,'2023-08-14 11:49:33',4,0,NULL,NULL,NULL,'180f7359-ac4f-4728-ae43-8208ebf052cb'),(2217,'Clients given 4K with >=20 Copies Viral Load','Clients given 4K with >=20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K with >=20 Copies Viral Load\n Clients given 4K with >=20 Copies Viral Load\n \n 2023-08-07 15:41:37 UTC\n \n 2023-08-14 11:51:49 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2217\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4K \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-07 15:41:37',4,'2023-08-14 11:51:49',4,0,NULL,NULL,NULL,'a5a07716-681f-44bd-84ef-391d51ace7c9'),(2218,'Clients given 4L with >=20 Copies Viral Load','Clients given 4L with >=20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L with >=20 Copies Viral Load\n Clients given 4L with >=20 Copies Viral Load\n \n 2023-08-07 15:45:38 UTC\n \n 2023-12-20 07:15:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2218\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4L \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4688)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n -- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-07 17:45:38',4,'2023-12-20 09:15:07',4,0,NULL,NULL,NULL,'606f20bd-cac9-4282-a3c4-56b9f72ded30'),(2219,'Clients given 4C with <20 copies Viral Load','Clients given 4C with <20 copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C with <20 copies Viral Load\n Clients given 4C with <20 copies Viral Load\n \n 2023-08-07 15:55:07 UTC\n \n 2023-08-14 11:20:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2219\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2202)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-07 15:55:07',4,'2023-08-14 11:20:12',4,0,NULL,NULL,NULL,'5571d546-89fc-4cda-bc4d-fab1f629ce7a'),(2220,'Clients given 4C with Undetectable Viral Load','Clients given 4C with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C with Undetectable Viral Load\n Clients given 4C with Undetectable Viral Load\n \n 2023-08-07 15:57:44 UTC\n \n 2023-08-14 11:19:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2220\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2202)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- undetectable, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-07 15:57:44',4,'2023-08-14 11:19:40',4,0,NULL,NULL,NULL,'eaa0d4ac-c56c-4a8a-b2ca-12a462b06874'),(2221,'Clients given 4D with <20 Copies Viral Load','Clients given 4D with <20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D with <20 Copies Viral Load\n Clients given 4D with <20 Copies Viral Load\n \n 2023-08-07 16:09:50 UTC\n \n 2023-08-14 11:23:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2221\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4d \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2204)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n -- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-07 16:09:50',4,'2023-08-14 11:23:00',4,0,NULL,NULL,NULL,'60e4edc3-d202-4e5c-b9d1-a4791c874209'),(2222,'Clients given 4D with Undetectable Viral Load','Clients given 4D with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D with Undetectable Viral Load\n Clients given 4D with Undetectable Viral Load\n \n 2023-08-07 16:11:59 UTC\n \n 2023-08-14 11:22:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2222\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4d \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2204)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n -- Undetectable Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable Copies \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-07 16:11:59',4,'2023-08-14 11:22:23',4,0,NULL,NULL,NULL,'2da8e7c6-793e-42f3-994a-0dc0e72464ae'),(2223,'Clients given 4E with <20 Copies Viral Load','Clients given 4E with <20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E with <20 Copies Viral Load\n Clients given 4E with <20 Copies Viral Load\n \n 2023-08-07 16:18:03 UTC\n \n 2023-08-14 11:26:22 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2223\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3679)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-07 16:18:03',4,'2023-08-14 11:26:22',4,0,NULL,NULL,NULL,'72e755a7-cbbc-4ccd-be81-7bedf125f8c4'),(2224,'Clients given 4E with Undetectable Viral Load','Clients given 4E with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E with Undetectable Viral Load\n Clients given 4E with Undetectable Viral Load\n \n 2023-08-07 16:20:52 UTC\n \n 2023-08-14 12:07:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2224\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3679)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Undetectable, Viral load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-07 16:20:52',4,'2023-08-14 12:07:26',4,0,NULL,NULL,NULL,'1d7a46e2-8d42-4f34-8958-f5cf962db589'),(2225,'Clients given 4F with <20 copies viral load','Clients given 4F with <20 copies viral load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F with <20 copies viral load\n Clients given 4F with <20 copies viral load\n \n 2023-08-07 16:26:02 UTC\n \n 2023-08-14 11:29:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2225\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3680)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-07 16:26:02',4,'2023-08-14 11:29:28',4,0,NULL,NULL,NULL,'3c193bb3-64d6-4b71-9069-0b53083963e2'),(2226,'Clients given 4F with Undetectable viral load','Clients given 4F with Undetectable copies viral load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F with Undetectable viral load\n Clients given 4F with Undetectable copies viral load\n \n 2023-08-07 16:28:54 UTC\n \n 2023-08-14 11:28:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2226\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3680)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-07 16:28:54',4,'2023-08-14 11:28:42',4,0,NULL,NULL,NULL,'978dc8c8-3f02-4e20-9fb5-302be9fbf23c'),(2227,'Clients given 4G with >=20 Copies Viral Load','Clients given 4G with >=20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G with >=20 Copies Viral Load\n Clients given 4G with >=20 Copies Viral Load\n \n 2023-08-07 16:32:35 UTC\n \n 2023-08-14 11:45:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2227\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4684)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-07 16:32:35',4,'2023-08-14 11:45:02',4,0,NULL,NULL,NULL,'41d9cb1b-b376-4e21-aa6c-7dce59197a97'),(2228,'Clients given 4G with <20 copies Viral_Load','Clients given 4G with <20 copies Viral_Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G with <20 copies Viral_Load\n Clients given 4G with <20 copies Viral_Load\n \n 2023-08-07 16:34:54 UTC\n \n 2023-08-14 11:44:33 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2228\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4684)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-07 16:34:54',4,'2023-08-14 11:44:33',4,0,NULL,NULL,NULL,'80ebb214-6a46-4379-9a31-3e3cbbb05566'); +INSERT INTO `serialized_object` VALUES (2229,'Clients given 4G with Undetectable Viral Load','Clients given 4G with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G with Undetectable Viral Load\n Clients given 4G with Undetectable Viral Load\n \n 2023-08-07 16:39:28 UTC\n \n 2023-08-14 11:45:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2229\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4684)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- Undetectable Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable Copies \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-07 16:39:28',4,'2023-08-14 11:45:51',4,0,NULL,NULL,NULL,'d480aafa-578b-4865-bdd4-e158af437b06'),(2230,'Clients given 4H with <20 Copies Viral Load','Clients given 4H with <20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H with <20 Copies Viral Load\n Clients given 4H with <20 Copies Viral Load\n \n 2023-08-07 16:45:29 UTC\n \n 2023-08-14 11:47:21 UTC\n \n \n endDate\n \n java.util.Date\n true\n \n \n startDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2230\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4685)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-07 16:45:29',4,'2023-08-14 11:47:21',4,0,NULL,NULL,NULL,'5c8ddadc-a50e-4433-afb8-48e1acfc3ed5'),(2231,'Clients given 4H with Undetectable Viral Load','Clients given 4H with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H with Undetectable Viral Load\n Clients given 4H with Undetectable Viral Load\n \n 2023-08-07 16:47:28 UTC\n \n 2023-08-14 11:48:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2231\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4685)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- undetectable, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-07 16:47:28',4,'2023-08-14 11:48:07',4,0,NULL,NULL,NULL,'6d85bd5f-af27-43f5-a456-e1679230a4aa'),(2232,'Clients given 4J with <20 copies Viral Load','Clients given 4J with <20 copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J with <20 copies Viral Load\n Clients given 4J with <20 copies Viral Load\n \n 2023-08-07 16:53:00 UTC\n \n 2023-08-14 11:49:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2232\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4J \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-07 16:53:00',4,'2023-08-14 11:49:15',4,0,NULL,NULL,NULL,'1cf1f1b1-2f40-4e5c-b55b-893716cf2a04'),(2233,'Clients given 4J with Undetectable Viral Load','Clients given 4J with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J with Undetectable Viral Load\n Clients given 4J with Undetectable Viral Load\n \n 2023-08-07 16:57:27 UTC\n \n 2023-08-14 11:49:52 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2233\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4J \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- Undetectable, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable Copies \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-07 16:57:27',4,'2023-08-14 11:49:52',4,0,NULL,NULL,NULL,'e543fa69-cbc5-46c8-a3de-e77abcaa185a'),(2234,'Clients given 4K with <20 Copies Viral Load','Clients given 4K with <20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K with <20 Copies Viral Load\n Clients given 4K with <20 Copies Viral Load\n \n 2023-08-07 17:02:35 UTC\n \n 2023-08-14 11:51:25 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2234\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4K \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-07 17:02:35',4,'2023-08-14 11:51:25',4,0,NULL,NULL,NULL,'54121116-3d51-4a34-ae5c-5b15f1254f6e'),(2235,'Clients given 4K with Undetectable Viral Load','Clients given 4K with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K with Undetectable Viral Load\n Clients given 4K with Undetectable Viral Load\n \n 2023-08-07 17:08:26 UTC\n \n 2023-08-14 11:52:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2235\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4K \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Undetectable, Viral load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-07 17:08:26',4,'2023-08-14 11:52:08',4,0,NULL,NULL,NULL,'d2e6acfd-540a-4220-b160-b104be742043'),(2236,'Clients given 4L with <20 Copies Viral Load','Clients given 4L with <20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L with <20 Copies Viral Load\n Clients given 4L with <20 Copies Viral Load\n \n 2023-08-07 17:13:48 UTC\n \n 2023-08-14 11:54:16 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2236\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4L \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4688)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-07 17:13:48',4,'2023-08-14 11:54:16',4,0,NULL,NULL,NULL,'d4e9e456-61f2-4e2d-8779-52e1dd59a11a'),(2237,'Clients given 4L with Undetectable Viral Load','Clients given 4L with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L with Undetectable Viral Load\n Clients given 4L with Undetectable Viral Load\n \n 2023-08-07 17:17:22 UTC\n \n 2023-08-14 12:04:57 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2237\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4K \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4688)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Undetectable, Viral load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-07 17:17:22',4,'2023-08-14 12:04:57',4,0,NULL,NULL,NULL,'4792ce19-a4f6-4876-9a81-a7e48f279b1b'),(2238,'Clients given 4C with <20 copies Viral Load','Clients given 4C with <20 copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C with <20 copies Viral Load\n Clients given 4C with <20 copies Viral Load\n \n 2023-08-07 17:40:01 UTC\n \n 2023-08-07 17:41:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2238\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 19:40:01',4,'2023-08-07 19:41:50',4,0,NULL,NULL,NULL,'523777b6-edc7-4346-abbb-1eec797d6e5c'),(2239,'Clients given 4C with Undetectable Viral_Load','Clients given 4C with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C with Undetectable Viral_Load\n Clients given 4C with Undetectable Viral Load\n \n 2023-08-07 17:45:29 UTC\n \n 2023-08-07 17:54:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2239\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 19:45:29',4,'2023-08-07 19:54:18',4,0,NULL,NULL,NULL,'b3e08e0a-35ac-4b1c-86e2-2dffaa8b6ce6'),(2240,'Clients given 4D with >=20 Copies Viral Load','Clients given 4D with >=20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D with >=20 Copies Viral Load\n Clients given 4D with >=20 Copies Viral Load\n \n 2023-08-07 17:57:17 UTC\n \n 2023-08-07 17:59:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2240\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 19:57:17',4,'2023-08-07 19:59:18',4,0,NULL,NULL,NULL,'06a65347-260a-49f6-b227-e152d369db09'),(2241,'Clients given 4D with < 20 Copies Viral Load','Clients given 4D with < 20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D with < 20 Copies Viral Load\n Clients given 4D with < 20 Copies Viral Load\n \n 2023-08-07 18:00:13 UTC\n \n 2023-08-07 18:01:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2241\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:00:13',4,'2023-08-07 20:01:11',4,0,NULL,NULL,NULL,'849b9ad0-e14d-4e64-8d4d-c90f1ea85d2c'),(2242,'Clients given 4D with Undetectable Viral Load','Clients given 4D with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D with Undetectable Viral Load\n Clients given 4D with Undetectable Viral Load\n \n 2023-08-07 18:02:05 UTC\n \n 2023-08-07 18:02:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2242\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:02:05',4,'2023-08-07 20:02:59',4,0,NULL,NULL,NULL,'269d7cd2-40e5-41a3-9da2-be9e310de73d'),(2243,'Clients given 4E with >=20 Copies Viral Load','Clients given 4E with >=20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E with >=20 Copies Viral Load\n Clients given 4E with >=20 Copies Viral Load\n \n 2023-08-07 18:05:06 UTC\n \n 2023-08-07 18:06:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2243\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:05:06',4,'2023-08-07 20:06:12',4,0,NULL,NULL,NULL,'deaade8d-fa75-4774-9422-2379319a59b2'),(2244,'Clients given 4E with <20 Copies Viral Load','Clients given 4E with <20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E with <20 Copies Viral Load\n Clients given 4E with <20 Copies Viral Load\n \n 2023-08-07 18:06:56 UTC\n \n 2023-08-07 18:08:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2244\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:06:56',4,'2023-08-07 20:08:02',4,0,NULL,NULL,NULL,'e0b2f670-7df3-4672-8411-b6d500f5f13d'),(2245,'Clients given 4E with Undetectable Viral Load','Clients given 4E with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E with Undetectable Viral Load\n Clients given 4E with Undetectable Viral Load\n \n 2023-08-07 18:08:42 UTC\n \n 2023-08-07 18:10:35 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2245\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:08:42',4,'2023-08-07 20:10:35',4,0,NULL,NULL,NULL,'ada290e9-0105-4579-843e-a66c38a30845'),(2246,'Clients given 4F with >=20 copies viral load','Clients given 4F with >=20 copies viral load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F with >=20 copies viral load\n Clients given 4F with >=20 copies viral load\n \n 2023-08-07 18:12:14 UTC\n \n 2023-08-07 18:12:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2246\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:12:14',4,'2023-08-07 20:12:59',4,0,NULL,NULL,NULL,'2755008d-c58f-4cf7-b3fb-879cb0055625'),(2247,'Clients given 4F with <20 copies Viral Load','Clients given 4F with <20 copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F with <20 copies Viral Load\n Clients given 4F with <20 copies Viral Load\n \n 2023-08-07 18:13:57 UTC\n \n 2023-08-07 18:15:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2247\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:13:57',4,'2023-08-07 20:15:02',4,0,NULL,NULL,NULL,'5fd4b692-7c21-4e41-80e5-143ee6c04385'),(2248,'Clients given 4F with Undetectable Viral Load','Clients given 4F with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F with Undetectable Viral Load\n Clients given 4F with Undetectable Viral Load\n \n 2023-08-07 18:15:52 UTC\n \n 2023-08-07 18:16:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2248\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:15:52',4,'2023-08-07 20:16:55',4,0,NULL,NULL,NULL,'9aae30ff-90c2-4228-b4a1-0aedf7354802'),(2249,'Clients given 4G with >=20 Copies Viral Load','Clients given 4G with >=20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G with >=20 Copies Viral Load\n Clients given 4G with >=20 Copies Viral Load\n \n 2023-08-07 18:18:32 UTC\n \n 2023-08-07 18:20:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2249\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:18:32',4,'2023-08-07 20:20:58',4,0,NULL,NULL,NULL,'a602c987-a1c2-486d-93e8-2efb6a3d06d6'),(2250,'Clients given 4G with <20 copies Viral Load','Clients given 4G with <20 copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G with <20 copies Viral Load\n Clients given 4G with <20 copies Viral Load\n \n 2023-08-07 18:21:47 UTC\n \n 2023-08-07 18:23:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2250\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:21:47',4,'2023-08-07 20:23:21',4,0,NULL,NULL,NULL,'6cec76ef-5466-4efe-970d-f7b76ed79e1e'),(2251,'Clients given 4G with Undetectable Viral Load','Clients given 4G with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G with Undetectable Viral Load\n Clients given 4G with Undetectable Viral Load\n \n 2023-08-07 18:24:19 UTC\n \n 2023-08-07 18:25:25 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2251\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:24:19',4,'2023-08-07 20:25:25',4,0,NULL,NULL,NULL,'ef8cbe9f-0742-4531-8dbe-1efbfc9c807a'),(2252,'Clients given 4H with >=20 Copies Viral Load','Clients given 4H with >=20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H with >=20 Copies Viral Load\n Clients given 4H with >=20 Copies Viral Load\n \n 2023-08-07 18:26:08 UTC\n \n 2023-08-07 18:27:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2252\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:26:08',4,'2023-08-07 20:27:36',4,0,NULL,NULL,NULL,'f374ad0c-24ca-460e-8ed4-812fcdbb8b30'),(2253,'Clients given 4H weighing <20 Copies Viral Load','Clients given 4H weighing <20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H weighing <20 Copies Viral Load\n Clients given 4H weighing <20 Copies Viral Load\n \n 2023-08-07 18:32:51 UTC\n \n 2023-08-07 18:34:47 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2253\n COUNT\n \n \n \n \n endDate\n ${startDate}\n \n \n location\n ${location}\n \n \n startDate\n ${endDate}\n \n \n \n','2023-08-07 20:32:51',4,'2023-08-07 20:34:47',4,0,NULL,NULL,NULL,'981353f5-77cf-4e9e-b418-96ba27b38c0d'),(2254,'Clients given 4H with Undetectable Viral Load','Clients given 4H with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H with Undetectable Viral Load\n Clients given 4H with Undetectable Viral Load\n \n 2023-08-07 18:35:38 UTC\n \n 2023-08-07 18:36:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2254\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:35:38',4,'2023-08-07 20:36:30',4,0,NULL,NULL,NULL,'3cff4201-9093-4de5-a526-4c714a0e4b75'),(2255,'Clients given 4J weighing >=20 Copies Viral Load','Clients given 4J weighing >=20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J weighing >=20 Copies Viral Load\n Clients given 4J weighing >=20 Copies Viral Load\n \n 2023-08-07 18:37:43 UTC\n \n 2023-08-07 18:38:52 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2255\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:37:43',4,'2023-08-07 20:38:52',4,0,NULL,NULL,NULL,'ccd5a99e-b517-45c0-864c-d3c6f4ef6701'),(2256,'Clients given 4J with <20 copies Viral Load','Clients given 4J with <20 copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J with <20 copies Viral Load\n Clients given 4J with <20 copies Viral Load\n \n 2023-08-07 18:40:26 UTC\n \n 2023-08-07 18:41:37 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2256\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:40:26',4,'2023-08-07 20:41:37',4,0,NULL,NULL,NULL,'99531929-455a-4092-b2e9-48993920a7b3'),(2257,'Clients given 4J with Undetectable Viral Load','Clients given 4J with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J with Undetectable Viral Load\n Clients given 4J with Undetectable Viral Load\n \n 2023-08-07 18:42:19 UTC\n \n 2023-08-07 18:45:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2257\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:42:19',4,'2023-08-07 20:45:10',4,0,NULL,NULL,NULL,'059ea6c5-c8bf-42ba-abbf-50b8bd27f0e1'),(2258,'Clients given 4K with >=20 Copies Viral Load','Clients given 4K with >=20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K with >=20 Copies Viral Load\n Clients given 4K with >=20 Copies Viral Load\n \n 2023-08-07 18:46:10 UTC\n \n 2023-08-07 18:47:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2258\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:46:10',4,'2023-08-07 20:47:00',4,0,NULL,NULL,NULL,'4d992a61-8cc5-4846-afd1-605e939b3f6e'),(2259,'Clients given 4K with <20 Copies Viral Load','Clients given 4K with <20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K with <20 Copies Viral Load\n Clients given 4K with <20 Copies Viral Load\n \n 2023-08-07 18:48:35 UTC\n \n 2023-08-08 10:02:48 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2259\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:48:35',4,'2023-08-08 12:02:48',4,0,NULL,NULL,NULL,'a1388a42-9e0b-4057-9343-515ab7744a3a'),(2260,'Clients given 4K with Undetectable Viral Load','Clients given 4K with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K with Undetectable Viral Load\n Clients given 4K with Undetectable Viral Load\n \n 2023-08-07 18:50:00 UTC\n \n 2023-08-07 18:50:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2260\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:50:00',4,'2023-08-07 20:50:42',4,0,NULL,NULL,NULL,'50081155-8d33-4ece-ad03-825e8f26f54b'),(2261,'Clients given 4L with >=20 Copies Viral Load','Clients given 4L with >=20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L with >=20 Copies Viral Load\n Clients given 4L with >=20 Copies Viral Load\n \n 2023-08-07 18:51:33 UTC\n \n 2023-12-20 07:08:34 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2261\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:51:33',4,'2023-12-20 09:08:34',4,0,NULL,NULL,NULL,'44e7920f-d834-4397-ba46-342d70d2d351'),(2262,'Clients given 4L with <20 Copies Viral Load','Clients given 4L with <20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L with <20 Copies Viral Load\n Clients given 4L with <20 Copies Viral Load\n \n 2023-08-07 18:54:15 UTC\n \n 2023-08-07 18:54:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2262\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:54:15',4,'2023-08-07 20:54:59',4,0,NULL,NULL,NULL,'a46689e8-87db-4b2e-b627-fa3a695e9e49'),(2263,'Clients given 4L with Undetectable Viral Load','Clients given 4L with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L with Undetectable Viral Load\n Clients given 4L with Undetectable Viral Load\n \n 2023-08-07 18:55:39 UTC\n \n 2023-08-07 18:56:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2263\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:55:39',4,'2023-08-07 20:56:21',4,0,NULL,NULL,NULL,'38640382-c5f2-4174-b4b6-e05863aea4b8'),(2264,'Clients given 4C with good adherence','Clients given 4C with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C with good adherence\n Clients given 4C with good adherence\n \n 2023-08-09 09:38:59 UTC\n \n 2023-08-14 10:41:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2264\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2202)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-09 09:38:59',4,'2023-08-14 10:41:15',4,0,NULL,NULL,NULL,'80eda8e4-4432-4308-92bc-9c4a6d5835ba'),(2265,'Clients given 4D with good adherence','Clients given 4D with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D with good adherence\n Clients given 4D with good adherence\n \n 2023-08-09 09:40:40 UTC\n \n 2023-08-14 10:43:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2265\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4D \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2204)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-09 09:40:40',4,'2023-08-14 10:43:07',4,0,NULL,NULL,NULL,'50e6ed7b-8da6-420e-b00d-c5a7a6e8e618'),(2266,'Clients given 4E with good adherence','Clients given 4E with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E with good adherence\n Clients given 4E with good adherence\n \n 2023-08-09 09:40:58 UTC\n \n 2023-08-14 10:45:49 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2266\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3679)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-09 09:40:58',4,'2023-08-14 10:45:49',4,0,NULL,NULL,NULL,'c9adbf40-4d5f-4ca4-b388-4a4ee5c16f3e'),(2267,'Clients given 4F with good adherence','Clients given 4F with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F with good adherence\n Clients given 4F with good adherence\n \n 2023-08-09 09:49:16 UTC\n \n 2023-08-14 10:57:13 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2267\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3680)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-09 09:49:16',4,'2023-08-14 10:57:13',4,0,NULL,NULL,NULL,'691b7d00-855b-4869-8938-9502f8762962'),(2268,'Clients given 4G with good adherence','Clients given 4G with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G with good adherence\n Clients given 4G with good adherence\n \n 2023-08-09 09:49:37 UTC\n \n 2023-08-14 10:58:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2268\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4684)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-09 09:49:37',4,'2023-08-14 10:58:30',4,0,NULL,NULL,NULL,'d0f8da5f-e6aa-44af-9980-cd882429e8ac'),(2269,'Clients given 4H with good adherence','Clients given 4H with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H with good adherence\n Clients given 4H with good adherence\n \n 2023-08-09 09:49:55 UTC\n \n 2023-08-14 11:00:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2269\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4685)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-09 09:49:55',4,'2023-08-14 11:00:32',4,0,NULL,NULL,NULL,'90332338-8e76-4563-a7f1-f3f67ffa8f3b'),(2270,'Clients given 4J with good adherence','Clients given 4J with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J with good adherence\n Clients given 4J with good adherence\n \n 2023-08-09 09:54:49 UTC\n \n 2023-08-14 11:09:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2270\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4J \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-09 09:54:49',4,'2023-08-14 11:09:02',4,0,NULL,NULL,NULL,'888d3fd4-ad2c-4e7e-b07f-8c68a08ed1f4'),(2271,'Clients given 4K with good adherence','Clients given 4K with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K with good adherence\n Clients given 4K with good adherence\n \n 2023-08-09 09:55:07 UTC\n \n 2023-08-14 11:10:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2271\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4K \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-09 09:55:07',4,'2023-08-14 11:10:40',4,0,NULL,NULL,NULL,'def70332-aae8-450d-8e78-2b3f83574bc9'),(2272,'Clients given 4L with good adherence','Clients given 4L with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L with good adherence\n Clients given 4L with good adherence\n \n 2023-08-09 09:55:23 UTC\n \n 2023-08-14 11:14:33 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2272\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4L \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4688)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-09 09:55:23',4,'2023-08-14 11:14:33',4,0,NULL,NULL,NULL,'7d1751a3-47c6-406a-a631-90ed96f37660'),(2273,'clients given 4C with fair adherence','clients given 4C with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n clients given 4C with fair adherence\n clients given 4C with fair adherence\n \n 2023-08-09 10:04:32 UTC\n \n 2023-08-14 10:40:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2273\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2202)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-09 10:04:32',4,'2023-08-14 10:40:15',4,0,NULL,NULL,NULL,'15494d8b-bc16-4865-8561-a0f11bb906f5'),(2274,'clients given 4D with fair adherence','clients given 4D with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n clients given 4D with fair adherence\n clients given 4D with fair adherence\n \n 2023-08-09 10:04:52 UTC\n \n 2023-08-14 10:42:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2274\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4D \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2204)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-09 10:04:52',4,'2023-08-14 10:42:43',4,0,NULL,NULL,NULL,'3076328f-0cf6-496f-bcfc-ec00585bf8f7'),(2275,'clients given 4E with fair adherence','clients given 4E with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n clients given 4E with fair adherence\n clients given 4E with fair adherence\n \n 2023-08-09 10:05:09 UTC\n \n 2023-08-14 10:45:35 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2275\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3679)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-09 10:05:09',4,'2023-08-14 10:45:35',4,0,NULL,NULL,NULL,'8c441fe9-1c2f-4eba-9e14-3c13b7d0e22d'),(2276,'clients given 4F with fair adherence','clients given 4F with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n clients given 4F with fair adherence\n clients given 4F with fair adherence\n \n 2023-08-09 10:08:17 UTC\n \n 2023-08-14 10:56:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2276\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3680)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-09 10:08:17',4,'2023-08-14 10:56:58',4,0,NULL,NULL,NULL,'cb6f6a66-39fa-4584-8ad9-397be4e8acc0'),(2277,'clients given 4G with fair adherence','clients given 4G with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n clients given 4G with fair adherence\n clients given 4G with fair adherence\n \n 2023-08-09 10:09:12 UTC\n \n 2023-08-14 10:58:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2277\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4684)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-09 10:09:12',4,'2023-08-14 10:58:17',4,0,NULL,NULL,NULL,'456a7189-4a16-40fa-9702-abf6b2e8b707'),(2278,'Clients given 4H with fair adherence','Clients given 4H with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H with fair adherence\n Clients given 4H with fair adherence\n \n 2023-08-09 10:10:29 UTC\n \n 2023-08-14 11:00:09 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2278\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4685)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-09 10:10:29',4,'2023-08-14 11:00:09',4,0,NULL,NULL,NULL,'3cb85e60-1a5e-422c-b0af-fc15c8ba62ed'),(2279,'Clients given 4K with fair adherence','Clients given 4K with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K with fair adherence\n Clients given 4K with fair adherence\n \n 2023-08-09 10:17:56 UTC\n \n 2023-08-14 11:10:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2279\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4K \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-09 10:17:56',4,'2023-08-14 11:10:04',4,0,NULL,NULL,NULL,'cbd5b84d-066f-41a6-bd8b-bc81dc23c99d'),(2280,'Clients given 4J with fair adherence','Clients given 4J with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J with fair adherence\n Clients given 4J with fair adherence\n \n 2023-08-09 10:18:17 UTC\n \n 2023-08-14 11:08:38 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2280\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4J \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-09 10:18:17',4,'2023-08-14 11:08:38',4,0,NULL,NULL,NULL,'14b826bd-9709-497b-a02d-8fa8d4146faa'),(2281,'Clients given 4L with fair adherence','Clients given 4L with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L with fair adherence\n Clients given 4L with fair adherence\n \n 2023-08-09 10:21:31 UTC\n \n 2023-08-14 11:14:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2281\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4L \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-09 10:21:31',4,'2023-08-14 11:14:18',4,0,NULL,NULL,NULL,'62b94203-c51d-456f-87a6-dd15791f3d71'),(2282,'Clients given 4C with poor adherence','Clients given 4C with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C with poor adherence\n Clients given 4C with poor adherence\n \n 2023-08-09 10:45:41 UTC\n \n 2023-08-09 10:49:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2282\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 20 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2202)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-09 10:45:41',4,'2023-08-09 10:49:23',4,0,NULL,NULL,NULL,'769d8c15-f519-440d-acaf-e2640e2409bc'),(2283,'Clients given 4D with poor adherence','Clients given 4D with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D with poor adherence\n Clients given 4D with poor adherence\n \n 2023-08-09 10:46:02 UTC\n \n 2023-08-14 10:41:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2283\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4D \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2204)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-09 10:46:02',4,'2023-08-14 10:41:45',4,0,NULL,NULL,NULL,'f77a67fe-ac10-4c92-ab0c-98a5b4dfd5f1'),(2284,'Clients given 4E with poor adherence','Clients given 4E with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E with poor adherence\n Clients given 4E with poor adherence\n \n 2023-08-09 10:46:19 UTC\n \n 2023-08-14 10:45:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2284\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3679)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-09 10:46:19',4,'2023-08-14 10:45:20',4,0,NULL,NULL,NULL,'2eb584f9-1fbe-4c98-adec-b2feb88933b7'),(2285,'Clients given 4F with poor adherence','Clients given 4F with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F with poor adherence\n Clients given 4F with poor adherence\n \n 2023-08-09 10:50:41 UTC\n \n 2023-08-14 10:57:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2285\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3680)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-09 10:50:41',4,'2023-08-14 10:57:32',4,0,NULL,NULL,NULL,'3c5012df-c0bf-411b-a7d1-da092ade8986'),(2286,'Clients given 4G with poor adherence','Clients given 4G with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G with poor adherence\n Clients given 4G with poor adherence\n \n 2023-08-09 10:50:56 UTC\n \n 2023-08-14 10:58:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2286\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4684)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-09 10:50:56',4,'2023-08-14 10:58:45',4,0,NULL,NULL,NULL,'cdee04fe-950f-4b39-88bf-9736744da52f'),(2287,'Clients given 4H with poor adherence','Clients given 4H with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H with poor adherence\n Clients given 4H with poor adherence\n \n 2023-08-09 10:51:12 UTC\n \n 2023-08-14 11:00:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2287\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4685)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-09 10:51:12',4,'2023-08-14 11:00:59',4,0,NULL,NULL,NULL,'9a9175d4-c8ad-439e-b484-edb2345816ad'),(2288,'Clients given 4L with poor adherence','Clients given 4L with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L with poor adherence\n Clients given 4L with poor adherence\n \n 2023-08-09 10:55:46 UTC\n \n 2023-08-14 11:14:48 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2288\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4L \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4688)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-09 10:55:46',4,'2023-08-14 11:14:48',4,0,NULL,NULL,NULL,'5b38ffa0-ea56-4cda-b3cf-03d1b83e7889'),(2289,'Clients given 4K with poor adherence','Clients given 4K with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K with poor adherence\n Clients given 4K with poor adherence\n \n 2023-08-09 10:56:07 UTC\n \n 2023-08-14 11:10:52 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2289\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4K \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-09 10:56:07',4,'2023-08-14 11:10:52',4,0,NULL,NULL,NULL,'1c393c0d-a2e3-4223-9b24-848d235e7a19'),(2290,'Clients given 4J with poor adherence','Clients given 4J with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J with poor adherence\n Clients given 4J with poor adherence\n \n 2023-08-09 10:56:28 UTC\n \n 2023-08-14 11:09:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2290\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4J \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-09 10:56:28',4,'2023-08-14 11:09:18',4,0,NULL,NULL,NULL,'47569cef-3b90-4fbf-9558-b7a4afb195ab'),(2291,'Children ARV Regimen_1stLine_Adherence','Children ARV Regimen_1stLine_Adherence','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_Adherence\n Children ARV Regimen_1stLine_Adherence\n \n 2023-08-09 19:25:53 UTC\n \n 2023-08-09 19:26:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2291\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-09 19:25:53',4,'2023-08-09 19:26:39',4,0,NULL,NULL,NULL,'dcdcb494-6ca6-47a5-aaac-92decc868c82'),(2292,'Children ARV Regimen_1stLine_Adherence Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_Adherence Data Set\n \n 2023-08-09 19:26:39 UTC\n \n 2023-08-10 09:42:22 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2292\n \n \n \n 4C_fair\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n \n \n 4C_good\n \n \n \n \n \n \n \n \n \n 4C_poor\n \n \n \n \n \n \n \n \n \n 4D_fair\n \n \n \n \n \n \n \n \n \n 4D_good\n \n \n \n \n \n \n \n \n \n 4D_poor\n \n \n \n \n \n \n \n \n \n 4E_fair\n \n \n \n \n \n \n \n \n \n 4E_good\n \n \n \n \n \n \n \n \n \n 4E_poor\n \n \n \n \n \n \n \n \n \n 4F_fair\n \n \n \n \n \n \n \n \n \n 4F_good\n \n \n \n \n \n \n \n \n \n 4F_poor\n \n \n \n \n \n \n \n \n \n 4G_fair\n \n \n \n \n \n \n \n \n \n 4G_good\n \n \n \n \n \n \n \n \n \n 4G_poor\n \n \n \n \n \n \n \n \n \n 4H_fair\n \n \n \n \n \n \n \n \n \n 4H_good\n \n \n \n \n \n \n \n \n \n 4H_poor\n \n \n \n \n \n \n \n \n \n 4J_fair\n \n \n \n \n \n \n \n \n \n 4J_good\n \n \n \n \n \n \n \n \n \n 4J_poor\n \n \n \n \n \n \n \n \n \n 4K_fair\n \n \n \n \n \n \n \n \n \n 4K_good\n \n \n \n \n \n \n \n \n \n 4K_poor\n \n \n \n \n \n \n \n \n \n 4L_fair\n \n \n \n \n \n \n \n \n \n 4L_good\n \n \n \n \n \n \n \n \n \n 4L_poor\n \n \n \n \n \n \n \n \n \n','2023-08-09 19:26:39',4,'2023-08-10 09:42:22',4,0,NULL,NULL,NULL,'129f4cce-9154-4509-8649-9b3ed22fe029'),(2293,'Clients given 4C with good adherence','Clients given 4C with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C with good adherence\n Clients given 4C with good adherence\n \n 2023-08-09 19:34:37 UTC\n \n 2023-08-09 19:40:19 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2293\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 19:34:37',4,'2023-08-09 19:40:19',4,0,NULL,NULL,NULL,'9aebf6da-cf9b-45ed-bbdd-861ff4c0fd41'),(2294,'Clients given 4C with fair adherence','Clients given 4C with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C with fair adherence\n Clients given 4C with fair adherence\n \n 2023-08-09 19:34:50 UTC\n \n 2023-08-09 19:39:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2294\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 19:34:50',4,'2023-08-09 19:39:36',4,0,NULL,NULL,NULL,'ae06dd89-8f3d-4448-bab9-212196f1660d'),(2295,'Clients given 4C with poor adherence','Clients given 4C with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C with poor adherence\n Clients given 4C with poor adherence\n \n 2023-08-09 19:35:01 UTC\n \n 2023-08-09 19:39:57 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2295\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 19:35:01',4,'2023-08-09 19:39:57',4,0,NULL,NULL,NULL,'88e3d929-46c6-4698-b83e-81552c4b0078'),(2296,'Clients given 4D with good adherence','Clients given 4D with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D with good adherence\n Clients given 4D with good adherence\n \n 2023-08-09 19:43:04 UTC\n \n 2023-08-09 19:46:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2296\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 19:43:04',4,'2023-08-09 19:46:08',4,0,NULL,NULL,NULL,'7b0d9987-2436-479b-b186-682878585356'),(2297,'Clients given 4D with fair adherence','Clients given 4D with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D with fair adherence\n Clients given 4D with fair adherence\n \n 2023-08-09 19:43:10 UTC\n \n 2023-08-09 19:46:35 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2297\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 19:43:10',4,'2023-08-09 19:46:35',4,0,NULL,NULL,NULL,'6e70eb0d-55a5-4cc0-b79e-4e80bf25978d'),(2298,'Clients given 4D with poor adherence','Clients given 4D with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D with poor adherence\n Clients given 4D with poor adherence\n \n 2023-08-09 19:43:23 UTC\n \n 2023-08-09 19:47:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2298\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 19:43:23',4,'2023-08-09 19:47:01',4,0,NULL,NULL,NULL,'dde54d37-4aab-443f-9b40-2fe211fc296a'),(2299,'Clients given 4E with good adherence','Clients given 4E with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E with good adherence\n Clients given 4E with good adherence\n \n 2023-08-09 19:47:57 UTC\n \n 2023-08-09 19:52:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2299\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 19:47:57',4,'2023-08-09 19:52:12',4,0,NULL,NULL,NULL,'8572efe5-f3ea-463f-8abf-fe4086a2aaf7'),(2300,'clients given 4E with fair adherence','Clients given 4E with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n clients given 4E with fair adherence\n Clients given 4E with fair adherence\n \n 2023-08-09 19:48:21 UTC\n \n 2023-08-09 19:53:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2300\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 19:48:21',4,'2023-08-09 19:53:51',4,0,NULL,NULL,NULL,'9157aa83-9a8f-4598-933d-06a98e849b9c'),(2301,'Clients given 4E with poor adherence','Clients given 4E with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E with poor adherence\n Clients given 4E with poor adherence\n \n 2023-08-09 19:49:01 UTC\n \n 2023-08-09 19:54:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2301\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 19:49:01',4,'2023-08-09 19:54:14',4,0,NULL,NULL,NULL,'134c2069-3e31-41df-8845-18839686bfba'),(2302,'Clients given 4F with good adherence','Clients given 4F with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F with good adherence\n Clients given 4F with good adherence\n \n 2023-08-09 19:55:08 UTC\n \n 2023-08-09 19:57:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2302\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 19:55:08',4,'2023-08-09 19:57:55',4,0,NULL,NULL,NULL,'d6358532-78d0-4095-9fcb-edf9bc09f548'),(2303,'clients given 4F with fair adherence','clients given 4F with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n clients given 4F with fair adherence\n clients given 4F with fair adherence\n \n 2023-08-09 19:55:30 UTC\n \n 2023-08-09 19:59:24 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2303\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 19:55:30',4,'2023-08-09 19:59:24',4,0,NULL,NULL,NULL,'25550508-c457-4534-9385-9c35fe182a5e'),(2304,'Clients given 4F with poor adherence','Clients given 4F with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F with poor adherence\n Clients given 4F with poor adherence\n \n 2023-08-09 19:56:13 UTC\n \n 2023-08-09 19:59:49 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2304\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 19:56:13',4,'2023-08-09 19:59:49',4,0,NULL,NULL,NULL,'de1988bb-4fda-4d70-b77a-569364cb3880'),(2305,'Clients given 4G with good adherence','Clients given 4G with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G with good adherence\n Clients given 4G with good adherence\n \n 2023-08-09 20:00:32 UTC\n \n 2023-08-09 20:04:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2305\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 20:00:32',4,'2023-08-09 20:04:29',4,0,NULL,NULL,NULL,'f15e2c6d-1a13-45c8-b80e-33982967f9ee'),(2306,'Clients given 4G with poor adherence','Clients given 4G with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G with poor adherence\n Clients given 4G with poor adherence\n \n 2023-08-09 20:01:35 UTC\n \n 2023-08-09 20:05:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2306\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 20:01:35',4,'2023-08-09 20:05:36',4,0,NULL,NULL,NULL,'9b6c2db1-dea2-4afa-b20c-391c4985795c'),(2307,'clients given 4G with fair adherence','clients given 4G with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n clients given 4G with fair adherence\n clients given 4G with fair adherence\n \n 2023-08-09 20:01:43 UTC\n \n 2023-08-09 20:04:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2307\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 20:01:43',4,'2023-08-09 20:04:58',4,0,NULL,NULL,NULL,'b7856cf5-f989-45fd-8da6-f0ba354e3e96'),(2308,'Clients given 4H with good adherence','Clients given 4H with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H with good adherence\n Clients given 4H with good adherence\n \n 2023-08-09 20:06:49 UTC\n \n 2023-08-09 20:10:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2308\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 20:06:49',4,'2023-08-09 20:10:41',4,0,NULL,NULL,NULL,'cfb7a7c6-30e8-4f10-a55b-faff56674767'),(2309,'Clients given 4H with fair adherence','Clients given 4H with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H with fair adherence\n Clients given 4H with fair adherence\n \n 2023-08-09 20:07:01 UTC\n \n 2023-08-09 20:10:57 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2309\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 20:07:01',4,'2023-08-09 20:10:57',4,0,NULL,NULL,NULL,'5df6e5f1-3116-49e6-a896-df143af3004e'),(2310,'Clients given 4H with poor adherence','Clients given 4H with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H with poor adherence\n Clients given 4H with poor adherence\n \n 2023-08-09 20:07:57 UTC\n \n 2023-08-09 20:13:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2310\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 20:07:57',4,'2023-08-09 20:13:06',4,0,NULL,NULL,NULL,'65132fb3-cc4a-4859-8cbf-2f26ad87c444'),(2311,'Clients given 4J with fair adherence','Clients given 4J with fair adherence\r\n','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J with fair adherence\n Clients given 4J with fair adherence \n\n \n 2023-08-09 20:13:40 UTC\n \n 2023-08-09 20:17:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2311\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 20:13:40',4,'2023-08-09 20:17:28',4,0,NULL,NULL,NULL,'7396bec4-26e5-46ae-9751-217c77d66d44'),(2312,'Clients given 4J with good adherence','Clients given 4J with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J with good adherence\n Clients given 4J with good adherence\n \n 2023-08-09 20:13:48 UTC\n \n 2023-08-09 20:17:09 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2312\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 20:13:48',4,'2023-08-09 20:17:09',4,0,NULL,NULL,NULL,'b7ecce5a-9011-4c8a-a77b-538d579acf4a'),(2313,'Clients given 4J with poor adherence','Clients given 4J with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J with poor adherence\n Clients given 4J with poor adherence\n \n 2023-08-09 20:14:07 UTC\n \n 2023-08-09 20:17:52 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2313\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 20:14:07',4,'2023-08-09 20:17:52',4,0,NULL,NULL,NULL,'21d68248-3137-4f24-89b3-702c4c86b258'),(2314,'Clients given 4K with good adherence','Clients given 4K with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K with good adherence\n Clients given 4K with good adherence\n \n 2023-08-09 20:19:21 UTC\n \n 2023-08-09 20:22:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2314\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 20:19:21',4,'2023-08-09 20:22:30',4,0,NULL,NULL,NULL,'898b11a3-3876-45bc-a327-207de5a91288'),(2315,'Clients given 4K with fair adherence','Clients given 4K with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K with fair adherence\n Clients given 4K with fair adherence\n \n 2023-08-09 20:19:40 UTC\n \n 2023-08-09 20:23:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2315\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 20:19:40',4,'2023-08-09 20:23:00',4,0,NULL,NULL,NULL,'01cd007c-98e1-4a76-91a3-35dde1c4b25b'),(2316,'Clients given 4K with poor adherence','Clients given 4K with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K with poor adherence\n Clients given 4K with poor adherence\n \n 2023-08-09 20:20:07 UTC\n \n 2023-08-09 20:23:47 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2316\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 20:20:07',4,'2023-08-09 20:23:47',4,0,NULL,NULL,NULL,'4feeb398-2818-460e-8e2c-3df8a27c5c68'),(2317,'Clients given 4L with good adherence','Clients given 4L with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L with good adherence\n Clients given 4L with good adherence\n \n 2023-08-09 20:25:36 UTC\n \n 2023-08-09 20:29:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2317\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 20:25:36',4,'2023-08-09 20:29:06',4,0,NULL,NULL,NULL,'6f28a61d-320a-49a5-8bf5-fc9e9c68cf5e'),(2318,'Clients given 4L with fair adherence','Clients given 4L with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L with fair adherence\n Clients given 4L with fair adherence\n \n 2023-08-09 20:25:55 UTC\n \n 2023-08-09 20:29:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2318\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 20:25:55',4,'2023-08-09 20:29:26',4,0,NULL,NULL,NULL,'58759e6a-e8d0-4eca-9a01-610e7d2f27c6'),(2319,'Clients given 4L with poor adherence','Clients given 4L with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L with poor adherence\n Clients given 4L with poor adherence\n \n 2023-08-09 20:26:12 UTC\n \n 2023-08-09 20:29:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2319\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 20:26:12',4,'2023-08-09 20:29:45',4,0,NULL,NULL,NULL,'3dfc43b9-8bf9-4833-890a-88876f8da47c'),(2321,'Children ARV Regimen_2ndLine_5A','Children ARV Regimen_2ndLine_5A disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5A\n Children ARV Regimen_2ndLine_5A disaggregated by weight, sex, age\n \n 2023-08-15 17:48:13 UTC\n \n 2023-08-15 19:23:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2321\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-15 19:48:13',4,'2023-08-15 21:23:02',4,0,NULL,NULL,NULL,'37b51d3f-838d-4211-aced-12371e6a7493'),(2322,'Children ARV Regimen_1stLine_5A Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_5A Data Set\n \n 2023-08-15 17:48:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n \n \n','2023-08-15 19:48:21',4,NULL,NULL,0,NULL,NULL,NULL,'6b9d88ee-8215-4be6-89f5-2b6dbec7d979'),(2323,'Children ARV Regimen_1stLine_5A Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_5A Data Set\n \n 2023-08-15 17:48:43 UTC\n \n 2023-08-16 10:53:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2323\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4y0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4y10-13\n \n \n \n \n \n \n \n \n \n F1-4y14-19\n \n \n \n \n \n \n \n \n \n F1-4y20-24\n \n \n \n \n \n \n \n \n \n F1-4y25-34\n \n \n \n \n \n \n \n \n \n F1-4y4-5\n \n \n \n \n \n \n \n \n \n F1-4y6-9\n \n \n \n \n \n \n \n \n \n F1-4y>=35\n \n \n \n \n \n \n \n \n \n F10-14y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14y10-\n \n \n \n \n \n \n F10-14y14-\n \n \n \n \n \n \n F10-14y20-\n \n \n \n \n \n \n F10-14y25-\n \n \n \n \n \n \n F10-14y4-5\n \n \n \n \n \n \n F10-14y6-9\n \n \n \n \n \n \n F10-14y>=3\n \n \n \n \n \n \n F5-9y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9y10-13\n \n \n \n \n \n \n F5-9y14-19\n \n \n \n \n \n \n F5-9y20-24\n \n \n \n \n \n \n F5-9y25-34\n \n \n \n \n \n \n F5-9y4-5\n \n \n \n \n \n \n F5-9y6-9\n \n \n \n \n \n \n F5-9y>=35\n \n \n \n \n \n \n F<1y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1y10-13\n \n \n \n \n \n \n F<1y14-19\n \n \n \n \n \n \n F<1y20-24\n \n \n \n \n \n \n F<1y25-34\n \n \n \n \n \n \n F<1y4-5\n \n \n \n \n \n \n F<1y6-9\n \n \n \n \n \n \n F<1y>=35\n \n \n \n \n \n \n M1-4y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4y10-13\n \n \n \n \n \n \n \n \n \n M1-4y14-19\n \n \n \n \n \n \n M1-4y20-24\n \n \n \n \n \n \n M1-4y25-34\n \n \n \n \n \n \n M1-4y4-5\n \n \n \n \n \n \n M1-4y6-9\n \n \n \n \n \n \n M1-4y>=35\n \n \n \n \n \n \n M10-14y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14y10-\n \n \n \n \n \n \n M10-14y14-\n \n \n \n \n \n \n M10-14y20-\n \n \n \n \n \n \n M10-14y25-\n \n \n \n \n \n \n M10-14y4-5\n \n \n \n \n \n \n M10-14y6-9\n \n \n \n \n \n \n M10-14y>=3\n \n \n \n \n \n \n M5-9y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9y10-13\n \n \n \n \n \n \n M5-9y14-19\n \n \n \n \n \n \n M5-9y20-24\n \n \n \n \n \n \n M5-9y25-34\n \n \n \n \n \n \n M5-9y4-5\n \n \n \n \n \n \n M5-9y6-9\n \n \n \n \n \n \n M5-9y>=35\n \n \n \n \n \n \n M<1y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1y10-13\n \n \n \n \n \n \n M<1y14-19\n \n \n \n \n \n \n M<1y20-24\n \n \n \n \n \n \n M<1y25-34\n \n \n \n \n \n \n \n \n \n M<1y4-5\n \n \n \n \n \n \n M<1y6-9\n \n \n \n \n \n \n M<1y>=35\n \n \n \n \n \n \n','2023-08-15 19:48:43',4,'2023-08-16 12:53:15',4,0,NULL,NULL,NULL,'1311fb91-2a90-44c5-876f-0bf0284580f4'),(2324,'Children ARV Regimen_3rdLine_6A','Children ARV Regimen_3rdLine_6A disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_6A\n Children ARV Regimen_3rdLine_6A disaggregated by weight, sex, age\n \n 2023-08-15 19:27:09 UTC\n \n 2023-08-15 19:27:54 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2324\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-15 21:27:09',4,'2023-08-15 21:27:54',4,0,NULL,NULL,NULL,'2478792b-752a-4b20-97f7-5033810e1ba8'),(2325,'Children ARV Regimen_3rdLine_6A Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_6A Data Set\n \n 2023-08-15 19:27:54 UTC\n \n 2023-08-15 21:23:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2325\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4yr0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4yr10-1\n \n \n \n \n \n \n \n \n \n F1-4yr14-1\n \n \n \n \n \n \n \n \n \n F1-4yr20-2\n \n \n \n \n \n \n \n \n \n F1-4yr25-3\n \n \n \n \n \n \n \n \n \n F1-4yr4-5\n \n \n \n \n \n \n \n \n \n F1-4yr6-9\n \n \n \n \n \n \n \n \n \n F1-4yr>=35\n \n \n \n \n \n \n \n \n \n F10-14yr0-\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14yr10\n \n \n \n \n \n \n F10-14yr14\n \n \n \n \n \n \n F10-14yr20\n \n \n \n \n \n \n F10-14yr25\n \n \n \n \n \n \n F10-14yr4-\n \n \n \n \n \n \n F10-14yr6\n \n \n \n \n \n \n F10-14yr>=\n \n \n \n \n \n \n F5-9yr0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9yr10-1\n \n \n \n \n \n \n F5-9yr14-1\n \n \n \n \n \n \n F5-9yr20-2\n \n \n \n \n \n \n F5-9yr25-3\n \n \n \n \n \n \n F5-9yr4-5\n \n \n \n \n \n \n F5-9yr6-9\n \n \n \n \n \n \n F5-9yr>=35\n \n \n \n \n \n \n F<1y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1yr10-13\n \n \n \n \n \n \n F<1yr14-19\n \n \n \n \n \n \n F<1yr20-24\n \n \n \n \n \n \n F<1yr25-34\n \n \n \n \n \n \n F<1yr4-5\n \n \n \n \n \n \n F<1yr6-9\n \n \n \n \n \n \n F<1yr>=35\n \n \n \n \n \n \n M1-4yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4yr10-1\n \n \n \n \n \n \n M1-4yr14-1\n \n \n \n \n \n \n M1-4yr20-2\n \n \n \n \n \n \n M1-4yr25-3\n \n \n \n \n \n \n M1-4yr4-5\n \n \n \n \n \n \n M1-4yr6-9\n \n \n \n \n \n \n M1-4yr>=35\n \n \n \n \n \n \n M10-14yr0-\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14yr10\n \n \n \n \n \n \n M10-14yr14\n \n \n \n \n \n \n M10-14yr20\n \n \n \n \n \n \n M10-14yr25\n \n \n \n \n \n \n M10-14yr4-\n \n \n \n \n \n \n M10-14yr6-\n \n \n \n \n \n \n M10-14yr>=\n \n \n \n \n \n \n M5-9yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9yr10-1\n \n \n \n \n \n \n M5-9yr14-1\n \n \n \n \n \n \n M5-9yr20-2\n \n \n \n \n \n \n M5-9yr25-3\n \n \n \n \n \n \n M5-9yr4-5\n \n \n \n \n \n \n M5-9yr6-9\n \n \n \n \n \n \n M5-9yr>=35\n \n \n \n \n \n \n M<1yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1yr10-13\n \n \n \n \n \n \n M<1yr14-19\n \n \n \n \n \n \n M<1yr20-24\n \n \n \n \n \n \n M<1yr25-34\n \n \n \n \n \n \n M<1yr4-5\n \n \n \n \n \n \n M<1yr6-9\n \n \n \n \n \n \n M<1yr>=35\n \n \n \n \n \n \n','2023-08-15 21:27:54',4,'2023-08-15 23:23:05',4,0,NULL,NULL,NULL,'0e0b0b1e-e085-4f4f-af07-c44587b0d8f2'),(2326,'Children ARV Regimen_2ndLine_5B','Children ARV Regimen_2ndLine_5B disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5B\n Children ARV Regimen_2ndLine_5B disaggregated by weight, sex, age\n \n 2023-08-15 19:42:04 UTC\n \n 2023-08-15 19:42:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2326\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-15 21:42:04',4,'2023-08-15 21:42:28',4,0,NULL,NULL,NULL,'85cddf9e-e519-40f9-9df5-e1d36c7c2b27'),(2327,'Children ARV Regimen_2ndLine_5B Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5B Data Set\n \n 2023-08-15 19:42:28 UTC\n \n 2023-08-16 10:02:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2327\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4y0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4y10-13\n \n \n \n \n \n \n \n \n \n F1-4y14-19\n \n \n \n \n \n \n \n \n \n F1-4y20-24\n \n \n \n \n \n \n \n \n \n F1-4y25-34\n \n \n \n \n \n \n \n \n \n F1-4y4-5\n \n \n \n \n \n \n \n \n \n F1-4y6-9\n \n \n \n \n \n \n \n \n \n F1-4y>=35\n \n \n \n \n \n \n \n \n \n F10-14y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14y10-\n \n \n \n \n \n \n \n \n \n F10-14y14-\n \n \n \n \n \n \n F10-14y20-\n \n \n \n \n \n \n F10-14y25-\n \n \n \n \n \n \n F10-14y4-5\n \n \n \n \n \n \n F10-14y6-9\n \n \n \n \n \n \n F10-14y>=3\n \n \n \n \n \n \n F5-9y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9y10-13\n \n \n \n \n \n \n F5-9y14-19\n \n \n \n \n \n \n F5-9y20-24\n \n \n \n \n \n \n F5-9y25-34\n \n \n \n \n \n \n F5-9y4-5\n \n \n \n \n \n \n F5-9y6-9\n \n \n \n \n \n \n F5-9y>=35\n \n \n \n \n \n \n F<1y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1y10-13\n \n \n \n \n \n \n F<1y14-19\n \n \n \n \n \n \n F<1y20-24\n \n \n \n \n \n \n F<1y25-34\n \n \n \n \n \n \n F<1y4-5\n \n \n \n \n \n \n F<1y6-9\n \n \n \n \n \n \n F<1y>=35\n \n \n \n \n \n \n M1-4y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4y10-14\n \n \n \n \n \n \n M1-4y14-19\n \n \n \n \n \n \n M1-4y20-24\n \n \n \n \n \n \n M1-4y25-34\n \n \n \n \n \n \n M1-4y4-5\n \n \n \n \n \n \n M1-4y6-9\n \n \n \n \n \n \n M1-4y>=35\n \n \n \n \n \n \n M10-14y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14y10-\n \n \n \n \n \n \n M10-14y14-\n \n \n \n \n \n \n M10-14y20-\n \n \n \n \n \n \n M10-14y25-\n \n \n \n \n \n \n M10-14y4-5\n \n \n \n \n \n \n M10-14y6-9\n \n \n \n \n \n \n M10-14y>=3\n \n \n \n \n \n \n M5-9y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9y10-13\n \n \n \n \n \n \n M5-9y14-19\n \n \n \n \n \n \n M5-9y20-24\n \n \n \n \n \n \n M5-9y25-34\n \n \n \n \n \n \n M5-9y4-5\n \n \n \n \n \n \n M5-9y6-9\n \n \n \n \n \n \n M5-9y>=35\n \n \n \n \n \n \n M<1y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1y10-13\n \n \n \n \n \n \n M<1y14-19\n \n \n \n \n \n \n M<1y20-24\n \n \n \n \n \n \n M<1y25-34\n \n \n \n \n \n \n M<1y4-5\n \n \n \n \n \n \n M<1y6-9\n \n \n \n \n \n \n M<1y>=35\n \n \n \n \n \n \n','2023-08-15 21:42:28',4,'2023-08-16 12:02:14',4,0,NULL,NULL,NULL,'b217699a-cf93-4478-8b85-8f59939d020a'),(2328,'Children ARV Regimen_3rdLine_6B ','Children ARV Regimen_3rdLine_6B disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_6B \n Children ARV Regimen_3rdLine_6B disaggregated by weight, sex, age\n \n 2023-08-16 08:51:49 UTC\n \n 2023-08-16 08:53:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2328\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-16 10:51:49',4,'2023-08-16 10:53:21',4,0,NULL,NULL,NULL,'1f0f9f2c-575a-462f-be70-5b8774c58cd6'),(2329,'Children ARV Regimen_3rdLine_6B Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_6B Data Set\n \n 2023-08-16 08:53:21 UTC\n \n 2023-08-16 11:15:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2329\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4yr0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4yr10-1\n \n \n \n \n \n \n \n \n \n F1-4yr14-1\n \n \n \n \n \n \n \n \n \n F1-4yr20-2\n \n \n \n \n \n \n \n \n \n F1-4yr25-3\n \n \n \n \n \n \n \n \n \n F1-4yr4-5\n \n \n \n \n \n \n \n \n \n F1-4yr6-9\n \n \n \n \n \n \n \n \n \n F1-4yr>=35\n \n \n \n \n \n \n \n \n \n F10-14yr0-\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14yr10\n \n \n \n \n \n \n F10-14yr14\n \n \n \n \n \n \n F10-14yr20\n \n \n \n \n \n \n F10-14yr25\n \n \n \n \n \n \n F10-14yr4-\n \n \n \n \n \n \n F10-14yr6-\n \n \n \n \n \n \n F10-14yr>=\n \n \n \n \n \n \n F5-9yr0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9yr10-1\n \n \n \n \n \n \n F5-9yr14-1\n \n \n \n \n \n \n F5-9yr20-2\n \n \n \n \n \n \n F5-9yr25-3\n \n \n \n \n \n \n F5-9yr4-5\n \n \n \n \n \n \n F5-9yr6-9\n \n \n \n \n \n \n F5-9yr>=35\n \n \n \n \n \n \n F<1yr0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1yr10-13\n \n \n \n \n \n \n F<1yr14-19\n \n \n \n \n \n \n F<1yr20-24\n \n \n \n \n \n \n F<1yr25-34\n \n \n \n \n \n \n F<1yr4-5\n \n \n \n \n \n \n F<1yr6-9\n \n \n \n \n \n \n F<1yr>=35\n \n \n \n \n \n \n M1-4yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4yr10-1\n \n \n \n \n \n \n M1-4yr14-1\n \n \n \n \n \n \n M1-4yr20-2\n \n \n \n \n \n \n M1-4yr25-3\n \n \n \n \n \n \n M1-4yr4-5\n \n \n \n \n \n \n M1-4yr6-9\n \n \n \n \n \n \n M1-4yr>=35\n \n \n \n \n \n \n M10-14yr0-\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14yr10\n \n \n \n \n \n \n M10-14yr14\n \n \n \n \n \n \n M10-14yr20\n \n \n \n \n \n \n M10-14yr25\n \n \n \n \n \n \n M10-14yr4-\n \n \n \n \n \n \n M10-14yr6-\n \n \n \n \n \n \n M10-14yr>=\n \n \n \n \n \n \n M5-9yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9yr10-1\n \n \n \n \n \n \n M5-9yr14-1\n \n \n \n \n \n \n M5-9yr20-2\n \n \n \n \n \n \n M5-9yr25-3\n \n \n \n \n \n \n M5-9yr4-5\n \n \n \n \n \n \n M5-9yr6-9\n \n \n \n \n \n \n M5-9yr>=35\n \n \n \n \n \n \n M<1yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1yr10-13\n \n \n \n \n \n \n M<1yr14-19\n \n \n \n \n \n \n M<1yr20-24\n \n \n \n \n \n \n M<1yr25-34\n \n \n \n \n \n \n M<1yr4-5\n \n \n \n \n \n \n M<1yr6-9\n \n \n \n \n \n \n M<1yr>=35\n \n \n \n \n \n \n','2023-08-16 10:53:21',4,'2023-08-16 13:15:59',4,0,NULL,NULL,NULL,'983588a7-5b66-41ef-ad94-a32596694717'),(2330,'HIV Lost To Follow Up','HIV patients who have not been seen for at least 18 months','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HIV Lost To Follow Up\n HIV patients who have not been seen for at least 18 months\n \n 2023-08-16 09:25:57 UTC\n \n \n lastExecutionTime\n \n java.util.Date\n true\n \n \n \n \n /* \n * Name:HIV Lost To Follow Up \n * Query Type: SQL Cohort Query \n * Description: HIV patients who have not been seen for at least 18 months \n * Assumption: Database has only HIV patients \n * HIV Case Reporting Module has already excluded patients previously added to the list. \n */ \n \n SELECT e2.patient_id \n FROM ( \n SELECT e1.patient_id, max(e1.encounter_datetime) as latest_encounter_date \n FROM encounter e1 \n WHERE not e1.voided \n GROUP BY e1.patient_id \n ) as e2 \n WHERE \n date(e2.latest_encounter_date) <= DATE_SUB(now(), INTERVAL 18 MONTH) \n AND \n date(e2.latest_encounter_date) > DATE_SUB(:lastExecutionTime, INTERVAL 18 MONTH); \n\n','2023-08-16 11:25:57',2,NULL,NULL,0,NULL,NULL,NULL,'8916dca2-85b6-4eea-b921-d5cffe1056d4'),(2331,'HIV Patient Died','HIV patients who have died','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HIV Patient Died\n HIV patients who have died\n \n 2023-08-16 09:25:57 UTC\n \n \n lastExecutionTime\n \n java.util.Date\n true\n \n \n \n \n /* \n * Name:HIV Patient Died \n * Query Type: SQL Cohort Query \n * Description: HIV patients who have died \n * Assumption: Database has only HIV patients \n * HIV Case Reporting Module has already excluded patients previously added to the list. \n */ \n \n SELECT person_id \n FROM person \n WHERE dead = 1 \n AND( \n date_created >= date(:lastExecutionTime) \n OR date_changed >= date(:lastExecutionTime) \n ) \n AND not voided; \n\n','2023-08-16 11:25:57',2,NULL,NULL,0,NULL,NULL,NULL,'d8cb3c40-0d86-4448-8f1f-cf4cd91ece26'),(2333,'Children ARV Regimen_2ndLine_5C','Children ARV Regimen_2ndLine_5C disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5C\n Children ARV Regimen_2ndLine_5C disaggregated by weight, sex, age\n \n 2023-08-16 10:14:20 UTC\n \n 2023-08-16 10:14:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2333\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-16 12:14:20',4,'2023-08-16 12:14:36',4,0,NULL,NULL,NULL,'38a458f9-cb42-4eb7-9b3a-22be06efe0e5'),(2334,'Children ARV Regimen_2ndLine_5C Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5C Data Set\n \n 2023-08-16 10:14:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n \n \n','2023-08-16 12:14:27',4,NULL,NULL,0,NULL,NULL,NULL,'2d670708-bd88-4e83-b9fa-9a0b6d137ea1'),(2335,'Children ARV Regimen_2ndLine_5C Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5C Data Set\n \n 2023-08-16 10:14:36 UTC\n \n 2023-08-16 11:42:37 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2335\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4y0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4y10-13\n \n \n \n \n \n \n \n \n \n F1-4y14-19\n \n \n \n \n \n \n \n \n \n F1-4y20-24\n \n \n \n \n \n \n \n \n \n F1-4y25-34\n \n \n \n \n \n \n \n \n \n F1-4y4-5\n \n \n \n \n \n \n \n \n \n F1-4y6-9\n \n \n \n \n \n \n \n \n \n F1-4y>=35\n \n \n \n \n \n \n \n \n \n F10-14y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14y10-\n \n \n \n \n \n \n F10-14y14-\n \n \n \n \n \n \n F10-14y20-\n \n \n \n \n \n \n F10-14y25-\n \n \n \n \n \n \n F10-14y4-5\n \n \n \n \n \n \n F10-14y6-9\n \n \n \n \n \n \n \n \n \n F10-14y>=3\n \n \n \n \n \n \n F5-9y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9y10-13\n \n \n \n \n \n \n F5-9y14-19\n \n \n \n \n \n \n \n \n \n F5-9y20-24\n \n \n \n \n \n \n F5-9y25-34\n \n \n \n \n \n \n F5-9y4-5\n \n \n \n \n \n \n F5-9y6-9\n \n \n \n \n \n \n F5-9y>=35\n \n \n \n \n \n \n F<1y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1y10-13\n \n \n \n \n \n \n F<1y14-19\n \n \n \n \n \n \n F<1y20-24\n \n \n \n \n \n \n F<1y25-34\n \n \n \n \n \n \n F<1y4-9\n \n \n \n \n \n \n F<1y6-9\n \n \n \n \n \n \n F<1y>=35\n \n \n \n \n \n \n M1-4y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4y10-13\n \n \n \n \n \n \n M1-4y14-19\n \n \n \n \n \n \n M1-4y20-24\n \n \n \n \n \n \n \n \n \n M1-4y25-34\n \n \n \n \n \n \n M1-4y4-5\n \n \n \n \n \n \n M1-4y6-9\n \n \n \n \n \n \n M1-4y>=35\n \n \n \n \n \n \n M10-14y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14y10-\n \n \n \n \n \n \n M10-14y14-\n \n \n \n \n \n \n \n \n \n M10-14y20-\n \n \n \n \n \n \n M10-14y25-\n \n \n \n \n \n \n M10-14y4-5\n \n \n \n \n \n \n M10-14y6-9\n \n \n \n \n \n \n M10-14y>=3\n \n \n \n \n \n \n M5-9y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9y10-13\n \n \n \n \n \n \n M5-9y14-19\n \n \n \n \n \n \n M5-9y20-24\n \n \n \n \n \n \n M5-9y25-34\n \n \n \n \n \n \n M5-9y4-5\n \n \n \n \n \n \n M5-9y6-9\n \n \n \n \n \n \n M5-9y>=35\n \n \n \n \n \n \n M<1y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1y10-13\n \n \n \n \n \n \n M<1y14-19\n \n \n \n \n \n \n M<1y20-24\n \n \n \n \n \n \n M<1y24-34\n \n \n \n \n \n \n M<1y5-9\n \n \n \n \n \n \n M<1y6-9\n \n \n \n \n \n \n M<1y>=35\n \n \n \n \n \n \n','2023-08-16 12:14:36',4,'2023-08-16 13:42:37',4,0,NULL,NULL,NULL,'5add0ab6-3850-4623-ad50-8f5d30ba2df9'),(2336,'Children ARV Regimen_2ndLine_5D','Children ARV Regimen_2ndLine_5D disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5D\n Children ARV Regimen_2ndLine_5D disaggregated by weight, sex, age\n \n 2023-08-16 11:00:11 UTC\n \n 2023-08-16 11:00:49 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2336\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-16 13:00:11',4,'2023-08-16 13:00:49',4,0,NULL,NULL,NULL,'3a4943e7-3026-4e28-b345-26acb4012006'),(2337,'Children ARV Regimen_2ndLine_5D Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5D Data Set\n \n 2023-08-16 11:00:49 UTC\n \n 2023-08-16 14:46:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2337\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4y0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4y10-13\n \n \n \n \n \n \n \n \n \n F1-4y14-19\n \n \n \n \n \n \n \n \n \n F1-4y20-24\n \n \n \n \n \n \n \n \n \n F1-4y25-34\n \n \n \n \n \n \n \n \n \n F1-4y4-5\n \n \n \n \n \n \n \n \n \n F1-4y6-9\n \n \n \n \n \n \n \n \n \n F1-4y>=35\n \n \n \n \n \n \n \n \n \n F10-14y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14y10-\n \n \n \n \n \n \n F10-14y14-\n \n \n \n \n \n \n F10-14y20-\n \n \n \n \n \n \n F10-14y25-\n \n \n \n \n \n \n F10-14y4-5\n \n \n \n \n \n \n F10-14y6-9\n \n \n \n \n \n \n F10-14y>=3\n \n \n \n \n \n \n F5-9y0-3\n \n \n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9y10-13\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9y14-19\n \n \n \n \n \n \n F5-9y20-24\n \n \n \n \n \n \n F5-9y25-34\n \n \n \n \n \n \n F5-9y4-5\n \n \n \n \n \n \n F5-9y6-9\n \n \n \n \n \n \n F5-9y>=35\n \n \n \n \n \n \n F<1y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1y10-13\n \n \n \n \n \n \n F<1y14-19\n \n \n \n \n \n \n F<1y20-24\n \n \n \n \n \n \n F<1y25-34\n \n \n \n \n \n \n F<1y4-5\n \n \n \n \n \n \n F<1y6-9\n \n \n \n \n \n \n F<1y>=35\n \n \n \n \n \n \n M1-4y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4y10-13\n \n \n \n \n \n \n M1-4y14-19\n \n \n \n \n \n \n M1-4y20-24\n \n \n \n \n \n \n M1-4y25-34\n \n \n \n \n \n \n M1-4y4-5\n \n \n \n \n \n \n M1-4y6-9\n \n \n \n \n \n \n M1-4y>=35\n \n \n \n \n \n \n M10-14y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14y10-\n \n \n \n \n \n \n \n \n \n M10-14y14-\n \n \n \n \n \n \n \n \n \n M10-14y20-\n \n \n \n \n \n \n M10-14y25-\n \n \n \n \n \n \n M10-14y4-5\n \n \n \n \n \n \n M10-14y6-9\n \n \n \n \n \n \n M10-14y>=3\n \n \n \n \n \n \n M5-9y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9y10-13\n \n \n \n \n \n \n M5-9y14-19\n \n \n \n \n \n \n M5-9y20-24\n \n \n \n \n \n \n M5-9y25-34\n \n \n \n \n \n \n M5-9y4-5\n \n \n \n \n \n \n M5-9y6-9\n \n \n \n \n \n \n M5-9y>=35\n \n \n \n \n \n \n M<1y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1y10-13\n \n \n \n \n \n \n M<1y14-19\n \n \n \n \n \n \n M<1y20-24\n \n \n \n \n \n \n M<1y25-34\n \n \n \n \n \n \n M<1y4-5\n \n \n \n \n \n \n M<1y6-9\n \n \n \n \n \n \n M<1y>=35\n \n \n \n \n \n \n','2023-08-16 13:00:49',4,'2023-08-16 16:46:17',4,0,NULL,NULL,NULL,'51fbe59a-77f3-40b1-9d18-e90e9cd9cacc'),(2338,'Children ARV Regimen_3rdLine_6C','Children ARV Regimen_3rdLine_6C disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_6C\n Children ARV Regimen_3rdLine_6C disaggregated by weight, sex, age\n \n 2023-08-16 11:26:46 UTC\n \n 2023-08-16 11:27:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2338\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-16 13:26:46',4,'2023-08-16 13:27:31',4,0,NULL,NULL,NULL,'61228d0f-b944-4ccc-ba45-d47ecd58c914'),(2339,'Children ARV Regimen_3rdLine_6C Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_6C Data Set\n \n 2023-08-16 11:27:31 UTC\n \n 2023-08-16 12:37:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2339\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4yr0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4yr10-1\n \n \n \n \n \n \n \n \n \n F1-4yr14-1\n \n \n \n \n \n \n \n \n \n F1-4yr20-2\n \n \n \n \n \n \n \n \n \n F1-4yr25-3\n \n \n \n \n \n \n \n \n \n F1-4yr4-5\n \n \n \n \n \n \n \n \n \n F1-4yr6-9\n \n \n \n \n \n \n \n \n \n F1-4yr>=35\n \n \n \n \n \n \n \n \n \n F10-14yr0-\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14yr10\n \n \n \n \n \n \n F10-14yr14\n \n \n \n \n \n \n F10-14yr20\n \n \n \n \n \n \n \n \n \n F10-14yr25\n \n \n \n \n \n \n F10-14yr4-\n \n \n \n \n \n \n F10-14yr6-\n \n \n \n \n \n \n F10-14yr>=\n \n \n \n \n \n \n F5-9yr0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9yr10-1\n \n \n \n \n \n \n F5-9yr14-1\n \n \n \n \n \n \n F5-9yr20-2\n \n \n \n \n \n \n F5-9yr25-3\n \n \n \n \n \n \n F5-9yr4-5\n \n \n \n \n \n \n F5-9yr6-9\n \n \n \n \n \n \n F5-9yr>=35\n \n \n \n \n \n \n F<1yr0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1yr10-13\n \n \n \n \n \n \n F<1yr14-19\n \n \n \n \n \n \n F<1yr20-24\n \n \n \n \n \n \n F<1yr25-34\n \n \n \n \n \n \n F<1yr4-5\n \n \n \n \n \n \n F<1yr6-9\n \n \n \n \n \n \n F<1yr>=35\n \n \n \n \n \n \n M1-4yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4yr10-1\n \n \n \n \n \n \n M1-4yr14-1\n \n \n \n \n \n \n M1-4yr20-2\n \n \n \n \n \n \n M1-4yr25-3\n \n \n \n \n \n \n M1-4yr4-5\n \n \n \n \n \n \n M1-4yr6-9\n \n \n \n \n \n \n M1-4yr>=35\n \n \n \n \n \n \n M10-14yr0-\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14yr10\n \n \n \n \n \n \n M10-14yr14\n \n \n \n \n \n \n M10-14yr20\n \n \n \n \n \n \n M10-14yr25\n \n \n \n \n \n \n M10-14yr4-\n \n \n \n \n \n \n M10-14yr6-\n \n \n \n \n \n \n M10-14yr>=\n \n \n \n \n \n \n M5-9yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9yr10-1\n \n \n \n \n \n \n M5-9yr14-1\n \n \n \n \n \n \n M5-9yr20-2\n \n \n \n \n \n \n M5-9yr25-3\n \n \n \n \n \n \n M5-9yr4-5\n \n \n \n \n \n \n M5-9yr6-9\n \n \n \n \n \n \n M5-9yr>=35\n \n \n \n \n \n \n M<1yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1yr10-13\n \n \n \n \n \n \n M<1yr14-19\n \n \n \n \n \n \n M<1yr20-24\n \n \n \n \n \n \n M<1yr25-34\n \n \n \n \n \n \n M<1yr4-5\n \n \n \n \n \n \n M<1yr6-9\n \n \n \n \n \n \n M<1yr>=35\n \n \n \n \n \n \n','2023-08-16 13:27:31',4,'2023-08-16 14:37:59',4,0,NULL,NULL,NULL,'4a1d329b-6eeb-4ef7-a104-d1c6f9479abc'),(2342,'Children ARV Regimen_2ndLine_5E','Children ARV Regimen_2ndLine_5E disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5E\n Children ARV Regimen_2ndLine_5E disaggregated by weight, sex, age\n \n 2023-08-16 11:51:18 UTC\n \n 2023-08-16 11:52:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2342\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-16 13:51:18',4,'2023-08-16 13:52:18',4,0,NULL,NULL,NULL,'f710c498-9264-4d7e-bdb4-e846dec7972b'),(2343,'Children ARV Regimen_2ndLine_5E Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5E Data Set\n \n 2023-08-16 11:51:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n \n \n','2023-08-16 13:51:29',4,NULL,NULL,0,NULL,NULL,NULL,'8eaa5921-d13d-4bd9-912d-d9d09af7394f'),(2344,'Children ARV Regimen_2ndLine_5E Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5E Data Set\n \n 2023-08-16 11:52:09 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n \n \n','2023-08-16 13:52:09',4,NULL,NULL,0,NULL,NULL,NULL,'0105c46c-76ef-4088-b5b1-b89e42dc49d1'),(2345,'Children ARV Regimen_2ndLine_5E Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5E Data Set\n \n 2023-08-16 11:52:18 UTC\n \n 2023-08-16 15:02:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2345\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4y0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4y10-13\n \n \n \n \n \n \n \n \n \n F1-4y14-19\n \n \n \n \n \n \n \n \n \n F1-4y20-24\n \n \n \n \n \n \n \n \n \n F1-4y25-34\n \n \n \n \n \n \n \n \n \n F1-4y4-5\n \n \n \n \n \n \n \n \n \n F1-4y6-9\n \n \n \n \n \n \n \n \n \n F1-4y>=35\n \n \n \n \n \n \n \n \n \n F10-14y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14y10-\n \n \n \n \n \n \n F10-14y14-\n \n \n \n \n \n \n F10-14y20-\n \n \n \n \n \n \n F10-14y25-\n \n \n \n \n \n \n F10-14y4-5\n \n \n \n \n \n \n \n \n \n F10-14y6-9\n \n \n \n \n \n \n F10-14y>=3\n \n \n \n \n \n \n F5-9y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9y10-13\n \n \n \n \n \n \n F5-9y14-19\n \n \n \n \n \n \n F5-9y20-24\n \n \n \n \n \n \n F5-9y25-34\n \n \n \n \n \n \n F5-9y4-5\n \n \n \n \n \n \n F5-9y6-9\n \n \n \n \n \n \n F5-9y>=35\n \n \n \n \n \n \n F6-9y4-5\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1y0-3\n \n \n \n \n \n \n F<1y10-13\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Adults\n \n \n \n \n \n F<1y14-19\n \n \n \n \n \n \n F<1y20-24\n \n \n \n \n \n \n F<1y25-34\n \n \n \n \n \n \n F<1y4-5\n \n \n \n \n \n \n F<1y6-9\n \n \n \n \n \n \n F<1y>=35\n \n \n \n \n \n \n M1-4y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4y10-13\n \n \n \n \n \n \n M1-4y14-19\n \n \n \n \n \n \n M1-4y20-24\n \n \n \n \n \n \n \n \n \n M1-4y25-34\n \n \n \n \n \n \n M1-4y4-5\n \n \n \n \n \n \n M1-4y6-9\n \n \n \n \n \n \n M1-4y>=35\n \n \n \n \n \n \n M10-14y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14y10-\n \n \n \n \n \n \n M10-14y14-\n \n \n \n \n \n \n M10-14y20-\n \n \n \n \n \n \n M10-14y25-\n \n \n \n \n \n \n M10-14y4-5\n \n \n \n \n \n \n M10-14y6-9\n \n \n \n \n \n \n M10-14y>=3\n \n \n \n \n \n \n M5-9y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9y10-13\n \n \n \n \n \n \n M5-9y14-19\n \n \n \n \n \n \n M5-9y20-24\n \n \n \n \n \n \n M5-9y25-34\n \n \n \n \n \n \n M5-9y4-5\n \n \n \n \n \n \n M5-9y6-9\n \n \n \n \n \n \n M5-9y>=35\n \n \n \n \n \n \n M<1y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1y10-13\n \n \n \n \n \n \n M<1y14-19\n \n \n \n \n \n \n M<1y20-24\n \n \n \n \n \n \n M<1y25-34\n \n \n \n \n \n \n M<1y4-5\n \n \n \n \n \n \n M<1y6-9\n \n \n \n \n \n \n M<1y>=35\n \n \n \n \n \n \n','2023-08-16 13:52:18',4,'2023-08-16 17:02:44',4,0,NULL,NULL,NULL,'3b422368-2868-4d7f-a24f-936289c1b8a2'),(2346,'Children ARV Regimen_3rdLine_6D','Children ARV Regimen_3rdLine_6D disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_6D\n Children ARV Regimen_3rdLine_6D disaggregated by weight, sex, age\n \n 2023-08-16 14:30:52 UTC\n \n 2023-08-16 14:31:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2346\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-16 16:30:52',4,'2023-08-16 16:31:03',4,0,NULL,NULL,NULL,'7f66540d-c280-4dd8-a771-71057ff7ce42'),(2347,'Children ARV Regimen_3rdLine_6D Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_6D Data Set\n \n 2023-08-16 14:31:03 UTC\n \n 2023-08-16 15:52:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2347\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4yr0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4yr10-1\n \n \n \n \n \n \n \n \n \n F1-4yr14-1\n \n \n \n \n \n \n \n \n \n F1-4yr20-2\n \n \n \n \n \n \n \n \n \n F1-4yr25-3\n \n \n \n \n \n \n \n \n \n F1-4yr4-5\n \n \n \n \n \n \n \n \n \n F1-4yr6-9\n \n \n \n \n \n \n \n \n \n F1-4yr>=35\n \n \n \n \n \n \n \n \n \n F10-14yr0-\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14yr10\n \n \n \n \n \n \n F10-14yr14\n \n \n \n \n \n \n F10-14yr20\n \n \n \n \n \n \n \n \n \n F10-14yr25\n \n \n \n \n \n \n \n \n \n F10-14yr4-\n \n \n \n \n \n \n F10-14yr6-\n \n \n \n \n \n \n F10-14yr>=\n \n \n \n \n \n \n F5-9yr0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9yr10-1\n \n \n \n \n \n \n F5-9yr14-1\n \n \n \n \n \n \n F5-9yr20-2\n \n \n \n \n \n \n F5-9yr25-3\n \n \n \n \n \n \n F5-9yr4-5\n \n \n \n \n \n \n F5-9yr6-9\n \n \n \n \n \n \n F5-9yr>=35\n \n \n \n \n \n \n F<1yr0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1yr10-13\n \n \n \n \n \n \n \n \n \n F<1yr14-19\n \n \n \n \n \n \n F<1yr20-24\n \n \n \n \n \n \n F<1yr25-34\n \n \n \n \n \n \n F<1yr4-5\n \n \n \n \n \n \n F<1yr6-9\n \n \n \n \n \n \n F<1yr>=35\n \n \n \n \n \n \n M1-4yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4yr10-1\n \n \n \n \n \n \n M1-4yr14-1\n \n \n \n \n \n \n M1-4yr20-2\n \n \n \n \n \n \n M1-4yr25-3\n \n \n \n \n \n \n M1-4yr4-5\n \n \n \n \n \n \n M1-4yr6-9\n \n \n \n \n \n \n M1-4yr>=35\n \n \n \n \n \n \n M10-14yr0-\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14yr10\n \n \n \n \n \n \n M10-14yr14\n \n \n \n \n \n \n M10-14yr20\n \n \n \n \n \n \n M10-14yr25\n \n \n \n \n \n \n M10-14yr4-\n \n \n \n \n \n \n M10-14yr6-\n \n \n \n \n \n \n M10-14yr>=\n \n \n \n \n \n \n M5-9yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9yr10-1\n \n \n \n \n \n \n M5-9yr14-1\n \n \n \n \n \n \n M5-9yr20-2\n \n \n \n \n \n \n M5-9yr25-3\n \n \n \n \n \n \n M5-9yr4-5\n \n \n \n \n \n \n M5-9yr6-9\n \n \n \n \n \n \n M5-9yr>=35\n \n \n \n \n \n \n M<1yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1yr10-13\n \n \n \n \n \n \n M<1yr14-19\n \n \n \n \n \n \n M<1yr20-24\n \n \n \n \n \n \n M<1yr25-34\n \n \n \n \n \n \n M<1yr4-5\n \n \n \n \n \n \n M<1yr6-9\n \n \n \n \n \n \n M<1yr>=35\n \n \n \n \n \n \n','2023-08-16 16:31:03',4,'2023-08-16 17:52:50',4,0,NULL,NULL,NULL,'27ae096d-4997-4d00-a00a-390c70159a12'),(2348,'Children ARV Regimen_2ndLine_5F','Children ARV Regimen_2ndLine_5F disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5F\n Children ARV Regimen_2ndLine_5F disaggregated by weight, sex, age\n \n 2023-08-16 14:55:10 UTC\n \n 2023-08-16 14:55:33 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2348\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-16 16:55:10',4,'2023-08-16 16:55:33',4,0,NULL,NULL,NULL,'9d77bcc5-cf55-4f71-8e9b-77d19d82e10d'),(2349,'Children ARV Regimen_2ndLine_5F Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5F Data Set\n \n 2023-08-16 14:55:33 UTC\n \n 2023-08-16 15:48:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2349\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4y0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4y10-13\n \n \n \n \n \n \n \n \n \n F1-4y14-19\n \n \n \n \n \n \n \n \n \n F1-4y20-24\n \n \n \n \n \n \n \n \n \n F1-4y25-34\n \n \n \n \n \n \n \n \n \n F1-4y4-5\n \n \n \n \n \n \n \n \n \n F1-4y6-9\n \n \n \n \n \n \n \n \n \n F1-4y>=35\n \n \n \n \n \n \n \n \n \n F10-14y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14y10-\n \n \n \n \n \n \n \n \n \n F10-14y14-\n \n \n \n \n \n \n F10-14y20-\n \n \n \n \n \n \n F10-14y25-\n \n \n \n \n \n \n F10-14y4-5\n \n \n \n \n \n \n F10-14y6-9\n \n \n \n \n \n \n F10-14y>=3\n \n \n \n \n \n \n F5-9y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9y10-13\n \n \n \n \n \n \n F5-9y14-19\n \n \n \n \n \n \n F5-9y20-24\n \n \n \n \n \n \n F5-9y25-34\n \n \n \n \n \n \n F5-9y4-5\n \n \n \n \n \n \n F5-9y6-9\n \n \n \n \n \n \n F5-9y>=35\n \n \n \n \n \n \n F<1y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1y10-13\n \n \n \n \n \n \n F<1y14-19\n \n \n \n \n \n \n F<1y20-24\n \n \n \n \n \n \n F<1y25-34\n \n \n \n \n \n \n F<1y4-5\n \n \n \n \n \n \n F<1y6-9\n \n \n \n \n \n \n \n \n \n F<1y>=35\n \n \n \n \n \n \n M1-4y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4y10-13\n \n \n \n \n \n \n M1-4y14-19\n \n \n \n \n \n \n M1-4y20-24\n \n \n \n \n \n \n M1-4y25-34\n \n \n \n \n \n \n M1-4y4-5\n \n \n \n \n \n \n M1-4y6-9\n \n \n \n \n \n \n M1-4y>=35\n \n \n \n \n \n \n M10-14y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14y10-\n \n \n \n \n \n \n M10-14y14-\n \n \n \n \n \n \n M10-14y20-\n \n \n \n \n \n \n M10-14y25-\n \n \n \n \n \n \n M10-14y4-5\n \n \n \n \n \n \n M10-14y6-9\n \n \n \n \n \n \n M10-14y>=3\n \n \n \n \n \n \n M5-9y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9y10-13\n \n \n \n \n \n \n M5-9y14-19\n \n \n \n \n \n \n M5-9y20-24\n \n \n \n \n \n \n M5-9y25-34\n \n \n \n \n \n \n M5-9y4-5\n \n \n \n \n \n \n M5-9y6-9\n \n \n \n \n \n \n M5-9y>=35\n \n \n \n \n \n \n M<1y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1y10-13\n \n \n \n \n \n \n M<1y14-19\n \n \n \n \n \n \n M<1y20-24\n \n \n \n \n \n \n M<1y25-34\n \n \n \n \n \n \n M<1y4-5\n \n \n \n \n \n \n M<1y6-9\n \n \n \n \n \n \n M<1y>=35\n \n \n \n \n \n \n','2023-08-16 16:55:33',4,'2023-08-16 17:48:02',4,0,NULL,NULL,NULL,'dc690b7d-b448-4f9f-b159-00d2671710e6'),(2350,'Children ARV Regimen_2ndLine_5G','Children ARV Regimen_2ndLine_5G','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5G\n Children ARV Regimen_2ndLine_5G\n \n 2023-08-16 15:09:07 UTC\n \n 2023-08-16 15:10:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2350\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-16 17:09:07',4,'2023-08-16 17:10:08',4,0,NULL,NULL,NULL,'f2f7b2a9-f96e-4f72-8edf-5e0a4195ec85'),(2351,'Children ARV Regimen_2ndLine_5G Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5G Data Set\n \n 2023-08-16 15:10:08 UTC\n \n 2023-08-16 18:01:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2351\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4y0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4y10-13\n \n \n \n \n \n \n \n \n \n F1-4y14-19\n \n \n \n \n \n \n \n \n \n F1-4y20-24\n \n \n \n \n \n \n \n \n \n F1-4y25-34\n \n \n \n \n \n \n \n \n \n F1-4y4-5\n \n \n \n \n \n \n \n \n \n F1-4y6-9\n \n \n \n \n \n \n \n \n \n F1-4y>=35\n \n \n \n \n \n \n \n \n \n F10-14y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14y10-\n \n \n \n \n \n \n \n \n \n F10-14y14-\n \n \n \n \n \n \n \n \n \n F10-14y20-\n \n \n \n \n \n \n \n \n \n F10-14y25-\n \n \n \n \n \n \n F10-14y4-5\n \n \n \n \n \n \n \n \n \n F10-14y6-9\n \n \n \n \n \n \n \n \n \n F10-14y>=3\n \n \n \n \n \n \n F5-9y0-3\n \n \n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9y10-13\n \n \n \n \n \n \n F5-9y14-19\n \n \n \n \n \n \n F5-9y20-24\n \n \n \n \n \n \n F5-9y25-34\n \n \n \n \n \n \n F5-9y4-5\n \n \n \n \n \n \n F5-9y6-9\n \n \n \n \n \n \n F5-9y>=35\n \n \n \n \n \n \n F<1y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1y10-13\n \n \n \n \n \n \n F<1y14-19\n \n \n \n \n \n \n F<1y25-34\n \n \n \n \n \n \n F<1y4-5\n \n \n \n \n \n \n F<1y6-9\n \n \n \n \n \n \n F<1y>=35\n \n \n \n \n \n \n M1-4y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4y10-13\n \n \n \n \n \n \n M1-4y14-19\n \n \n \n \n \n \n M1-4y20-24\n \n \n \n \n \n \n \n \n \n M1-4y25-34\n \n \n \n \n \n \n M1-4y4-5\n \n \n \n \n \n \n M1-4y6-9\n \n \n \n \n \n \n M1-4y>=35\n \n \n \n \n \n \n \n \n \n M10-14>=35\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14y0-3\n \n \n \n \n \n \n M10-14y10-\n \n \n \n \n \n \n M10-14y14-\n \n \n \n \n \n \n M10-14y20-\n \n \n \n \n \n \n M10-14y25-\n \n \n \n \n \n \n M10-14y4-5\n \n \n \n \n \n \n M10-14y6-9\n \n \n \n \n \n \n M5-9y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9y10-13\n \n \n \n \n \n \n M5-9y14-19\n \n \n \n \n \n \n M5-9y20-24\n \n \n \n \n \n \n M5-9y25-34\n \n \n \n \n \n \n M5-9y4-5\n \n \n \n \n \n \n M5-9y6-9\n \n \n \n \n \n \n M5-9y>=35\n \n \n \n \n \n \n M<1y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1y10-13\n \n \n \n \n \n \n M<1y14-19\n \n \n \n \n \n \n M<1y20-24\n \n \n \n \n \n \n M<1y25-34\n \n \n \n \n \n \n M<1y4-5\n \n \n \n \n \n \n M<1y6-9\n \n \n \n \n \n \n M<1y>=35\n \n \n \n \n \n \n','2023-08-16 17:10:08',4,'2023-08-16 20:01:10',4,0,NULL,NULL,NULL,'1041fe73-c2e7-47db-8d84-eb79176e25fe'),(2352,'Children ARV Regimen_2ndLine_5H','Children ARV Regimen_2ndLine_5H disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5H\n Children ARV Regimen_2ndLine_5H disaggregated by weight, sex, age\n \n 2023-08-16 15:50:48 UTC\n \n 2023-08-16 15:50:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2352\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-16 17:50:48',4,'2023-08-16 17:50:59',4,0,NULL,NULL,NULL,'71b6899d-048d-4c2a-a10f-84422454ece6'),(2353,'Children ARV Regimen_2ndLine_5H Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5H Data Set\n \n 2023-08-16 15:50:59 UTC\n \n 2023-08-16 17:19:35 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2353\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4y0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4y10-13\n \n \n \n \n \n \n \n \n \n F1-4y14-19\n \n \n \n \n \n \n \n \n \n F1-4y20-24\n \n \n \n \n \n \n \n \n \n F1-4y25-34\n \n \n \n \n \n \n \n \n \n F1-4y4-5\n \n \n \n \n \n \n \n \n \n F1-4y6-9\n \n \n \n \n \n \n \n \n \n F1-4y>=35\n \n \n \n \n \n \n \n \n \n F10-14y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14y10-\n \n \n \n \n \n \n F10-14y14-\n \n \n \n \n \n \n F10-14y20-\n \n \n \n \n \n \n F10-14y25-\n \n \n \n \n \n \n F10-14y4-5\n \n \n \n \n \n \n F10-14y6-9\n \n \n \n \n \n \n F10-14y>=3\n \n \n \n \n \n \n \n \n \n F5-9y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9y10-13\n \n \n \n \n \n \n F5-9y14-19\n \n \n \n \n \n \n F5-9y20-24\n \n \n \n \n \n \n F5-9y25-34\n \n \n \n \n \n \n F5-9y4-5\n \n \n \n \n \n \n F5-9y6-9\n \n \n \n \n \n \n F5-9y>=35\n \n \n \n \n \n \n F<1y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1y10-13\n \n \n \n \n \n \n \n \n \n F<1y14-19\n \n \n \n \n \n \n F<1y20-24\n \n \n \n \n \n \n F<1y25-34\n \n \n \n \n \n \n F<1y4-5\n \n \n \n \n \n \n F<1y6-9\n \n \n \n \n \n \n F<1y>=35\n \n \n \n \n \n \n M1-4y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4y10-13\n \n \n \n \n \n \n M1-4y14-19\n \n \n \n \n \n \n M1-4y20-24\n \n \n \n \n \n \n M1-4y25-34\n \n \n \n \n \n \n M1-4y4-5\n \n \n \n \n \n \n M1-4y6-9\n \n \n \n \n \n \n M1-4y>=35\n \n \n \n \n \n \n M10-14y0-3\n \n \n \n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14y10-\n \n \n \n \n \n \n M10-14y14-\n \n \n \n \n \n \n \n \n \n M10-14y20-\n \n \n \n \n \n \n M10-14y25-\n \n \n \n \n \n \n M10-14y4-5\n \n \n \n \n \n \n M10-14y6-9\n \n \n \n \n \n \n M10-14y>=3\n \n \n \n \n \n \n M5-9y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9y10-13\n \n \n \n \n \n \n M5-9y14-19\n \n \n \n \n \n \n M5-9y20-24\n \n \n \n \n \n \n M5-9y25-34\n \n \n \n \n \n \n M5-9y4-5\n \n \n \n \n \n \n \n \n \n M5-9y6-9\n \n \n \n \n \n \n M5-9y>=35\n \n \n \n \n \n \n M<1y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1y10-13\n \n \n \n \n \n \n M<1y14-19\n \n \n \n \n \n \n M<1y20-24\n \n \n \n \n \n \n M<1y25-34\n \n \n \n \n \n \n M<1y4-5\n \n \n \n \n \n \n M<1y6-9\n \n \n \n \n \n \n M<1y>=35\n \n \n \n \n \n \n','2023-08-16 17:50:59',4,'2023-08-16 19:19:35',4,0,NULL,NULL,NULL,'fa79bb1e-c2a3-435f-8074-de92d79ed741'),(2354,'Children ARV Regimen_3rdLine_6E','Children ARV Regimen_3rdLine_6E disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_6E\n Children ARV Regimen_3rdLine_6E disaggregated by weight, sex, age\n \n 2023-08-16 15:57:11 UTC\n \n 2023-08-16 15:58:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2354\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-16 17:57:11',4,'2023-08-16 17:58:30',4,0,NULL,NULL,NULL,'ace827f2-1783-4eac-819e-12793a2c4e9f'); INSERT INTO `serialized_object` VALUES (2355,'Children ARV Regimen_3rdLine_6E Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_6E Data Set\n \n 2023-08-16 15:58:30 UTC\n \n 2023-08-16 17:28:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2355\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4yr0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4yr10-1\n \n \n \n \n \n \n \n \n \n F1-4yr14-1\n \n \n \n \n \n \n \n \n \n F1-4yr20-2\n \n \n \n \n \n \n \n \n \n F1-4yr25-3\n \n \n \n \n \n \n \n \n \n F1-4yr4-5\n \n \n \n \n \n \n \n \n \n F1-4yr6-9\n \n \n \n \n \n \n \n \n \n F1-4yr>=35\n \n \n \n \n \n \n \n \n \n F10-14yr0-\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14yr10\n \n \n \n \n \n \n F10-14yr14\n \n \n \n \n \n \n F10-14yr20\n \n \n \n \n \n \n F10-14yr25\n \n \n \n \n \n \n F10-14yr4-\n \n \n \n \n \n \n F10-14yr6-\n \n \n \n \n \n \n F10-14yr>=\n \n \n \n \n \n \n F5-9yr0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9yr10-1\n \n \n \n \n \n \n F5-9yr14-1\n \n \n \n \n \n \n F5-9yr20-2\n \n \n \n \n \n \n F5-9yr25-3\n \n \n \n \n \n \n F5-9yr4-5\n \n \n \n \n \n \n F5-9yr6-9\n \n \n \n \n \n \n F5-9yr>=35\n \n \n \n \n \n \n F<1yr0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1yr10-13\n \n \n \n \n \n \n F<1yr14-19\n \n \n \n \n \n \n F<1yr20-24\n \n \n \n \n \n \n F<1yr25-34\n \n \n \n \n \n \n F<1yr4-5\n \n \n \n \n \n \n F<1yr6-9\n \n \n \n \n \n \n F<1yr>=35\n \n \n \n \n \n \n M1-4yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4yr10-1\n \n \n \n \n \n \n M1-4yr14-1\n \n \n \n \n \n \n M1-4yr20-2\n \n \n \n \n \n \n M1-4yr25-3\n \n \n \n \n \n \n M1-4yr4-5\n \n \n \n \n \n \n M1-4yr6-9\n \n \n \n \n \n \n M1-4yr>=35\n \n \n \n \n \n \n M10-14yr0-\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14yr10\n \n \n \n \n \n \n M10-14yr14\n \n \n \n \n \n \n M10-14yr20\n \n \n \n \n \n \n M10-14yr25\n \n \n \n \n \n \n M10-14yr4-\n \n \n \n \n \n \n M10-14yr6-\n \n \n \n \n \n \n M10-14yr>=\n \n \n \n \n \n \n M5-9yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9yr10-1\n \n \n \n \n \n \n M5-9yr14-1\n \n \n \n \n \n \n M5-9yr20-2\n \n \n \n \n \n \n M5-9yr25-3\n \n \n \n \n \n \n M5-9yr4-5\n \n \n \n \n \n \n M5-9yr6-9\n \n \n \n \n \n \n M5-9yr>=35\n \n \n \n \n \n \n M<1yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1yr10-13\n \n \n \n \n \n \n M<1yr14-19\n \n \n \n \n \n \n M<1yr20-24\n \n \n \n \n \n \n M<1yr25-34\n \n \n \n \n \n \n M<1yr4-5\n \n \n \n \n \n \n M<1yr6-9\n \n \n \n \n \n \n M<1yr>=35\n \n \n \n \n \n \n','2023-08-16 17:58:30',4,'2023-08-16 19:28:59',4,0,NULL,NULL,NULL,'91b72368-e321-4a7b-968d-1271493fa958'),(2356,'Children ARV Regimen_3rdLine_6F','Children ARV Regimen_3rdLine_6F disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_6F\n Children ARV Regimen_3rdLine_6F disaggregated by weight, sex, age\n \n 2023-08-16 17:30:28 UTC\n \n 2023-08-16 17:30:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2356\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-16 19:30:28',4,'2023-08-16 19:30:40',4,0,NULL,NULL,NULL,'cba2a95d-5060-47fd-9401-a826e1c0858a'),(2357,'Children ARV Regimen_3rdLine_6F Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_6F Data Set\n \n 2023-08-16 17:30:39 UTC\n \n 2023-08-16 18:09:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2357\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4yr0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4yr10-1\n \n \n \n \n \n \n \n \n \n F1-4yr14-1\n \n \n \n \n \n \n \n \n \n F1-4yr20-2\n \n \n \n \n \n \n \n \n \n F1-4yr25-3\n \n \n \n \n \n \n \n \n \n F1-4yr4-5\n \n \n \n \n \n \n \n \n \n F1-4yr6-9\n \n \n \n \n \n \n \n \n \n F1-4yr>=35\n \n \n \n \n \n \n \n \n \n F10-14yr0-\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14yr10\n \n \n \n \n \n \n F10-14yr14\n \n \n \n \n \n \n F10-14yr20\n \n \n \n \n \n \n F10-14yr25\n \n \n \n \n \n \n F10-14yr4-\n \n \n \n \n \n \n F10-14yr6-\n \n \n \n \n \n \n F10-14yr>=\n \n \n \n \n \n \n F5-9yr0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9yr10-1\n \n \n \n \n \n \n F5-9yr14-1\n \n \n \n \n \n \n F5-9yr20-2\n \n \n \n \n \n \n F5-9yr25-3\n \n \n \n \n \n \n F5-9yr4-5\n \n \n \n \n \n \n F5-9yr6-9\n \n \n \n \n \n \n F5-9yr>=35\n \n \n \n \n \n \n F<1yr0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1yr10-13\n \n \n \n \n \n \n F<1yr14-19\n \n \n \n \n \n \n F<1yr20-24\n \n \n \n \n \n \n F<1yr25-34\n \n \n \n \n \n \n F<1yr4-5\n \n \n \n \n \n \n F<1yr6-9\n \n \n \n \n \n \n F<1yr>=35\n \n \n \n \n \n \n M1-4yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4yr10-1\n \n \n \n \n \n \n M1-4yr14-1\n \n \n \n \n \n \n M1-4yr20-2\n \n \n \n \n \n \n M1-4yr25-3\n \n \n \n \n \n \n M1-4yr4-5\n \n \n \n \n \n \n M1-4yr6-9\n \n \n \n \n \n \n M1-4yr>=35\n \n \n \n \n \n \n M10-14yr0-\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14yr10\n \n \n \n \n \n \n M10-14yr14\n \n \n \n \n \n \n M10-14yr20\n \n \n \n \n \n \n M10-14yr25\n \n \n \n \n \n \n M10-14yr4-\n \n \n \n \n \n \n M10-14yr6-\n \n \n \n \n \n \n M10-14yr>=\n \n \n \n \n \n \n M5-9yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9yr10-1\n \n \n \n \n \n \n M5-9yr14-1\n \n \n \n \n \n \n M5-9yr20-2\n \n \n \n \n \n \n M5-9yr25-3\n \n \n \n \n \n \n M5-9yr4-5\n \n \n \n \n \n \n M5-9yr6-9\n \n \n \n \n \n \n M5-9yr>=35\n \n \n \n \n \n \n M<1yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1yr10-13\n \n \n \n \n \n \n M<1yr14-19\n \n \n \n \n \n \n M<1yr20-24\n \n \n \n \n \n \n M<1yr25-34\n \n \n \n \n \n \n M<1yr4-5\n \n \n \n \n \n \n M<1yr6-9\n \n \n \n \n \n \n M<1yr>=35\n \n \n \n \n \n \n','2023-08-16 19:30:39',4,'2023-08-16 20:09:14',4,0,NULL,NULL,NULL,'739d18c0-8b69-47f2-b49c-f203e776d528'),(2358,'Clients given 5A with >=20Copies_Viral_Load','Clients given 5A with >=20Copies_Viral_Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5A with >=20Copies_Viral_Load\n Clients given 5A with >=20Copies_Viral_Load\n \n 2023-08-17 08:33:38 UTC\n \n 2023-08-17 08:34:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2358\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5A \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND MONTH(os.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3681)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and oss.obs_datetime <= cast('2023-06-30'as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \n \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-17 10:33:38',4,'2023-08-17 10:34:00',4,0,NULL,NULL,NULL,'f9c21dfa-e2bc-4174-858c-5290ee412c83'),(2359,'Clients given 5A with <20Copies_Viral_Load','Clients given 5A with <20Copies_Viral_Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5A with <20Copies_Viral_Load\n Clients given 5A with <20Copies_Viral_Load\n \n 2023-08-17 08:35:33 UTC\n \n 2023-08-17 08:36:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2359\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5A \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND MONTH(os.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3681)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-17 10:35:33',4,'2023-08-17 10:36:23',4,0,NULL,NULL,NULL,'f803bb84-0a18-4319-91e7-4ea289d8a295'),(2360,'Clients given 5A with Undetectable_Viral_Load','Clients given 5A with Undetectable_Viral_Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5A with Undetectable_Viral_Load\n Clients given 5A with Undetectable_Viral_Load\n \n 2023-08-17 08:37:56 UTC\n \n 2023-08-17 08:39:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2360\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5A \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND MONTH(os.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3681)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- undetectable, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-17 10:37:56',4,'2023-08-17 10:39:04',4,0,NULL,NULL,NULL,'2386a884-ae79-46a7-8adf-d5044b06e9c4'),(2361,'Clients given 5B with >=20Copies_Viral_Load','Clients given 5B with >=20Copies_Viral_Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5B with >=20Copies_Viral_Load\n Clients given 5B with >=20Copies_Viral_Load\n \n 2023-08-17 08:44:15 UTC\n \n 2023-08-17 09:02:37 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2361\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5B \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3682)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and oss.obs_datetime <= cast('2023-06-30'as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \n \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-17 10:44:15',4,'2023-08-17 11:02:37',4,0,NULL,NULL,NULL,'5939e332-e3fc-4a42-a736-b647f31a87a3'),(2362,'Clients given 5B with <20Copies_Viral_Load','Clients given 5B with <20Copies_Viral_Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5B with <20Copies_Viral_Load\n Clients given 5B with <20Copies_Viral_Load\n \n 2023-08-17 08:59:37 UTC\n \n 2023-08-17 09:05:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2362\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5B \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3682)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-17 10:59:37',4,'2023-08-17 11:05:50',4,0,NULL,NULL,NULL,'8b4f6f3d-4444-4429-ac84-94ecc1e14ba2'),(2363,'Clients given 5B with Undetectable_Viral_Load','Clients given 5B with Undetectable_Viral_Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5B with Undetectable_Viral_Load\n Clients given 5B with Undetectable_Viral_Load\n \n 2023-08-17 09:06:53 UTC\n \n 2023-08-17 09:07:37 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2363\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5B \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3682)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- undetectable, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n)) \n \n\n','2023-08-17 11:06:53',4,'2023-08-17 11:07:37',4,0,NULL,NULL,NULL,'d7418afd-aca2-46e9-9c72-e920d447db27'),(2364,'Clients given 5C with >=20Copies_Viral_Load','Clients given 5C with >=20Copies_Viral_Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5C with >=20Copies_Viral_Load\n Clients given 5C with >=20Copies_Viral_Load\n \n 2023-08-17 09:13:04 UTC\n \n 2023-08-17 09:15:46 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2364\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4696)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and oss.obs_datetime <= cast('2023-06-30'as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-17 11:13:04',4,'2023-08-17 11:15:46',4,0,NULL,NULL,NULL,'ee32f98e-445e-4a15-8a1e-c594ad7729b3'),(2365,'Clients given 5C with <20Copies_Viral_Load','Clients given 5C with <20Copies_Viral_Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5C with <20Copies_Viral_Load\n Clients given 5C with <20Copies_Viral_Load\n \n 2023-08-17 09:18:17 UTC\n \n 2023-08-17 09:19:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2365\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4696)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-17 11:18:17',4,'2023-08-17 11:19:06',4,0,NULL,NULL,NULL,'5fc6059b-5dca-4e92-abe4-e44c4e5f9f09'),(2366,'Clients given 5C with Undetectable Viral Load','Clients given 5C with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5C with Undetectable Viral Load\n Clients given 5C with Undetectable Viral Load\n \n 2023-08-17 09:20:42 UTC\n \n 2023-08-17 09:21:13 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2366\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4696)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- undetectable, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-17 11:20:42',4,'2023-08-17 11:21:13',4,0,NULL,NULL,NULL,'f3e6450c-1bda-42b4-87d3-352e65c53612'),(2367,'Clients given 5D with >=20Copies_Viral_Load','Clients given 5D with >=20Copies_Viral_Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5D with >=20Copies_Viral_Load\n Clients given 5D with >=20Copies_Viral_Load\n \n 2023-08-17 09:31:21 UTC\n \n 2023-08-17 09:32:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2367\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5D \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4697)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and oss.obs_datetime <= cast('2023-06-30'as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-17 11:31:21',4,'2023-08-17 11:32:04',4,0,NULL,NULL,NULL,'25589972-ceb9-4c56-bb7c-2911f712e272'),(2368,'Clients given 5D with <20Copies_Viral_Load','Clients given 5D with <20Copies_Viral_Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5D with <20Copies_Viral_Load\n Clients given 5D with <20Copies_Viral_Load\n \n 2023-08-17 09:34:28 UTC\n \n 2023-08-17 09:36:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2368\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5D \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4697)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-17 11:34:28',4,'2023-08-17 11:36:20',4,0,NULL,NULL,NULL,'a9a60d85-6eba-4872-9b0c-02c941d7ff94'),(2369,'Clients given 4D with poor adherence','Clients given 4D with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D with poor adherence\n Clients given 4D with poor adherence\n \n 2023-08-17 09:51:32 UTC\n \n','2023-08-17 11:51:32',4,NULL,NULL,0,NULL,NULL,NULL,'76e21882-219e-4852-aca2-a0d774c1c79b'),(2370,'Clients given 5a with poor adherence','Clients given 5a with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5a with poor adherence\n Clients given 5a with poor adherence\n \n 2023-08-17 09:51:59 UTC\n \n 2023-08-17 09:53:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2370\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5a \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3681)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-17 11:51:59',4,'2023-08-17 11:53:44',4,0,NULL,NULL,NULL,'67dd544b-2e27-408f-824b-0312d06e9785'),(2371,'Clients given 5a with fair adherence','Clients given 5a with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5a with fair adherence\n Clients given 5a with fair adherence\n \n 2023-08-17 09:56:02 UTC\n \n 2023-08-17 09:56:33 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2371\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5a \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3681)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-17 11:56:02',4,'2023-08-17 11:56:33',4,0,NULL,NULL,NULL,'93e07039-5627-49fd-9fb4-9f3cf8ddaafd'),(2372,'Clients given 5a with good adherence','Clients given 5a with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5a with good adherence\n Clients given 5a with good adherence\n \n 2023-08-17 09:57:50 UTC\n \n 2023-08-17 09:58:24 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2372\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5a \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3681)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-17 11:57:50',4,'2023-08-17 11:58:24',4,0,NULL,NULL,NULL,'94df16c2-5336-419b-be14-fe6c390dc41b'),(2373,'Clients given 5D with Undetectable Viral Load','Clients given 5D with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5D with Undetectable Viral Load\n Clients given 5D with Undetectable Viral Load\n \n 2023-08-17 09:58:03 UTC\n \n 2023-08-17 09:58:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2373\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5D \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4697)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- undetectable, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-17 11:58:03',4,'2023-08-17 11:58:42',4,0,NULL,NULL,NULL,'95abcfbb-daac-4a02-a38c-455f5f0aca2d'),(2374,'Clients given 5E with >=20Copies_Viral_Load','Clients given 5E with >=20Copies_Viral_Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5E with >=20Copies_Viral_Load\n Clients given 5E with >=20Copies_Viral_Load\n \n 2023-08-17 10:05:15 UTC\n \n 2023-08-17 10:05:33 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2374\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4698)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and oss.obs_datetime <= cast('2023-06-30'as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-17 12:05:15',4,'2023-08-17 12:05:33',4,0,NULL,NULL,NULL,'7ec09187-6a9d-403e-97c3-f7d85f2a16a2'),(2375,'Clients given 5E with <20 Copies Viral Load','Clients given 5E with <20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5E with <20 Copies Viral Load\n Clients given 5E with <20 Copies Viral Load\n \n 2023-08-17 10:06:47 UTC\n \n 2023-08-17 10:09:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2375\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4698)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-17 12:06:47',4,'2023-08-17 12:09:36',4,0,NULL,NULL,NULL,'fc0384af-2aba-4967-94cf-351c49ff4c06'),(2376,'Clients given 5b with fair adherence','Clients given 5b with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5b with fair adherence\n Clients given 5b with fair adherence\n \n 2023-08-17 10:10:23 UTC\n \n 2023-08-17 10:12:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2376\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5b \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3682)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-17 12:10:23',4,'2023-08-17 12:12:23',4,0,NULL,NULL,NULL,'efbcc56c-18cd-4533-980c-6d8cf1c02e23'),(2377,'Clients given 5E with Undetectable Viral Load','Clients given 5E with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5E with Undetectable Viral Load\n Clients given 5E with Undetectable Viral Load\n \n 2023-08-17 10:10:47 UTC\n \n 2023-08-17 10:11:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2377\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4698)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- undetectable, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-17 12:10:47',4,'2023-08-17 12:11:44',4,0,NULL,NULL,NULL,'c1b14868-35fc-4ced-b9d6-d7434dbe4b96'),(2378,'Clients given 5b with good adherence','Clients given 5b with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5b with good adherence\n Clients given 5b with good adherence\n \n 2023-08-17 10:14:15 UTC\n \n 2023-08-17 10:15:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2378\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5b \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3682)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-17 12:14:15',4,'2023-08-17 12:15:01',4,0,NULL,NULL,NULL,'602e0915-bb58-4b03-a63e-ed3a6f83cc33'),(2379,'Clients given 5b with poor adherence','Clients given 5b with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5b with poor adherence\n Clients given 5b with poor adherence\n \n 2023-08-17 10:20:28 UTC\n \n 2023-08-17 10:24:24 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2379\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5b \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3682)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-17 12:20:28',4,'2023-08-17 12:24:24',4,0,NULL,NULL,NULL,'02a6a90c-a410-4c5e-a32f-a56f6dad4a49'),(2380,'Clients given 5F with >=20Copies Viral Load','Clients given 5F with >=20Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5F with >=20Copies Viral Load\n Clients given 5F with >=20Copies Viral Load\n \n 2023-08-17 10:20:38 UTC\n \n 2023-08-17 10:22:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2380\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4699)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 20 and _weight <= 24.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2023-08-17 12:20:38',4,'2023-08-17 12:22:29',4,0,NULL,NULL,NULL,'ed92d4db-077e-4eae-9c2c-963d455b9df3'),(2381,'Clients given 5F with <20 Copies Viral Load','Clients given 5F with <20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5F with <20 Copies Viral Load\n Clients given 5F with <20 Copies Viral Load\n \n 2023-08-17 10:27:57 UTC\n \n 2023-08-17 10:34:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2381\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4699)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-17 12:27:57',4,'2023-08-17 12:34:06',4,0,NULL,NULL,NULL,'9ca8ee52-584e-4164-85a0-73c3afffa236'),(2382,'Clients given 5F with Undetectable Viral Load','Clients given 5F with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5F with Undetectable Viral Load\n Clients given 5F with Undetectable Viral Load\n \n 2023-08-17 10:36:35 UTC\n \n 2023-08-17 10:37:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2382\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4699)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- undetectable, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-17 12:36:35',4,'2023-08-17 12:37:44',4,0,NULL,NULL,NULL,'fddbb793-03b3-432b-aa85-1afddec431d9'),(2383,'Clients given 5c with poor adherence','Clients given 5c with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5c with poor adherence\n Clients given 5c with poor adherence\n \n 2023-08-17 10:39:09 UTC\n \n 2023-08-17 10:40:19 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2383\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5c \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4696)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-17 12:39:09',4,'2023-08-17 12:40:19',4,0,NULL,NULL,NULL,'15d7e4f8-1626-4a98-ae7d-494e2cb6f49b'),(2384,'Clients given 5G with >=20Copies Viral Load','Clients given 5G with >=20Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G with >=20Copies Viral Load\n Clients given 5G with >=20Copies Viral Load\n \n 2023-08-17 10:42:06 UTC\n \n 2023-08-17 10:42:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2384\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4700)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and oss.obs_datetime <= cast('2023-06-30'as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-17 12:42:06',4,'2023-08-17 12:42:29',4,0,NULL,NULL,NULL,'2a249734-89d9-4f4c-bcab-dff2815d3b58'),(2385,'Clients given 5c with fair adherence','Clients given 5c with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5c with fair adherence\n Clients given 5c with fair adherence\n \n 2023-08-17 10:42:21 UTC\n \n 2023-08-17 10:43:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2385\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5c \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4696)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-17 12:42:21',4,'2023-08-17 12:43:23',4,0,NULL,NULL,NULL,'4d26e5f3-76e3-49fc-8a3c-f5de81a7724d'),(2386,'Clients given 5G with <20 Copies Viral Load','Clients given 5G with <20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G with <20 Copies Viral Load\n Clients given 5G with <20 Copies Viral Load\n \n 2023-08-17 10:45:37 UTC\n \n 2023-08-17 10:48:38 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2386\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4700)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-17 12:45:37',4,'2023-08-17 12:48:38',4,0,NULL,NULL,NULL,'353bb356-a392-4c21-8641-40fd092426ce'),(2387,'Clients given 5c with good adherence','Clients given 5c with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5c with good adherence\n Clients given 5c with good adherence\n \n 2023-08-17 10:56:34 UTC\n \n 2023-08-17 10:57:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2387\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5c \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4696)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-17 12:56:34',4,'2023-08-17 12:57:29',4,0,NULL,NULL,NULL,'3f30f547-9fa6-4336-b034-e79a64906b6c'),(2388,'Clients given 5G with Undetectable Viral Load','Clients given 5G with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G with Undetectable Viral Load\n Clients given 5G with Undetectable Viral Load\n \n 2023-08-17 10:58:06 UTC\n \n 2023-08-17 10:58:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2388\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4700)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- undetectable, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-17 12:58:06',4,'2023-08-17 12:58:41',4,0,NULL,NULL,NULL,'7cb7f18e-986e-4854-be48-ca51e1d753dc'),(2389,'Clients given 5d with poor adherence','Clients given 5d with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5d with poor adherence\n Clients given 5d with poor adherence\n \n 2023-08-17 11:03:17 UTC\n \n 2023-08-17 11:03:56 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2389\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5d \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4697)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-17 13:03:17',4,'2023-08-17 13:03:56',4,0,NULL,NULL,NULL,'77c59203-be56-4041-abaf-eb409f199aab'),(2390,'Clients given 5d with fair adherence','Clients given 5d with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5d with fair adherence\n Clients given 5d with fair adherence\n \n 2023-08-17 11:06:27 UTC\n \n 2023-08-17 11:07:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2390\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5d \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4697)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-17 13:06:27',4,'2023-08-17 13:07:15',4,0,NULL,NULL,NULL,'33ef5391-29b2-426b-bb43-75f88df81f18'),(2391,'Clients given 5H with >=20Copies Viral Load','Clients given 5H with >=20Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5H with >=20Copies Viral Load\n Clients given 5H with >=20Copies Viral Load\n \n 2023-08-17 11:06:39 UTC\n \n 2023-08-17 11:07:19 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2391\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND MONTH(os.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4701)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and oss.obs_datetime <= cast('2023-06-30'as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-17 13:06:39',4,'2023-08-17 13:07:19',4,0,NULL,NULL,NULL,'a6c02fb1-c931-4405-9dcd-1fa775e9d262'),(2392,':Clients given 5d with good adherence',':Clients given 5d with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n :Clients given 5d with good adherence\n :Clients given 5d with good adherence\n \n 2023-08-17 11:08:05 UTC\n \n 2023-08-17 11:08:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2392\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5d \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4697)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-17 13:08:05',4,'2023-08-17 13:08:51',4,0,NULL,NULL,NULL,'478a65e7-cbfc-4d04-bcbf-e97ad2119117'),(2393,'Clients given 5H with <20 Copies Viral Load','Clients given 5H with <20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5H with <20 Copies Viral Load\n Clients given 5H with <20 Copies Viral Load\n \n 2023-08-17 11:08:35 UTC\n \n 2023-08-17 11:09:13 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2393\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND MONTH(os.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4701)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-17 13:08:35',4,'2023-08-17 13:09:13',4,0,NULL,NULL,NULL,'92d662a9-7c9c-4d7f-8105-7892cc50f8df'),(2394,'Clients given 5H with Undetectable Viral Load','Clients given 5H with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5H with Undetectable Viral Load\n Clients given 5H with Undetectable Viral Load\n \n 2023-08-17 11:10:21 UTC\n \n 2023-08-17 11:12:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2394\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND MONTH(os.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4701)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- undetectable, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-17 13:10:21',4,'2023-08-17 13:12:04',4,0,NULL,NULL,NULL,'67ad52ec-1ca8-4bd4-977e-cb0930173888'),(2395,'Clients given 5e with poor adherence','Clients given 5e with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5e with poor adherence\n Clients given 5e with poor adherence\n \n 2023-08-17 11:11:53 UTC\n \n 2023-08-17 11:12:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2395\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5e \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4698)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-17 13:11:53',4,'2023-08-17 13:12:26',4,0,NULL,NULL,NULL,'13802910-1107-47fe-82b8-60340f77abef'),(2396,'Clients given 5e with fair adherence','Clients given 5e with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5e with fair adherence\n Clients given 5e with fair adherence\n \n 2023-08-17 11:13:19 UTC\n \n 2023-08-17 11:13:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2396\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5e \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4698)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-17 13:13:19',4,'2023-08-17 13:13:43',4,0,NULL,NULL,NULL,'6585614b-c405-4fe5-bcb0-8edae5825b41'),(2397,'Clients given 5e with good adherence','Clients given 5e with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5e with good adherence\n Clients given 5e with good adherence\n \n 2023-08-17 11:17:29 UTC\n \n 2023-08-17 11:18:09 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2397\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5e \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4698)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-17 13:17:29',4,'2023-08-17 13:18:09',4,0,NULL,NULL,NULL,'dc9c0189-b91f-4b80-a484-67e2f5b4005c'),(2398,'Clients given 6A with >=20Copies Viral Load','Clients given 6A with >=20Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6A with >=20Copies Viral Load\n Clients given 6A with >=20Copies Viral Load\n \n 2023-08-17 11:19:05 UTC\n \n 2023-08-17 11:19:35 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2398\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6A \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and oss.obs_datetime <= cast('2023-06-30'as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-17 13:19:05',4,'2023-08-17 13:19:35',4,0,NULL,NULL,NULL,'b0f47001-fdc3-4ea5-be0c-00112fab3bc8'),(2399,'Clients given 6A with <20 Copies Viral Load','Clients given 6A with <20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6A with <20 Copies Viral Load\n Clients given 6A with <20 Copies Viral Load\n \n 2023-08-17 11:21:31 UTC\n \n 2023-08-17 11:22:34 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2399\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6A \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n \n)) \n \n\n','2023-08-17 13:21:31',4,'2023-08-17 13:22:34',4,0,NULL,NULL,NULL,'b912ab78-0fb9-4639-a1f4-56f1e6b2e44e'),(2400,'Clients given 6A with Undetectable Viral Load','Clients given 6A with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6A with Undetectable Viral Load\n Clients given 6A with Undetectable Viral Load\n \n 2023-08-17 11:23:42 UTC\n \n 2023-08-17 11:24:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2400\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6A \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- undetectable, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n \n)) \n \n\n','2023-08-17 13:23:42',4,'2023-08-17 13:24:21',4,0,NULL,NULL,NULL,'2801df34-8bcf-4a7b-bc89-1210ad3d727d'),(2401,'Clients given 5f with poor adherence','Clients given 5f with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5f with poor adherence\n Clients given 5f with poor adherence\n \n 2023-08-17 11:26:41 UTC\n \n 2023-08-17 11:27:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2401\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5f \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4699)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-17 13:26:41',4,'2023-08-17 13:27:36',4,0,NULL,NULL,NULL,'c0c6a92f-87ed-4149-85af-4ed2e31328ac'),(2402,'Clients given 6B with >=20Copies Viral Load','Clients given 6B with >=20Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6B with >=20Copies Viral Load\n Clients given 6B with >=20Copies Viral Load\n \n 2023-08-17 11:27:26 UTC\n \n 2023-08-17 11:31:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2402\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6B \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and oss.obs_datetime <= cast('2023-06-30'as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-17 13:27:26',4,'2023-08-17 13:31:50',4,0,NULL,NULL,NULL,'c01f687e-baef-4589-b4fd-63abfc132991'),(2403,'Clients given 6B with <20 Copies Viral Load','Clients given 6B with <20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6B with <20 Copies Viral Load\n Clients given 6B with <20 Copies Viral Load\n \n 2023-08-17 11:29:39 UTC\n \n 2023-08-17 11:30:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2403\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6B \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-17 13:29:39',4,'2023-08-17 13:30:18',4,0,NULL,NULL,NULL,'f6a13155-22a3-4ecc-80bf-dfef935ebf86'),(2404,'Clients given 5f with fair adherence','Clients given 5f with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5f with fair adherence\n Clients given 5f with fair adherence\n \n 2023-08-17 11:31:51 UTC\n \n 2023-08-17 11:32:47 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2404\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5f \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4699)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-17 13:31:51',4,'2023-08-17 13:32:47',4,0,NULL,NULL,NULL,'250972a3-6fab-4d66-a028-7c43751cf95d'),(2405,'Clients given 6B with Undetectable Viral Load','Clients given 6B with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6B with Undetectable Viral Load\n Clients given 6B with Undetectable Viral Load\n \n 2023-08-17 11:32:32 UTC\n \n 2023-08-17 11:33:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2405\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6B \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- undetectable, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-17 13:32:32',4,'2023-08-17 13:33:32',4,0,NULL,NULL,NULL,'8a1f9b0e-f55d-40ed-b59f-92971f598921'),(2406,'Clients given 5f with good adherence','Clients given 5f with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5f with good adherence\n Clients given 5f with good adherence\n \n 2023-08-17 11:36:40 UTC\n \n 2023-08-17 11:37:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2406\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5f \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4699)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-17 13:36:40',4,'2023-08-17 13:37:11',4,0,NULL,NULL,NULL,'8839041b-b3d1-48b1-a0b2-bc09f91cad73'),(2407,'Clients given 6C with >=20 Copies Viral Load','Clients given 6C with >=20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C with >=20 Copies Viral Load\n Clients given 6C with >=20 Copies Viral Load\n \n 2023-08-17 11:39:53 UTC\n \n 2023-08-17 11:40:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2407\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4702)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and oss.obs_datetime <= cast('2023-06-30'as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-17 13:39:53',4,'2023-08-17 13:40:55',4,0,NULL,NULL,NULL,'c44258e3-391b-4e79-87f6-c647692cb3a1'),(2408,'Clients given 5g with poor adherence','Clients given 5g with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5g with poor adherence\n Clients given 5g with poor adherence\n \n 2023-08-17 11:41:26 UTC\n \n 2023-08-17 11:41:56 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2408\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5g \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4700)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-17 13:41:26',4,'2023-08-17 13:41:56',4,0,NULL,NULL,NULL,'a21e3c23-e513-4a3f-b229-b0baad328af6'),(2409,'Clients given 6C with <20 Copies Viral Load','Clients given 6C with <20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C with <20 Copies Viral Load\n Clients given 6C with <20 Copies Viral Load\n \n 2023-08-17 11:42:38 UTC\n \n 2023-08-17 11:43:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2409\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4702)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-17 13:42:38',4,'2023-08-17 13:43:20',4,0,NULL,NULL,NULL,'307392db-30aa-4e4c-a692-ab8350cb3f42'),(2410,'Clients given 5g with fair adherence','Clients given 5g with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5g with fair adherence\n Clients given 5g with fair adherence\n \n 2023-08-17 11:43:06 UTC\n \n 2023-08-17 11:43:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2410\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5g \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4700)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-17 13:43:06',4,'2023-08-17 13:43:28',4,0,NULL,NULL,NULL,'0875bc5c-9df9-43d6-8e7a-5363f19adc4f'),(2411,'Clients given 6C with Undetectable Viral Load','Clients given 6C with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C with Undetectable Viral Load\n Clients given 6C with Undetectable Viral Load\n \n 2023-08-17 11:45:31 UTC\n \n 2023-08-17 11:46:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2411\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4702)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- undetectable, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-17 13:45:31',4,'2023-08-17 13:46:32',4,0,NULL,NULL,NULL,'eb4392cf-c7f5-43c2-8f45-b56f46771ea3'),(2412,'Clients given 5g with good adherence','Clients given 5g with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5g with good adherence\n Clients given 5g with good adherence\n \n 2023-08-17 11:46:09 UTC\n \n 2023-08-17 11:46:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2412\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5g \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4700)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-17 13:46:09',4,'2023-08-17 13:46:30',4,0,NULL,NULL,NULL,'9878645d-2648-4c62-8679-1449355eaf0a'),(2413,'Clients given 5h with poor adherence','Clients given 5h with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5h with poor adherence\n Clients given 5h with poor adherence\n \n 2023-08-17 11:49:55 UTC\n \n 2023-08-17 11:51:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2413\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5h \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4701)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-17 13:49:55',4,'2023-08-17 13:51:43',4,0,NULL,NULL,NULL,'ad1e42cb-ff60-47fd-b8b1-0649da1899a1'),(2414,'Clients given 6D with >=20Copies Viral Load','Clients given 6D with >=20Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D with >=20Copies Viral Load\n Clients given 6D with >=20Copies Viral Load\n \n 2023-08-17 11:50:35 UTC\n \n 2023-08-17 11:51:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2414\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6D \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4703)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and oss.obs_datetime <= cast('2023-06-30'as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-17 13:50:35',4,'2023-08-17 13:51:45',4,0,NULL,NULL,NULL,'dbcd7d71-ba25-4619-8d23-dd2592aaf59a'),(2415,'Clients given 6D with <20 Copies Viral Load','Clients given 6D with <20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D with <20 Copies Viral Load\n Clients given 6D with <20 Copies Viral Load\n \n 2023-08-17 11:53:15 UTC\n \n 2023-08-17 11:54:09 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2415\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6D \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4703)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-17 13:53:15',4,'2023-08-17 13:54:09',4,0,NULL,NULL,NULL,'0199fd5f-2426-4c4e-b266-818a815ba80a'),(2416,'Clients given 5h with fair adherence','Clients given 5h with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5h with fair adherence\n Clients given 5h with fair adherence\n \n 2023-08-17 11:54:17 UTC\n \n 2023-08-17 11:54:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2416\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5h \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4701)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-17 13:54:17',4,'2023-08-17 13:54:39',4,0,NULL,NULL,NULL,'5478dbb5-4f3d-4a39-b263-625158d98129'),(2417,'Clients given 6D with Undetectable Viral Load','Clients given 6D with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D with Undetectable Viral Load\n Clients given 6D with Undetectable Viral Load\n \n 2023-08-17 11:55:34 UTC\n \n 2023-08-17 11:56:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2417\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6D \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4703)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- undetectable, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-17 13:55:34',4,'2023-08-17 13:56:31',4,0,NULL,NULL,NULL,'10a317c1-829c-4739-b7c0-f0b4ba18a69f'),(2418,'Clients given 5h with good adherence','Clients given 5h with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5h with good adherence\n Clients given 5h with good adherence\n \n 2023-08-17 11:57:56 UTC\n \n 2023-08-17 11:58:25 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2418\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5h \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4701)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-17 13:57:56',4,'2023-08-17 13:58:25',4,0,NULL,NULL,NULL,'00df085c-fd67-466a-94fa-2807a5cce6f7'),(2419,'Clients given 6E with >=20Copies Viral Load','Clients given 6E with >=20Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E with >=20Copies Viral Load\n Clients given 6E with >=20Copies Viral Load\n \n 2023-08-17 12:02:11 UTC\n \n 2023-08-17 12:04:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2419\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4704)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and oss.obs_datetime <= cast('2023-06-30'as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-17 14:02:11',4,'2023-08-17 14:04:41',4,0,NULL,NULL,NULL,'7c9d1608-dd16-4a6f-a811-aa9c285da131'),(2420,'Clients given 6a with poor adherence','Clients given 6a with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6a with poor adherence\n Clients given 6a with poor adherence\n \n 2023-08-17 12:07:35 UTC\n \n 2023-08-17 12:07:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2420\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6a \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-17 14:07:35',4,'2023-08-17 14:07:53',4,0,NULL,NULL,NULL,'b1f7d697-7125-4ad4-b73d-8538c0d0bf37'),(2421,'Clients given 6E with <20 Copies Viral Load','Clients given 6E with <20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E with <20 Copies Viral Load\n Clients given 6E with <20 Copies Viral Load\n \n 2023-08-17 12:07:43 UTC\n \n 2023-08-17 12:08:22 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2421\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4704)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-17 14:07:43',4,'2023-08-17 14:08:22',4,0,NULL,NULL,NULL,'76cdd1d3-9bb0-462b-a63d-5babfae535ae'),(2422,'Clients given 6a with fair adherence','Clients given 6a with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6a with fair adherence\n Clients given 6a with fair adherence\n \n 2023-08-17 12:09:05 UTC\n \n 2023-08-17 12:09:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2422\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6a \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-17 14:09:05',4,'2023-08-17 14:09:40',4,0,NULL,NULL,NULL,'7caf8270-2015-4b33-9cc4-2d23dcbbdd40'),(2423,'Clients given 6E with Undetectable Viral Load','Clients given 6E with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E with Undetectable Viral Load\n Clients given 6E with Undetectable Viral Load\n \n 2023-08-17 12:09:16 UTC\n \n 2023-08-17 12:10:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2423\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4704)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- undetectable, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-17 14:09:16',4,'2023-08-17 14:10:12',4,0,NULL,NULL,NULL,'42483bdd-5217-4e57-acfb-9dd6c405fc4e'),(2424,'Clients given 6a with good adherence','Clients given 6a with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6a with good adherence\n Clients given 6a with good adherence\n \n 2023-08-17 12:11:25 UTC\n \n 2023-08-17 12:11:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2424\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6a \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-17 14:11:25',4,'2023-08-17 14:11:53',4,0,NULL,NULL,NULL,'495d25ab-dea0-49b3-89de-2f64548597eb'),(2425,'Clients given 6F with >=20Copies Viral Load','Clients given 6F with >=20Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F with >=20Copies Viral Load\n Clients given 6F with >=20Copies Viral Load\n \n 2023-08-17 12:12:26 UTC\n \n 2023-08-17 12:13:56 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2425\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4705)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and oss.obs_datetime <= cast('2023-06-30'as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-17 14:12:26',4,'2023-08-17 14:13:56',4,0,NULL,NULL,NULL,'72be7653-8e41-42f4-9a8d-caa979c15ef6'),(2426,'Clients given 6F with <20 Copies Viral Load','Clients given 6F with <20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F with <20 Copies Viral Load\n Clients given 6F with <20 Copies Viral Load\n \n 2023-08-17 12:14:54 UTC\n \n 2023-08-17 12:15:37 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2426\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4705)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-17 14:14:54',4,'2023-08-17 14:15:37',4,0,NULL,NULL,NULL,'d11f84f3-e524-4688-9ad5-450362112a3d'),(2427,'Clients given 6b with poor adherence','Clients given 6b with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6b with poor adherence\n Clients given 6b with poor adherence\n \n 2023-08-17 12:15:12 UTC\n \n 2023-08-17 12:16:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2427\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6b \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-17 14:15:12',4,'2023-08-17 14:16:00',4,0,NULL,NULL,NULL,'c16525a3-70e2-41e5-948b-171525dbc0aa'),(2428,'Clients given 6F with Undetectable Viral Load','Clients given 6F with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F with Undetectable Viral Load\n Clients given 6F with Undetectable Viral Load\n \n 2023-08-17 12:16:55 UTC\n \n 2023-08-17 12:17:37 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2428\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4705)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- undetectable, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-17 14:16:55',4,'2023-08-17 14:17:37',4,0,NULL,NULL,NULL,'e278c929-0e08-4577-92f9-e1a972fcf688'),(2429,'Clients given 5a with >=20Copies Viral Load','Clients given 5a with >=20Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5a with >=20Copies Viral Load\n Clients given 5a with >=20Copies Viral Load\n \n 2023-08-17 12:19:02 UTC\n \n 2023-08-17 12:21:57 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2429\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 14:19:02',4,'2023-08-17 14:21:57',4,0,NULL,NULL,NULL,'ac679df3-e5a4-4548-ba63-4fd778196ea4'),(2430,'Clients given 6b with fair adherence','Clients given 6b with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6b with fair adherence\n Clients given 6b with fair adherence\n \n 2023-08-17 12:19:38 UTC\n \n 2023-08-17 12:19:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2430\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6b \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-17 14:19:38',4,'2023-08-17 14:19:59',4,0,NULL,NULL,NULL,'c4aaf23a-6f87-424e-b8d6-b1519273b376'),(2431,'Clients given 6b with good adherence','Clients given 6b with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6b with good adherence\n Clients given 6b with good adherence\n \n 2023-08-17 12:21:00 UTC\n \n 2023-08-17 12:21:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2431\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6b \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-17 14:21:00',4,'2023-08-17 14:21:45',4,0,NULL,NULL,NULL,'96917926-b178-4bf4-8113-7300329ee951'),(2432,'Clients given 5A with <20Copies Viral Load','Clients given 5A with <20Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5A with <20Copies Viral Load\n Clients given 5A with <20Copies Viral Load\n \n 2023-08-17 12:23:16 UTC\n \n 2023-08-17 12:25:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2432\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 14:23:16',4,'2023-08-17 14:25:32',4,0,NULL,NULL,NULL,'9a1038ff-dcfd-4b2c-93a9-d7c68030d1ef'),(2433,'Clients given 5A with Undetectable Viral Load','Clients given 5A with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5A with Undetectable Viral Load\n Clients given 5A with Undetectable Viral Load\n \n 2023-08-17 12:27:23 UTC\n \n 2023-08-17 12:28:22 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2433\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 14:27:23',4,'2023-08-17 14:28:22',4,0,NULL,NULL,NULL,'f401ae7b-f27f-4b25-926f-65e3b8c81863'),(2434,'Clients given 5B with >=20Copies Viral Load','Clients given 5B with >=20Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5B with >=20Copies Viral Load\n Clients given 5B with >=20Copies Viral Load\n \n 2023-08-17 12:29:26 UTC\n \n 2023-08-17 12:33:25 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2434\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 14:29:26',4,'2023-08-17 14:33:25',4,0,NULL,NULL,NULL,'938a8cf8-cfb9-422e-be17-3a1e59e3c135'),(2435,'Clients given 6c with poor adherence','Clients given 6c with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6c with poor adherence\n Clients given 6c with poor adherence\n \n 2023-08-17 12:34:23 UTC\n \n 2023-08-17 12:35:25 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2435\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6c \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4702)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-17 14:34:23',4,'2023-08-17 14:35:25',4,0,NULL,NULL,NULL,'a854add1-66a5-4624-94b8-ee9cc9f6b618'),(2436,'Clients given 5B with <20 Copies Viral Load','','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5B with <20 Copies Viral Load\n \n \n 2023-08-17 12:34:37 UTC\n \n 2023-08-17 12:35:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2436\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 14:34:37',4,'2023-08-17 14:35:36',4,0,NULL,NULL,NULL,'160dcddc-c186-4d31-a0c8-47edca4fc581'),(2437,'Clients given 5B with Undetectable Viral Load','Clients given 5B with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5B with Undetectable Viral Load\n Clients given 5B with Undetectable Viral Load\n \n 2023-08-17 12:36:46 UTC\n \n 2023-08-17 12:38:09 UTC\n \n \n endDate\n \n java.util.Date\n true\n \n \n startDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2437\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 14:36:46',4,'2023-08-17 14:38:09',4,0,NULL,NULL,NULL,'5f976c00-44ef-4b36-bed0-b976bb7f2b55'),(2438,'Clients given 6c with fair adherence','Clients given 6c with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6c with fair adherence\n Clients given 6c with fair adherence\n \n 2023-08-17 12:36:48 UTC\n \n 2023-08-17 12:37:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2438\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6c \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4702)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-17 14:36:48',4,'2023-08-17 14:37:12',4,0,NULL,NULL,NULL,'65b4eb44-cc9f-494e-b621-ee1bdedbc549'),(2439,'Clients given 6c with good adherence','Clients given 6c with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6c with good adherence\n Clients given 6c with good adherence\n \n 2023-08-17 12:38:40 UTC\n \n 2023-08-17 12:38:57 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2439\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6c \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4702)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-17 14:38:40',4,'2023-08-17 14:38:57',4,0,NULL,NULL,NULL,'17b46231-8af2-49d6-ab43-17a6d13d30d4'),(2440,'Clients given 5C with >=20 Copies Viral Load','Clients given 5C with >=20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5C with >=20 Copies Viral Load\n Clients given 5C with >=20 Copies Viral Load\n \n 2023-08-17 12:38:53 UTC\n \n 2023-08-17 12:39:46 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2440\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 14:38:53',4,'2023-08-17 14:39:46',4,0,NULL,NULL,NULL,'ddd536bc-c879-4847-9c50-cc79a002813e'),(2441,'Clients given 6d with poor adherence','Clients given 6d with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6d with poor adherence\n Clients given 6d with poor adherence\n \n 2023-08-17 12:40:45 UTC\n \n 2023-08-17 12:41:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2441\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6d \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4703)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-17 14:40:45',4,'2023-08-17 14:41:01',4,0,NULL,NULL,NULL,'fa914aa2-ce96-4063-a749-7718cf76a361'),(2442,'Clients given 5C with <20 Copies Viral Load','Clients given 5C with <20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5C with <20 Copies Viral Load\n Clients given 5C with <20 Copies Viral Load\n \n 2023-08-17 12:41:03 UTC\n \n 2023-08-17 12:43:01 UTC\n \n \n endDate\n \n java.util.Date\n true\n \n \n startDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2442\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 14:41:03',4,'2023-08-17 14:43:01',4,0,NULL,NULL,NULL,'394324e6-b5b5-406f-9fb0-83194dc1b533'),(2443,'Clients given 6d with fair adherence','Clients given 6d with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6d with fair adherence\n Clients given 6d with fair adherence\n \n 2023-08-17 12:41:48 UTC\n \n 2023-08-17 12:42:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2443\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6d \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4703)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-17 14:41:48',4,'2023-08-17 14:42:15',4,0,NULL,NULL,NULL,'6a150299-a792-4070-953d-c475224522f9'),(2444,' Clients given 6d with good adherence',' Clients given 6d with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6d with good adherence\n Clients given 6d with good adherence\n \n 2023-08-17 12:43:47 UTC\n \n 2023-08-17 12:44:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2444\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6d \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4703)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-17 14:43:47',4,'2023-08-17 14:44:08',4,0,NULL,NULL,NULL,'66ddc4ec-de69-43a5-8cda-3e7f9f8d28af'),(2445,'Clients given 5C with Undetectable Viral Load','Clients given 5C with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5C with Undetectable Viral Load\n Clients given 5C with Undetectable Viral Load\n \n 2023-08-17 12:44:54 UTC\n \n 2023-08-17 12:50:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2445\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 14:44:54',4,'2023-08-17 14:50:20',4,0,NULL,NULL,NULL,'c75e1385-b87e-49d1-a8ba-418f96c68379'),(2446,'Clients given 6e with poor adherence','Clients given 6e with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6e with poor adherence\n Clients given 6e with poor adherence\n \n 2023-08-17 12:49:27 UTC\n \n 2023-08-17 12:49:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2446\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6e \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4704)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-17 14:49:27',4,'2023-08-17 14:49:43',4,0,NULL,NULL,NULL,'0a65b09f-f0a6-45a6-a240-46f0a48dda2a'),(2447,'Clients given 6e with fair adherence','Clients given 6e with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6e with fair adherence\n Clients given 6e with fair adherence\n \n 2023-08-17 12:50:30 UTC\n \n 2023-08-17 12:50:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2447\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6e \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4704)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-17 14:50:30',4,'2023-08-17 14:50:58',4,0,NULL,NULL,NULL,'3e2fec32-323e-453b-b4e1-23e746f37f1a'),(2448,'Clients given 6e with good adherence','Clients given 6e with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6e with good adherence\n Clients given 6e with good adherence\n \n 2023-08-17 12:52:12 UTC\n \n 2023-08-17 12:53:46 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2448\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6e \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4704)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-17 14:52:12',4,'2023-08-17 14:53:46',4,0,NULL,NULL,NULL,'ca2d72c9-cfb8-44bd-8859-2813817d6a80'),(2449,'Clients given 6f with poor adherence','Clients given 6f with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6f with poor adherence\n Clients given 6f with poor adherence\n \n 2023-08-17 12:55:45 UTC\n \n 2023-08-17 12:56:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2449\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6f \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4705)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-17 14:55:45',4,'2023-08-17 14:56:07',4,0,NULL,NULL,NULL,'68e19030-f17c-4489-8e26-e854ac11fcde'),(2450,'Clients given 6f with fair adherence','Clients given 6f with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6f with fair adherence\n Clients given 6f with fair adherence\n \n 2023-08-17 12:56:59 UTC\n \n 2023-08-17 12:57:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2450\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6f \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4705)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-17 14:56:59',4,'2023-08-17 14:57:27',4,0,NULL,NULL,NULL,'9680051f-31ff-417c-9560-8bfce8b63699'),(2451,'Clients given 6f with good adherence','Clients given 6f with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6f with good adherence\n Clients given 6f with good adherence\n \n 2023-08-17 12:57:57 UTC\n \n 2023-08-17 12:58:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2451\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6f \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4705)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-17 14:57:57',4,'2023-08-17 14:58:15',4,0,NULL,NULL,NULL,'44fef653-ab93-4af5-a5b4-84c2dc981aee'),(2452,'Clients given 5D with >=20Copies_Viral_Load','Clients given 5D with >=20Copies_Viral_Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5D with >=20Copies_Viral_Load\n Clients given 5D with >=20Copies_Viral_Load\n \n 2023-08-17 13:57:36 UTC\n \n 2023-08-17 14:00:01 UTC\n \n \n endDate\n \n java.util.Date\n true\n \n \n startDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2452\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 15:57:36',4,'2023-08-17 16:00:01',4,0,NULL,NULL,NULL,'bcaf7abb-e0b1-4b0d-8bce-72a0bcd6aa19'),(2453,'Clients given 5a with poor adherence','Clients given 5a with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5a with poor adherence\n Clients given 5a with poor adherence\n \n 2023-08-17 13:57:52 UTC\n \n 2023-08-17 13:59:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2453\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 15:57:52',4,'2023-08-17 15:59:50',4,0,NULL,NULL,NULL,'a744dde1-e30e-4a5c-877e-a5ad781ff393'),(2454,'Clients given 5a with fair adherence','Clients given 5a with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5a with fair adherence\n Clients given 5a with fair adherence\n \n 2023-08-17 14:01:28 UTC\n \n 2023-08-17 14:02:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2454\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:01:28',4,'2023-08-17 16:02:53',4,0,NULL,NULL,NULL,'63a61c4d-d9b0-4d4b-91a9-9aeba57141aa'),(2455,'Clients given 5D with <20Copies_Viral_Load','Clients given 5D with <20Copies_Viral_Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5D with <20Copies_Viral_Load\n Clients given 5D with <20Copies_Viral_Load\n \n 2023-08-17 14:01:35 UTC\n \n 2023-08-17 14:02:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2455\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:01:35',4,'2023-08-17 16:02:39',4,0,NULL,NULL,NULL,'ec730cde-9848-44d6-93c0-081b9faf2710'),(2456,'Clients given 5D with Undetectable Viral Load','Clients given 5D with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5D with Undetectable Viral Load\n Clients given 5D with Undetectable Viral Load\n \n 2023-08-17 14:03:49 UTC\n \n 2023-08-17 14:05:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2456\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:03:49',4,'2023-08-17 16:05:14',4,0,NULL,NULL,NULL,'f254459b-e8e8-4930-837c-a1c156604ebf'),(2457,'Clients given 5E with >=20Copies_Viral_Load','Clients given 5E with >=20Copies_Viral_Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5E with >=20Copies_Viral_Load\n Clients given 5E with >=20Copies_Viral_Load\n \n 2023-08-17 14:05:53 UTC\n \n 2023-08-17 14:06:48 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2457\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:05:53',4,'2023-08-17 16:06:48',4,0,NULL,NULL,NULL,'4bea5c18-e6c1-4c17-b1d2-df2a72d826b4'),(2458,'Clients given 5a with good adherence','Clients given 5a with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5a with good adherence\n Clients given 5a with good adherence\n \n 2023-08-17 14:06:18 UTC\n \n 2023-08-17 14:07:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2458\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:06:18',4,'2023-08-17 16:07:21',4,0,NULL,NULL,NULL,'6b4360ec-6413-487c-b5ce-6306a93d594d'),(2459,'Clients given 5E with <20 Copies Viral Load','Clients given 5E with <20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5E with <20 Copies Viral Load\n Clients given 5E with <20 Copies Viral Load\n \n 2023-08-17 14:07:29 UTC\n \n 2023-08-17 14:08:34 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2459\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:07:29',4,'2023-08-17 16:08:34',4,0,NULL,NULL,NULL,'2941db2b-ab51-4716-85b7-d433faab7089'),(2460,'Clients given 5b with poor adherence','Clients given 5b with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5b with poor adherence\n Clients given 5b with poor adherence\n \n 2023-08-17 14:08:02 UTC\n \n 2023-08-17 14:08:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2460\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:08:02',4,'2023-08-17 16:08:58',4,0,NULL,NULL,NULL,'40f47ac2-87c8-4b1c-a673-ce43a9e640ae'),(2461,'Clients given 5E with Undetectable Viral Load','Clients given 5E with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5E with Undetectable Viral Load\n Clients given 5E with Undetectable Viral Load\n \n 2023-08-17 14:09:17 UTC\n \n 2023-08-17 14:10:49 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2461\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:09:17',4,'2023-08-17 16:10:49',4,0,NULL,NULL,NULL,'4bff5bff-95d4-4b93-b4e0-bb6a0c0e70b9'),(2462,'Clients given 5b with fair adherence','Clients given 5b with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5b with fair adherence\n Clients given 5b with fair adherence\n \n 2023-08-17 14:09:25 UTC\n \n 2023-08-17 14:10:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2462\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:09:25',4,'2023-08-17 16:10:18',4,0,NULL,NULL,NULL,'6fc3a2a5-a532-4394-8c1f-a824d12535b1'),(2463,'Clients given 5b with good adherence','Clients given 5b with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5b with good adherence\n Clients given 5b with good adherence\n \n 2023-08-17 14:11:16 UTC\n \n 2023-08-17 14:15:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2463\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:11:16',4,'2023-08-17 16:15:00',4,0,NULL,NULL,NULL,'0370fb97-e838-423b-a27f-84b8bfccbdf7'),(2464,'Clients given 5F with >=20Copies Viral Load','Clients given 5F with >=20Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5F with >=20Copies Viral Load\n Clients given 5F with >=20Copies Viral Load\n \n 2023-08-17 14:11:27 UTC\n \n 2023-08-17 14:12:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2464\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:11:27',4,'2023-08-17 16:12:29',4,0,NULL,NULL,NULL,'57bdd154-b1fd-445e-9c4f-4c86d9574dca'),(2465,'Clients given 5c with poor adherence','Clients given 5c with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5c with poor adherence\n Clients given 5c with poor adherence\n \n 2023-08-17 14:11:45 UTC\n \n 2023-08-17 14:15:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2465\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:11:45',4,'2023-08-17 16:15:44',4,0,NULL,NULL,NULL,'55fe3a12-7f92-4c13-a9e4-130999a508ab'),(2466,'Clients given 5F with <20 Copies Viral Load','Clients given 5F with <20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5F with <20 Copies Viral Load\n Clients given 5F with <20 Copies Viral Load\n \n 2023-08-17 14:13:17 UTC\n \n 2023-08-17 14:14:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2466\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:13:17',4,'2023-08-17 16:14:26',4,0,NULL,NULL,NULL,'99587c4e-7a32-4f0a-8875-db1f5ded867f'),(2467,'Clients given 5F with Undetectable Viral Load','Clients given 5F with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5F with Undetectable Viral Load\n Clients given 5F with Undetectable Viral Load\n \n 2023-08-17 14:15:33 UTC\n \n 2023-08-17 14:16:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2467\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:15:33',4,'2023-08-17 16:16:40',4,0,NULL,NULL,NULL,'ab5801be-bc9d-4d49-b637-c40c1442e859'),(2468,'Clients given 5c with fair adherence','Clients given 5c with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5c with fair adherence\n Clients given 5c with fair adherence\n \n 2023-08-17 14:16:13 UTC\n \n 2023-08-17 14:17:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2468\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:16:13',4,'2023-08-17 16:17:42',4,0,NULL,NULL,NULL,'c3f8c51c-b012-4725-93b5-3806093e90a2'),(2469,'Clients given 5G with >=20Copies Viral Load','Clients given 5G with >=20Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G with >=20Copies Viral Load\n Clients given 5G with >=20Copies Viral Load\n \n 2023-08-17 14:17:34 UTC\n \n 2023-08-17 14:19:13 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2469\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:17:34',4,'2023-08-17 16:19:13',4,0,NULL,NULL,NULL,'ac5ef4a7-17ea-4550-bd66-73b5d95c9c04'),(2470,'Clients given 5c with good adherence','Clients given 5c with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5c with good adherence\n Clients given 5c with good adherence\n \n 2023-08-17 14:18:32 UTC\n \n 2023-08-17 14:22:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2470\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:18:32',4,'2023-08-17 16:22:06',4,0,NULL,NULL,NULL,'c667f290-2936-42fb-859e-4d8978b03814'),(2471,'Clients given 5d with poor adherence','Clients given 5d with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5d with poor adherence\n Clients given 5d with poor adherence\n \n 2023-08-17 14:19:32 UTC\n \n 2023-08-17 14:24:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2471\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:19:32',4,'2023-08-17 16:24:53',4,0,NULL,NULL,NULL,'4f154124-3ed5-4605-afb8-ab6d47c97cfa'),(2472,'Clients given 5G with <20 Copies Viral Load','Clients given 5G with <20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G with <20 Copies Viral Load\n Clients given 5G with <20 Copies Viral Load\n \n 2023-08-17 14:20:08 UTC\n \n 2023-08-17 14:23:09 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2472\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:20:08',4,'2023-08-17 16:23:09',4,0,NULL,NULL,NULL,'1b6b36fd-ab78-457d-9af4-ecd3ec235533'),(2473,'Clients given 5G with Undetectable Viral Load','Clients given 5G with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G with Undetectable Viral Load\n Clients given 5G with Undetectable Viral Load\n \n 2023-08-17 14:24:11 UTC\n \n 2023-08-17 14:25:46 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2473\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:24:11',4,'2023-08-17 16:25:46',4,0,NULL,NULL,NULL,'8e1a22eb-ac03-450c-9550-43957fc8e8af'),(2474,'Clients given 5d with fair adherence','Clients given 5d with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5d with fair adherence\n Clients given 5d with fair adherence\n \n 2023-08-17 14:26:28 UTC\n \n 2023-08-17 14:27:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2474\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:26:28',4,'2023-08-17 16:27:32',4,0,NULL,NULL,NULL,'64f11aa4-8642-4293-8a6d-ed4436c8b783'),(2475,'Clients given 5H with >=20Copies Viral Load','Clients given 5H with >=20Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5H with >=20Copies Viral Load\n Clients given 5H with >=20Copies Viral Load\n \n 2023-08-17 14:26:40 UTC\n \n 2023-08-17 14:27:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2475\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:26:40',4,'2023-08-17 16:27:31',4,0,NULL,NULL,NULL,'3184b05c-dbf5-4c1a-abed-d310e409fb09'),(2476,'Clients given 5d with good adherence','Clients given 5d with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5d with good adherence\n Clients given 5d with good adherence\n \n 2023-08-17 14:27:55 UTC\n \n 2023-08-17 14:35:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2476\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:27:55',4,'2023-08-17 16:35:53',4,0,NULL,NULL,NULL,'d60ecbe6-5a56-449d-814e-d669d864ed86'),(2477,'Clients given 5H with <20 Copies Viral Load','Clients given 5H with <20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5H with <20 Copies Viral Load\n Clients given 5H with <20 Copies Viral Load\n \n 2023-08-17 14:28:41 UTC\n \n 2023-08-17 14:30:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2477\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:28:41',4,'2023-08-17 16:30:28',4,0,NULL,NULL,NULL,'54488b0e-09b6-4801-8d42-510fefdfa04c'),(2478,'Clients given 5H with Undetectable Viral Load','Clients given 5H with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5H with Undetectable Viral Load\n Clients given 5H with Undetectable Viral Load\n \n 2023-08-17 14:31:09 UTC\n \n 2023-08-17 14:34:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2478\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:31:09',4,'2023-08-17 16:34:51',4,0,NULL,NULL,NULL,'7a4e4111-651c-407d-b445-041fd397599c'),(2479,'Clients given 5d with good adherence','Clients given 5d with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5d with good adherence\n Clients given 5d with good adherence\n \n 2023-08-17 14:33:34 UTC\n \n 2023-08-17 14:33:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2479\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5d \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4697)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-17 16:33:34',4,'2023-08-17 16:33:55',4,0,NULL,NULL,NULL,'3300f25b-40f1-4c24-8223-41cfada5c62a'); -INSERT INTO `serialized_object` VALUES (2480,'Clients given 6A with >=20Copies Viral Load','Clients given 6A with >=20Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6A with >=20Copies Viral Load\n Clients given 6A with >=20Copies Viral Load\n \n 2023-08-17 14:35:48 UTC\n \n 2023-08-17 14:36:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2480\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:35:48',4,'2023-08-17 16:36:40',4,0,NULL,NULL,NULL,'aaaf1254-b937-4fdd-abdf-7f99bc97c9e4'),(2481,'Clients given 5e with poor adherence','Clients given 5e with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5e with poor adherence\n Clients given 5e with poor adherence\n \n 2023-08-17 14:36:47 UTC\n \n 2023-08-17 14:37:52 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2481\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:36:47',4,'2023-08-17 16:37:52',4,0,NULL,NULL,NULL,'b6365db8-5402-488e-bf43-1b4b3869592c'),(2482,'Clients given 6A with <20 Copies Viral Load','Clients given 6A with <20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6A with <20 Copies Viral Load\n Clients given 6A with <20 Copies Viral Load\n \n 2023-08-17 14:37:57 UTC\n \n 2023-08-17 14:40:25 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2482\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:37:57',4,'2023-08-17 16:40:25',4,0,NULL,NULL,NULL,'6dc49bb6-9be8-4b6b-9db7-7cd1e9e9832b'),(2483,'Clients given 5e with fair adherence','Clients given 5e with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5e with fair adherence\n Clients given 5e with fair adherence\n \n 2023-08-17 14:38:45 UTC\n \n 2023-08-17 14:40:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2483\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:38:45',4,'2023-08-17 16:40:42',4,0,NULL,NULL,NULL,'c9761b31-3a7f-4cdb-bce2-e422d0f0a1d9'),(2484,'Clients given 6A with Undetectable Viral Load','Clients given 6A with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6A with Undetectable Viral Load\n Clients given 6A with Undetectable Viral Load\n \n 2023-08-17 14:41:52 UTC\n \n 2023-08-17 14:43:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2484\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:41:52',4,'2023-08-17 16:43:11',4,0,NULL,NULL,NULL,'88ff8b16-c2f3-4f73-accf-0b799dbd4357'),(2485,'Clients given 6B with >=20Copies Viral Load','Clients given 6B with >=20Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6B with >=20Copies Viral Load\n Clients given 6B with >=20Copies Viral Load\n \n 2023-08-17 14:43:49 UTC\n \n 2023-08-17 15:26:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2485\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:43:49',4,'2023-08-17 17:26:07',4,0,NULL,NULL,NULL,'3e4ca350-0d23-4326-b54b-1da860205aa2'),(2486,'Clients given 5e with good adherence','Clients given 5e with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5e with good adherence\n Clients given 5e with good adherence\n \n 2023-08-17 14:44:26 UTC\n \n 2023-08-17 14:46:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2486\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:44:26',4,'2023-08-17 16:46:50',4,0,NULL,NULL,NULL,'bf269091-cd68-4987-adc0-88a0d53b0799'),(2487,'Clients given 5f with poor adherence','Clients given 5f with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5f with poor adherence\n Clients given 5f with poor adherence\n \n 2023-08-17 14:45:30 UTC\n \n 2023-08-17 14:47:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2487\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:45:30',4,'2023-08-17 16:47:18',4,0,NULL,NULL,NULL,'8628ac34-e4de-44ad-bf49-0cd48799c0e0'),(2488,'Clients given 5f with fair adherence','Clients given 5f with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5f with fair adherence\n Clients given 5f with fair adherence\n \n 2023-08-17 14:47:44 UTC\n \n 2023-08-17 14:48:56 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2488\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:47:44',4,'2023-08-17 16:48:56',4,0,NULL,NULL,NULL,'05773449-f7c2-428e-b2d7-13d526846f6d'),(2489,'Clients given 5f with good adherence','Clients given 5f with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5f with good adherence\n Clients given 5f with good adherence\n \n 2023-08-17 14:48:23 UTC\n \n 2023-08-17 14:51:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2489\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:48:23',4,'2023-08-17 16:51:06',4,0,NULL,NULL,NULL,'0a2c5054-fcf0-46e8-94bd-150cc697fad7'),(2490,'Clients given 5g with poor adherence','Clients given 5g with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5g with poor adherence\n Clients given 5g with poor adherence\n \n 2023-08-17 14:51:41 UTC\n \n 2023-08-17 14:52:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2490\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:51:41',4,'2023-08-17 16:52:53',4,0,NULL,NULL,NULL,'92f0cb76-2f6b-4be0-b525-90c4d4665b90'),(2491,'Clients given 5g with fair adherence','Clients given 5g with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5g with fair adherence\n Clients given 5g with fair adherence\n \n 2023-08-17 14:54:10 UTC\n \n 2023-08-17 14:55:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2491\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:54:10',4,'2023-08-17 16:55:17',4,0,NULL,NULL,NULL,'d159ee3c-798c-4b94-ae55-f17634b6bd38'),(2492,'Clients given 5g with good adherence','Clients given 5g with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5g with good adherence\n Clients given 5g with good adherence\n \n 2023-08-17 14:55:50 UTC\n \n 2023-08-17 14:56:54 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2492\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:55:50',4,'2023-08-17 16:56:54',4,0,NULL,NULL,NULL,'2c0bc567-51cc-4892-a4ce-5266c8e9cf58'),(2493,'Clients given 5h with poor adherence','Clients given 5h with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5h with poor adherence\n Clients given 5h with poor adherence\n \n 2023-08-17 14:56:39 UTC\n \n 2023-08-17 14:58:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2493\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:56:39',4,'2023-08-17 16:58:17',4,0,NULL,NULL,NULL,'18332615-0cd2-4f3c-a2dd-537056310823'),(2494,'Clients given 5h with fair adherence','Clients given 5h with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5h with fair adherence\n Clients given 5h with fair adherence\n \n 2023-08-17 14:57:51 UTC\n \n 2023-08-17 14:59:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2494\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:57:51',4,'2023-08-17 16:59:12',4,0,NULL,NULL,NULL,'9bee8b12-d34c-4ec0-a136-cdc38d312f76'),(2495,'Clients given 5h with good adherence','Clients given 5h with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5h with good adherence\n Clients given 5h with good adherence\n \n 2023-08-17 14:59:01 UTC\n \n 2023-08-17 15:00:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2495\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:59:01',4,'2023-08-17 17:00:11',4,0,NULL,NULL,NULL,'8d2837ca-19e0-461e-8bde-fdee3e9f117c'),(2496,'Clients given 6a with poor adherence','Clients given 6a with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6a with poor adherence\n Clients given 6a with poor adherence\n \n 2023-08-17 15:00:41 UTC\n \n 2023-08-17 15:01:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2496\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:00:41',4,'2023-08-17 17:01:40',4,0,NULL,NULL,NULL,'25323965-1cc3-4c63-b997-5c6ff173ad1b'),(2497,'Clients given 6a with fair adherence','Clients given 6a with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6a with fair adherence\n Clients given 6a with fair adherence\n \n 2023-08-17 15:01:29 UTC\n \n 2023-08-17 15:03:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2497\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:01:29',4,'2023-08-17 17:03:14',4,0,NULL,NULL,NULL,'38990f18-eb9c-43ff-8323-96c3a6eb90c2'),(2498,'Clients given 6a with good adherence','Clients given 6a with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6a with good adherence\n Clients given 6a with good adherence\n \n 2023-08-17 15:02:51 UTC\n \n 2023-08-17 15:04:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2498\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:02:51',4,'2023-08-17 17:04:00',4,0,NULL,NULL,NULL,'2e00abe1-aed1-485e-858f-2a0baf0eaf3c'),(2499,'Clients given 6b with poor adherence','Clients given 6b with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6b with poor adherence\n Clients given 6b with poor adherence\n \n 2023-08-17 15:04:48 UTC\n \n 2023-08-17 15:06:13 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2499\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:04:48',4,'2023-08-17 17:06:13',4,0,NULL,NULL,NULL,'2452d808-0319-435c-8a68-0f849c38d53e'),(2500,'Clients given 6b with fair adherence','Clients given 6b with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6b with fair adherence\n Clients given 6b with fair adherence\n \n 2023-08-17 15:06:01 UTC\n \n 2023-08-17 15:08:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2500\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:06:01',4,'2023-08-17 17:08:42',4,0,NULL,NULL,NULL,'6a9e9b7e-3e06-4f47-9abb-ad685a5d86ca'),(2501,'Clients given 6b with good adherence','Clients given 6b with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6b with good adherence\n Clients given 6b with good adherence\n \n 2023-08-17 15:06:55 UTC\n \n 2023-08-17 15:09:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2501\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:06:55',4,'2023-08-17 17:09:06',4,0,NULL,NULL,NULL,'8340a9bc-f2fc-4a2d-ab84-74569dfe8a86'),(2502,'Clients given 6c with poor adherence','Clients given 6c with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6c with poor adherence\n Clients given 6c with poor adherence\n \n 2023-08-17 15:09:40 UTC\n \n 2023-08-17 15:11:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2502\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:09:40',4,'2023-08-17 17:11:01',4,0,NULL,NULL,NULL,'052f51db-d6e4-4078-9f3f-bed7d17b48bd'),(2503,'Clients given 6c with fair adherence','Clients given 6c with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6c with fair adherence\n Clients given 6c with fair adherence\n \n 2023-08-17 15:10:40 UTC\n \n 2023-08-17 15:12:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2503\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:10:40',4,'2023-08-17 17:12:06',4,0,NULL,NULL,NULL,'f8e62785-7303-493a-9c20-6c9f4280faf0'),(2504,'Clients given 6c with good adherence','Clients given 6c with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6c with good adherence\n Clients given 6c with good adherence\n \n 2023-08-17 15:11:54 UTC\n \n 2023-08-17 15:13:48 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2504\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:11:54',4,'2023-08-17 17:13:48',4,0,NULL,NULL,NULL,'9b361e36-e897-4212-8c7f-26121e595425'),(2505,'Clients given 6d with poor adherence','Clients given 6d with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6d with poor adherence\n Clients given 6d with poor adherence\n \n 2023-08-17 15:13:21 UTC\n \n 2023-08-17 15:15:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2505\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:13:21',4,'2023-08-17 17:15:04',4,0,NULL,NULL,NULL,'56b2509b-811c-4452-8432-5807792f207a'),(2506,'Clients given 6d with fair adherence','Clients given 6d with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6d with fair adherence\n Clients given 6d with fair adherence\n \n 2023-08-17 15:14:20 UTC\n \n 2023-08-17 15:16:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2506\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:14:20',4,'2023-08-17 17:16:21',4,0,NULL,NULL,NULL,'2808446d-305f-4bf7-b83b-3a5aad7cc119'),(2507,'Clients given 6d with good adherence','Clients given 6d with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6d with good adherence\n Clients given 6d with good adherence\n \n 2023-08-17 15:17:32 UTC\n \n 2023-08-17 15:17:52 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2507\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6d \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4703)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-17 17:17:32',4,'2023-08-17 17:17:52',4,0,NULL,NULL,NULL,'a10f7cfb-6012-4c2a-8f4f-f9ef7cdd8310'),(2508,'Clients given 6d with good adherence','Clients given 6d with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6d with good adherence\n Clients given 6d with good adherence\n \n 2023-08-17 15:18:32 UTC\n \n 2023-08-17 15:19:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2508\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:18:32',4,'2023-08-17 17:19:41',4,0,NULL,NULL,NULL,'e271c92e-f3e8-4218-a758-f2d91fd4173e'),(2509,'Clients given 6e with poor adherence','Clients given 6e with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6e with poor adherence\n Clients given 6e with poor adherence\n \n 2023-08-17 15:19:01 UTC\n \n 2023-08-17 15:20:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2509\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:19:01',4,'2023-08-17 17:20:53',4,0,NULL,NULL,NULL,'8c2c0191-d6e6-4f9c-a84d-976f24a47e5a'),(2510,'Clients given 6e with fair adherence','Clients given 6e with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6e with fair adherence\n Clients given 6e with fair adherence\n \n 2023-08-17 15:20:17 UTC\n \n 2023-08-17 15:22:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2510\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:20:17',4,'2023-08-17 17:22:00',4,0,NULL,NULL,NULL,'16552ea9-b4bb-4ae3-ae13-c04d366a5a72'),(2511,'Clients given 6e with good adherence','Clients given 6e with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6e with good adherence\n Clients given 6e with good adherence\n \n 2023-08-17 15:21:28 UTC\n \n 2023-08-17 15:23:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2511\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:21:28',4,'2023-08-17 17:23:08',4,0,NULL,NULL,NULL,'ca215c1b-6a15-42a3-b752-9ce21c651e13'),(2512,'Clients given 6f with poor adherence','Clients given 6f with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6f with poor adherence\n Clients given 6f with poor adherence\n \n 2023-08-17 15:22:56 UTC\n \n 2023-08-17 15:24:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2512\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:22:56',4,'2023-08-17 17:24:10',4,0,NULL,NULL,NULL,'ba0a85d0-9c18-49b9-8c42-417c8d96221c'),(2513,'Clients given 6f with fair adherence','Clients given 6f with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6f with fair adherence\n Clients given 6f with fair adherence\n \n 2023-08-17 15:23:41 UTC\n \n 2023-08-17 15:25:35 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2513\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:23:41',4,'2023-08-17 17:25:35',4,0,NULL,NULL,NULL,'7abe4ec4-ba33-4f66-97c3-33ffd356c478'),(2514,'Clients given 6f with good adherence','Clients given 6f with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6f with good adherence\n Clients given 6f with good adherence\n \n 2023-08-17 15:25:08 UTC\n \n 2023-08-17 15:27:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2514\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:25:08',4,'2023-08-17 17:27:07',4,0,NULL,NULL,NULL,'605e06e0-b274-46a5-8404-e45f6bdbf36d'),(2515,'Clients given 6B with <20 Copies Viral Load','Clients given 6B with <20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6B with <20 Copies Viral Load\n Clients given 6B with <20 Copies Viral Load\n \n 2023-08-17 16:05:27 UTC\n \n 2023-08-17 16:06:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2515\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 18:05:27',4,'2023-08-17 18:06:26',4,0,NULL,NULL,NULL,'57a592d4-f5a1-4ac8-afd9-dbabd8335120'),(2516,'Clients given 6B with Undetectable Viral Load','Clients given 6B with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6B with Undetectable Viral Load\n Clients given 6B with Undetectable Viral Load\n \n 2023-08-17 16:07:16 UTC\n \n 2023-08-17 17:13:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2516\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 18:07:16',4,'2023-08-17 19:13:12',4,0,NULL,NULL,NULL,'9a6c692c-675e-490a-827d-788308c41aa2'),(2517,'Clients given 6C with >=20 Copies Viral Load','Clients given 6C with >=20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C with >=20 Copies Viral Load\n Clients given 6C with >=20 Copies Viral Load\n \n 2023-08-17 16:09:20 UTC\n \n 2023-08-17 16:10:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2517\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 18:09:20',4,'2023-08-17 18:10:11',4,0,NULL,NULL,NULL,'2b0f18d1-d6bc-48db-81e9-139e7127a014'),(2518,'Clients given 6C with <20 Copies Viral Load','Clients given 6C with <20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C with <20 Copies Viral Load\n Clients given 6C with <20 Copies Viral Load\n \n 2023-08-17 16:11:36 UTC\n \n 2023-08-17 16:12:54 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2518\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 18:11:36',4,'2023-08-17 18:12:54',4,0,NULL,NULL,NULL,'b95e0670-059d-4690-986c-e7b162edc56a'),(2519,'Clients given 6C with Undetectable Viral Load','Clients given 6C with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C with Undetectable Viral Load\n Clients given 6C with Undetectable Viral Load\n \n 2023-08-17 16:13:36 UTC\n \n 2023-08-17 16:14:33 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2519\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 18:13:36',4,'2023-08-17 18:14:33',4,0,NULL,NULL,NULL,'ef772750-6723-46e8-b1cd-2c843e8dd384'),(2520,'Clients given 6D with >=20Copies Viral Load','Clients given 6D with >=20Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D with >=20Copies Viral Load\n Clients given 6D with >=20Copies Viral Load\n \n 2023-08-17 16:15:12 UTC\n \n 2023-08-17 16:16:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2520\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 18:15:12',4,'2023-08-17 18:16:15',4,0,NULL,NULL,NULL,'7067eaf1-d98c-4806-a595-c20526eb9695'),(2521,'Clients given 6D with <20 Copies Viral Load','Clients given 6D with <20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D with <20 Copies Viral Load\n Clients given 6D with <20 Copies Viral Load\n \n 2023-08-17 16:17:05 UTC\n \n 2023-08-17 16:18:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2521\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 18:17:05',4,'2023-08-17 18:18:05',4,0,NULL,NULL,NULL,'cc8e5238-6071-4a37-b946-f6e9bf94dd26'),(2522,'Clients given 6D with Undetectable Viral Load','Clients given 6D with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D with Undetectable Viral Load\n Clients given 6D with Undetectable Viral Load\n \n 2023-08-17 16:18:46 UTC\n \n 2023-08-17 16:19:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2522\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 18:18:46',4,'2023-08-17 18:19:45',4,0,NULL,NULL,NULL,'1df8beb0-cc67-496d-ba90-fa0dbc121691'),(2523,'Clients given 6E with >=20Copies Viral Load','Clients given 6E with >=20Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E with >=20Copies Viral Load\n Clients given 6E with >=20Copies Viral Load\n \n 2023-08-17 16:20:29 UTC\n \n 2023-08-17 16:21:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2523\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 18:20:29',4,'2023-08-17 18:21:30',4,0,NULL,NULL,NULL,'6462e250-cf41-469a-83d7-e8b085ae587d'),(2524,'Clients given 6E with <20 Copies Viral Load','Clients given 6E with <20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E with <20 Copies Viral Load\n Clients given 6E with <20 Copies Viral Load\n \n 2023-08-17 16:22:10 UTC\n \n 2023-08-17 16:24:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2524\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 18:22:10',4,'2023-08-17 18:24:14',4,0,NULL,NULL,NULL,'3492f4eb-af9b-448f-b4f1-fe314ce449f1'),(2525,'Children ARV Regimen_3rdLine_Adherence','Children ARV Regimen_3rdLine_Adherence','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_Adherence\n Children ARV Regimen_3rdLine_Adherence\n \n 2023-08-17 16:26:16 UTC\n \n 2023-08-17 16:26:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2525\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-17 18:26:16',4,'2023-08-17 18:26:28',4,0,NULL,NULL,NULL,'3262e4c0-f728-4cc8-ac30-b7413a14a644'),(2526,'Children ARV Regimen_3rdLine_Adherence Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_Adherence Data Set\n \n 2023-08-17 16:26:28 UTC\n \n 2023-08-17 16:38:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2526\n \n \n \n 6A_fair\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n \n \n 6A_good\n \n \n \n \n \n \n \n \n \n 6A_poor\n \n \n \n \n \n \n \n \n \n 6B_fair\n \n \n \n \n \n \n \n \n \n 6B_good\n \n \n \n \n \n \n \n \n \n 6B_poor\n \n \n \n \n \n \n \n \n \n 6C_fair\n \n \n \n \n \n \n \n \n \n 6C_good\n \n \n \n \n \n \n \n \n \n 6C_poor\n \n \n \n \n \n \n \n \n \n 6D_fair\n \n \n \n \n \n \n \n \n \n 6D_good\n \n \n \n \n \n \n \n \n \n 6D_poor\n \n \n \n \n \n \n \n \n \n 6E_fair\n \n \n \n \n \n \n \n \n \n 6E_good\n \n \n \n \n \n \n \n \n \n 6E_poor\n \n \n \n \n \n \n \n \n \n 6F_fair\n \n \n \n \n \n \n \n \n \n 6F_good\n \n \n \n \n \n \n \n \n \n 6F_poor\n \n \n \n \n \n \n \n \n \n','2023-08-17 18:26:28',4,'2023-08-17 18:38:11',4,0,NULL,NULL,NULL,'9011d1b7-91da-465d-a4c7-38ea98126d13'),(2527,'Children ARV Regimen_2ndLine_Adherence','Children ARV Regimen_2ndLine_Adherence','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_Adherence\n Children ARV Regimen_2ndLine_Adherence\n \n 2023-08-17 16:40:24 UTC\n \n 2023-08-17 16:40:35 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2527\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-17 18:40:24',4,'2023-08-17 18:40:35',4,0,NULL,NULL,NULL,'ab24cc2a-a3ac-43a7-91c6-65bc90b27ae4'),(2528,'Children ARV Regimen_2ndLine_Adherence Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_Adherence Data Set\n \n 2023-08-17 16:40:35 UTC\n \n 2023-08-17 16:59:47 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2528\n \n \n \n 5A_fair\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n \n \n 5A_good\n \n \n \n \n \n \n \n \n \n 5A_poor\n \n \n \n \n \n \n \n \n \n 5B_fair\n \n \n \n \n \n \n \n \n \n 5B_good\n \n \n \n \n \n \n \n \n \n 5B_poor\n \n \n \n \n \n \n \n \n \n 5C_fair\n \n \n \n \n \n \n \n \n \n 5C_good\n \n \n \n \n \n \n \n \n \n 5C_poor\n \n \n \n \n \n \n \n \n \n 5D_fair\n \n \n \n \n \n \n \n \n \n 5D_good\n \n \n \n \n \n \n \n \n \n 5D_poor\n \n \n \n \n \n \n \n \n \n 5E_fair\n \n \n \n \n \n \n \n \n \n 5E_good\n \n \n \n \n \n \n \n \n \n 5E_poor\n \n \n \n \n \n \n \n \n \n 5F_fair\n \n \n \n \n \n \n \n \n \n 5F_good\n \n \n \n \n \n \n \n \n \n 5F_poor\n \n \n \n \n \n \n \n \n \n 5G_fair\n \n \n \n \n \n \n \n \n \n 5G_good\n \n \n \n \n \n \n \n \n \n 5G_poor\n \n \n \n \n \n \n \n \n \n 5H_fair\n \n \n \n \n \n \n \n \n \n 5H_good\n \n \n \n \n \n \n \n \n \n 5H_poor\n \n \n \n \n \n \n \n \n \n','2023-08-17 18:40:35',4,'2023-08-17 18:59:47',4,0,NULL,NULL,NULL,'63956153-c9e8-480d-b057-96de951cf024'),(2529,'Clients given 6E with Undetectable Viral Load','Clients given 6E with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E with Undetectable Viral Load\n Clients given 6E with Undetectable Viral Load\n \n 2023-08-17 16:48:58 UTC\n \n 2023-08-17 16:50:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2529\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 18:48:58',4,'2023-08-17 18:50:03',4,0,NULL,NULL,NULL,'836381fd-7adf-42ba-8ab4-01e9259a41f5'),(2530,'Clients given 6F with >=20Copies Viral Load','Clients given 6F with >=20Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F with >=20Copies Viral Load\n Clients given 6F with >=20Copies Viral Load\n \n 2023-08-17 16:51:45 UTC\n \n 2023-08-17 16:53:52 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2530\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 18:51:45',4,'2023-08-17 18:53:52',4,0,NULL,NULL,NULL,'b8f0e53a-22a7-40e9-a9e6-e7ce266d4a19'),(2531,'Clients given 6F with <20 Copies Viral Load','Clients given 6F with <20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F with <20 Copies Viral Load\n Clients given 6F with <20 Copies Viral Load\n \n 2023-08-17 16:55:01 UTC\n \n 2023-08-17 16:58:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2531\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 18:55:01',4,'2023-08-17 18:58:01',4,0,NULL,NULL,NULL,'b820ee3d-d805-468d-b7b4-2d1c5ce10a92'),(2532,'Children ARV Regimen_3rdLine_Viral_Load','Children ARV Regimen_3rdLine_Viral_Load','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_Viral_Load\n Children ARV Regimen_3rdLine_Viral_Load\n \n 2023-08-17 16:58:13 UTC\n \n 2023-08-17 16:58:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2532\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-17 18:58:13',4,'2023-08-17 18:58:43',4,0,NULL,NULL,NULL,'72eeaaa5-8c87-4939-a657-99b15cc3ab35'),(2533,'Children ARV Regimen_3rdLine_Viral_Load Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_Viral_Load Data Set\n \n 2023-08-17 16:58:43 UTC\n \n 2023-08-17 17:29:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2533\n \n \n \n 6A<20\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n \n \n 6A>=20\n \n \n \n \n \n \n \n \n \n 6AUndetect\n \n \n \n \n \n \n \n \n \n 6B<20\n \n \n \n \n \n \n \n \n \n 6B>=20\n \n \n \n \n \n \n \n \n \n 6BUndetect\n \n \n \n \n \n \n \n \n \n 6C<20\n \n \n \n \n \n \n \n \n \n 6C>=20\n \n \n \n \n \n \n \n \n \n 6CUndetect\n \n \n \n \n \n \n \n \n \n 6D<20\n \n \n \n \n \n \n \n \n \n 6D>=20\n \n \n \n \n \n \n \n \n \n 6DUndetect\n \n \n \n \n \n \n \n \n \n 6E<20\n \n \n \n \n \n \n \n \n \n 6E>=20\n \n \n \n \n \n \n \n \n \n 6EUndetect\n \n \n \n \n \n \n \n \n \n 6F<20\n \n \n \n \n \n \n \n \n \n 6F>=20\n \n \n \n \n \n \n \n \n \n 6FUndetect\n \n \n \n \n \n \n \n \n \n','2023-08-17 18:58:43',4,'2023-08-17 19:29:02',4,0,NULL,NULL,NULL,'0a51f76b-0306-47fa-947d-55305024054a'),(2534,'Clients given 6F with Undetectable Viral Load','Clients given 6F with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F with Undetectable Viral Load\n Clients given 6F with Undetectable Viral Load\n \n 2023-08-17 16:59:07 UTC\n \n 2023-08-17 17:02:35 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2534\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 18:59:07',4,'2023-08-17 19:02:35',4,0,NULL,NULL,NULL,'b1f06b90-64db-4554-8e81-989e206ed34a'),(2535,'Children ARV Regimen_2ndLine_Viral_Load','Children ARV Regimen_2ndLine_Viral_Load','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_Viral_Load\n Children ARV Regimen_2ndLine_Viral_Load\n \n 2023-08-17 17:06:27 UTC\n \n 2023-08-17 17:06:48 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2535\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-17 19:06:27',4,'2023-08-17 19:06:48',4,0,NULL,NULL,NULL,'701df245-5766-4e37-9d54-89e6ecedb217'),(2536,'Children ARV Regimen_2ndLine_Viral_Load Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_Viral_Load Data Set\n \n 2023-08-17 17:06:48 UTC\n \n 2023-08-17 17:26:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2536\n \n \n \n 5A_Undetec\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n \n \n 5A<20\n \n \n \n \n \n \n \n \n \n 5A>=20\n \n \n \n \n \n \n \n \n \n 5B_Undetec\n \n \n \n \n \n \n \n \n \n 5B<20\n \n \n \n \n \n \n \n \n \n 5B>=20\n \n \n \n \n \n \n \n \n \n 5C_Undetec\n \n \n \n \n \n \n \n \n \n 5C<20\n \n \n \n \n \n \n \n \n \n 5C>=20\n \n \n \n \n \n \n \n \n \n 5E_Undetec\n \n \n \n \n \n \n \n \n \n 5E<20\n \n \n \n \n \n \n \n \n \n 5E>=20\n \n \n \n \n \n \n \n \n \n 5F_Undetec\n \n \n \n \n \n \n \n \n \n 5F<20\n \n \n \n \n \n \n \n \n \n 5F>=20\n \n \n \n \n \n \n \n \n \n 5G_Undetec\n \n \n \n \n \n \n \n \n \n 5G<20\n \n \n \n \n \n \n \n \n \n 5G>=20\n \n \n \n \n \n \n \n \n \n 5H_Undetec\n \n \n \n \n \n \n \n \n \n 5H<20\n \n \n \n \n \n \n \n \n \n 5H>=20\n \n \n \n \n \n \n \n \n \n','2023-08-17 19:06:48',4,'2023-08-17 19:26:20',4,0,NULL,NULL,NULL,'2790255e-587f-411d-9f8a-dbca36aa7e0d'),(2537,'ART clients with visits started','ART clients with visits started','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n ART clients with visits started\n ART clients with visits started\n \n 2023-09-21 12:40:58 UTC\n \n 2024-02-06 12:32:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2537\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1, 2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id and vt.visit_type_id in (10,19) \n JOIN obs o on o.encounter_id=en.encounter_id \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 18:10:58',4,'2024-02-06 18:02:59',4,0,NULL,NULL,NULL,'5de36ef7-faa8-422d-943d-fdd6ad3497a0'),(2538,'ART clients with visits consulted','ART clients with visits consulted','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n ART clients with visits consulted\n ART clients with visits consulted\n \n 2023-09-21 12:41:53 UTC\n \n 2024-02-06 12:38:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2538\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id and vt.visit_type_id in (10,19) \n JOIN obs o on o.encounter_id=en.encounter_id \n and o.concept_id in (3843, 4276) and o.voided =0 \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 18:11:53',4,'2024-02-06 18:08:12',4,0,NULL,NULL,NULL,'9340a449-ab16-4a98-8dcb-240635a9042d'),(2539,'Clients initiated on ART this month','Clients initiated on ART this month','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients initiated on ART this month\n Clients initiated on ART this month\n \n 2023-09-21 12:42:21 UTC\n \n 2024-02-06 10:21:22 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2539\n select distinct patient.patient_id AS Id \n \n from obs o \n -- CLIENTS NEWLY INITIATED ON ART \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND (o.concept_id = 2249 \n \n AND CAST(o.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n AND patient.voided = 0 AND o.voided = 0 \n AND o.person_id not in ( \n select distinct os.person_id from obs os \n where os.concept_id = 3634 \n AND os.value_coded = 2095 \n and os.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and o.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages'\n','2023-09-21 18:12:21',4,'2024-02-06 15:51:22',4,0,NULL,NULL,NULL,'d3e386aa-99a9-4463-9e81-f663ca35cad2'),(2540,'TB clients with visits started','TB clients with visits started','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB clients with visits started\n TB clients with visits started\n \n 2023-09-21 12:42:50 UTC\n \n 2023-09-21 12:43:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2540\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id \n JOIN obs o on o.encounter_id=en.encounter_id \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n and v.visit_type_id = 13 \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 14:42:50',4,'2023-09-21 14:43:05',4,0,NULL,NULL,NULL,'e6d2d518-2160-4fc8-84dc-a680c609b27f'),(2541,'TB clients with visits consulted','TB clients with visits consulted','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB clients with visits consulted\n TB clients with visits consulted\n \n 2023-09-21 12:44:18 UTC\n \n 2023-09-21 12:45:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2541\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id \n JOIN obs o on o.encounter_id=en.encounter_id \n and o.concept_id in (4153,1158) and o.voided =0 \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n and v.visit_type_id = 13 \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 14:44:18',4,'2023-09-21 14:45:05',4,0,NULL,NULL,NULL,'d205535e-f890-488a-a256-a69835a9a9d8'),(2542,'HTS Clients Seen','HTS Clients Seen','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HTS Clients Seen\n HTS Clients Seen\n \n 2023-09-21 12:45:02 UTC\n \n 2023-09-21 12:45:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2542\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in( \nSELECT Id \nFROM ( \n select distinct o.person_id as Id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n where o.concept_id = 4845 and o.value_coded = 4847 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n ) as A \n)\n','2023-09-21 14:45:02',4,'2023-09-21 14:45:39',4,0,NULL,NULL,NULL,'ce0fbba8-f81e-4f15-9da5-b341fd68b611'),(2543,'HTS clients with visits started','HTS clients with visits started','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HTS clients with visits started\n HTS clients with visits started\n \n 2023-09-21 12:45:52 UTC\n \n 2023-09-21 12:46:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2543\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id \n JOIN obs o on o.encounter_id=en.encounter_id \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n and v.visit_type_id = 15 \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 14:45:52',4,'2023-09-21 14:46:05',4,0,NULL,NULL,NULL,'fe7fb845-5325-4d00-8cab-7041e6759f04'),(2544,'1st Postnatal (PNC) Attendance','1st Postnatal (PNC) Attendance','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n 1st Postnatal (PNC) Attendance\n 1st Postnatal (PNC) Attendance\n \n 2023-09-21 12:46:47 UTC\n \n 2023-09-21 12:47:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2544\n select \n o.person_id \nfrom obs o \ninner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as examination_timing \n from obs oss \n where oss.concept_id = 4393 and oss.voided=0 \n and cast(oss.obs_datetime as date) >= cast(:startDate as date) \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where concept_id = 4393 \n and o.obs_datetime = max_observation\n','2023-09-21 14:46:47',4,'2023-09-21 14:47:10',4,0,NULL,NULL,NULL,'290d3497-9608-4796-9826-1dc624696dbd'),(2545,'HTS clients with visits consulted','HTS clients with visits consulted','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HTS clients with visits consulted\n HTS clients with visits consulted\n \n 2023-09-21 12:47:27 UTC\n \n 2023-09-21 12:47:54 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2545\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id \n JOIN obs o on o.encounter_id=en.encounter_id \n and o.concept_id = 4238 and o.voided =0 \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n and v.visit_type_id = 15 \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 14:47:27',4,'2023-09-21 14:47:54',4,0,NULL,NULL,NULL,'35051ec1-423c-4ede-a68f-88e94f2dc6a2'),(2546,'Self test Kits distributed','Self test Kits distributed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Self test Kits distributed\n Self test Kits distributed\n \n 2023-09-21 12:48:21 UTC\n \n 2023-09-21 12:48:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2546\n (select patient.patient_id AS Id \n from obs o \n -- HTS SELF TEST STRATEGY \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n AND o.concept_id = 4833 and o.value_coded = 4834 \n AND patient.voided = 0 AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n ) \n \nUNION ALL \n(select patient.patient_id AS Id \n from obs o \n -- HTS SELF TEST STRATEGY \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n AND o.concept_id = 4836 and o.value_coded in (4837, 4838, 4839) \n AND patient.voided = 0 AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n )\n','2023-09-21 14:48:21',4,'2023-09-21 14:48:36',4,0,NULL,NULL,NULL,'4ef31fd0-53cc-4296-adc1-1b74455e2a5f'),(2547,'ANC clients with visits started','ANC clients with visits started','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n ANC clients with visits started\n ANC clients with visits started\n \n 2023-09-21 12:49:04 UTC\n \n 2023-09-21 12:49:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2547\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id \n JOIN obs o on o.encounter_id=en.encounter_id \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n and v.visit_type_id = 16 \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 14:49:04',4,'2023-09-21 14:49:44',4,0,NULL,NULL,NULL,'928922c7-633f-4cb0-9149-88ae7e50e237'),(2548,'Under5 Clients Seen','Under5 Clients Seen','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Under5 Clients Seen\n Under5 Clients Seen\n \n 2023-09-21 12:49:57 UTC\n \n 2023-09-21 12:50:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2548\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in( \nSELECT Id \nFROM ( \n select distinct o.person_id as Id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n where o.concept_id = 4285 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n ) as A \n)\n','2023-09-21 14:49:57',4,'2023-09-21 14:50:12',4,0,NULL,NULL,NULL,'93a89f3f-f556-4592-b12e-cf8849d58b58'),(2549,'ANC clients with visits consulted','ANC clients with visits consulted','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n ANC clients with visits consulted\n ANC clients with visits consulted\n \n 2023-09-21 12:50:25 UTC\n \n 2023-09-21 12:51:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2549\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id \n JOIN obs o on o.encounter_id=en.encounter_id \n and o.concept_id = 4663 and o.voided =0 \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n and v.visit_type_id = 16 \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 14:50:25',4,'2023-09-21 14:51:08',4,0,NULL,NULL,NULL,'ab0560b8-8a8b-4759-983b-d3b0d69afafa'),(2550,'HEI Clients Seen','HEI Clients Seen','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HEI Clients Seen\n HEI Clients Seen\n \n 2023-09-21 12:51:29 UTC\n \n 2024-02-06 12:40:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2550\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in( \nSELECT Id \nFROM ( \n select distinct o.person_id as Id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n where o.concept_id in (4189,4558) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n ) as A \n)\n','2023-09-21 18:21:29',4,'2024-02-06 18:10:40',4,0,NULL,NULL,NULL,'f8e02920-02de-4c2b-9b44-6974b937b51c'),(2551,'PNC clients with visits started','PNC clients with visits started','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PNC clients with visits started\n PNC clients with visits started\n \n 2023-09-21 12:51:49 UTC\n \n 2023-09-21 12:52:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2551\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id \n JOIN obs o on o.encounter_id=en.encounter_id \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n and v.visit_type_id = 17 \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 14:51:49',4,'2023-09-21 14:52:21',4,0,NULL,NULL,NULL,'dddf7e03-38fe-419f-81a4-625dabb0fd4e'),(2552,'Family Planning Clients seen','Family Planning Clients seen','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Family Planning Clients seen\n Family Planning Clients seen\n \n 2023-09-21 12:52:28 UTC\n \n 2023-09-21 12:52:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2552\n select \n o.person_id \nfrom obs o \ninner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as examination_timing \n from obs oss \n where oss.concept_id = 4557 and oss.voided=0 \n and cast(oss.obs_datetime as date) >= cast(:startDate as date) \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where concept_id = 4557 \n and o.obs_datetime = max_observation\n','2023-09-21 14:52:28',4,'2023-09-21 14:52:43',4,0,NULL,NULL,NULL,'287d14af-8d53-48d0-8cf4-47f141b0e9ea'),(2553,'PNC clients with visits consulted','PNC clients with visits consulted','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PNC clients with visits consulted\n PNC clients with visits consulted\n \n 2023-09-21 12:52:50 UTC\n \n 2023-09-21 12:53:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2553\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id \n JOIN obs o on o.encounter_id=en.encounter_id \n and o.concept_id = 4386 and o.voided =0 \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n and v.visit_type_id = 17 \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 14:52:50',4,'2023-09-21 14:53:03',4,0,NULL,NULL,NULL,'bf6795b4-6d7f-49bd-aff7-53781f102898'),(2554,'Cervical Cancer Screening clients seen','Cervical Cancer Screening clients seen','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Cervical Cancer Screening clients seen\n Cervical Cancer Screening clients seen\n \n 2023-09-21 12:53:29 UTC\n \n 2023-10-17 13:11:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2554\n select \n o.person_id \nfrom obs o \ninner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as examination_timing \n from obs oss \n where oss.concept_id = 4511 and oss.voided=0 \n and cast(oss.obs_datetime as date) >= cast(:startDate as date) \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where concept_id = 4511 \n and o.obs_datetime = max_observation\n','2023-09-21 18:23:29',4,'2023-10-17 18:41:36',4,0,NULL,NULL,NULL,'f436cc71-62c7-413d-81b3-0f6bbad88a73'),(2555,'HEI clients with visits started','HEI clients with visits started','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HEI clients with visits started\n HEI clients with visits started\n \n 2023-09-21 12:54:17 UTC\n \n 2023-09-21 12:54:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2555\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id \n JOIN obs o on o.encounter_id=en.encounter_id \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n and v.visit_type_id = 18 \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 14:54:17',4,'2023-09-21 14:54:29',4,0,NULL,NULL,NULL,'e26ba5ce-54c6-4693-8f0c-52aae22ce97b'),(2556,'ANC Clients Seen','ANC Clients Seen','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n ANC Clients Seen\n ANC Clients Seen\n \n 2023-09-21 12:54:42 UTC\n \n 2023-09-21 12:54:57 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2556\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in( \nSELECT Id \nFROM ( \n select distinct o.person_id as Id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n where o.concept_id = 4663 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n ) as A \n)\n','2023-09-21 14:54:42',4,'2023-09-21 14:54:57',4,0,NULL,NULL,NULL,'f58dd29e-bfcf-411a-a5fa-789722177fd1'),(2557,'HEI clients with visits consulted','HEI clients with visits consulted','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HEI clients with visits consulted\n HEI clients with visits consulted\n \n 2023-09-21 12:55:13 UTC\n \n 2023-09-21 12:56:33 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2557\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id \n JOIN obs o on o.encounter_id=en.encounter_id \n and o.concept_id in (4558, 4186) and o.voided =0 \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n and v.visit_type_id = 18 \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 14:55:13',4,'2023-09-21 14:56:33',4,0,NULL,NULL,NULL,'2bcc29bb-b22f-4866-8035-f7f1db1ead87'),(2558,'ANC Clients Seen','ANC Clients Seen','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n ANC Clients Seen\n ANC Clients Seen\n \n 2023-09-21 12:55:47 UTC\n \n 2023-09-21 12:56:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2558\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 14:55:47',4,'2023-09-21 14:56:41',4,0,NULL,NULL,NULL,'7006c9eb-caa2-4617-9151-d6872b35e3a1'),(2559,'Cervical Cancer Screening clients seen','Cervical Cancer Screening clients seen','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Cervical Cancer Screening clients seen\n Cervical Cancer Screening clients seen\n \n 2023-09-21 12:57:08 UTC\n \n 2023-09-21 12:57:52 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2559\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 14:57:08',4,'2023-09-21 14:57:52',4,0,NULL,NULL,NULL,'697c637f-d0ae-45a2-9eab-f4f9012c2412'),(2560,'Family Planning clients with visits started','Family Planning clients with visits started','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Family Planning clients with visits started\n Family Planning clients with visits started\n \n 2023-09-21 12:57:35 UTC\n \n 2023-09-21 12:57:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2560\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id \n JOIN obs o on o.encounter_id=en.encounter_id \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n and v.visit_type_id = 22 \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 14:57:35',4,'2023-09-21 14:57:59',4,0,NULL,NULL,NULL,'a713664a-9547-4de1-bcea-eab77e351ec5'),(2561,'Family Planning Clients seen','Family Planning Clients seen','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Family Planning Clients seen\n Family Planning Clients seen\n \n 2023-09-21 12:58:35 UTC\n \n 2023-09-21 12:59:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2561\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 14:58:35',4,'2023-09-21 14:59:30',4,0,NULL,NULL,NULL,'4934d5cb-a141-4144-9937-59b8bb142789'),(2562,'Family Planning clients with visits consulted','Family Planning clients with visits consulted','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Family Planning clients with visits consulted\n Family Planning clients with visits consulted\n \n 2023-09-21 12:58:46 UTC\n \n 2023-09-21 12:59:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2562\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id \n JOIN obs o on o.encounter_id=en.encounter_id \n and o.concept_id = 4557 and o.voided =0 \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n and v.visit_type_id = 22 \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 14:58:46',4,'2023-09-21 14:59:18',4,0,NULL,NULL,NULL,'ada60155-c22d-4ad4-b960-45bb814acd47'),(2563,'HEI Clients Seen','HEI Clients Seen','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HEI Clients Seen\n HEI Clients Seen\n \n 2023-09-21 12:59:50 UTC\n \n 2023-09-21 13:00:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2563\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 14:59:50',4,'2023-09-21 15:00:32',4,0,NULL,NULL,NULL,'8f5713d9-1797-48ed-92ba-7a6bbc3f02be'),(2564,'Under 5 clients with visits started','Under 5 clients with visits started','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Under 5 clients with visits started\n Under 5 clients with visits started\n \n 2023-09-21 12:59:58 UTC\n \n 2023-09-21 13:00:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2564\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id \n JOIN obs o on o.encounter_id=en.encounter_id \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n and v.visit_type_id = 20 \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 14:59:58',4,'2023-09-21 15:00:12',4,0,NULL,NULL,NULL,'b569e5c1-aab8-4a67-955c-b09d0c5c1b6b'),(2565,'Under 5 clients with visits consulted','Under 5 clients with visits consulted','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Under 5 clients with visits consulted\n Under 5 clients with visits consulted\n \n 2023-09-21 13:00:57 UTC\n \n 2023-09-21 13:01:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2565\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id \n JOIN obs o on o.encounter_id=en.encounter_id \n and o.concept_id = 4285 and o.voided =0 \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n and v.visit_type_id = 20 \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 15:00:57',4,'2023-09-21 15:01:12',4,0,NULL,NULL,NULL,'ae2b5eee-422b-4307-a985-7bd763147582'),(2566,'HTS Clients Seen','HTS Clients Seen','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HTS Clients Seen\n HTS Clients Seen\n \n 2023-09-21 13:00:59 UTC\n \n 2023-09-21 13:01:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2566\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:00:59',4,'2023-09-21 15:01:59',4,0,NULL,NULL,NULL,'198319c7-6986-4599-8b2a-886ed81d7c37'),(2567,'1st Postnatal (PNC) Attendance','1st Postnatal (PNC) Attendance','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n 1st Postnatal (PNC) Attendance\n 1st Postnatal (PNC) Attendance\n \n 2023-09-21 13:01:44 UTC\n \n 2023-09-21 13:02:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2567\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:01:44',4,'2023-09-21 15:02:26',4,0,NULL,NULL,NULL,'07589d1a-d289-491c-a8dd-ac6e506b6eca'),(2568,'Cervical Cancer Screening clients with visits started','Cervical Cancer Screening clients with visits started','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Cervical Cancer Screening clients with visits started\n Cervical Cancer Screening clients with visits started\n \n 2023-09-21 13:02:00 UTC\n \n 2023-09-21 13:02:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2568\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id \n JOIN obs o on o.encounter_id=en.encounter_id \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n and v.visit_type_id = 21 \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 15:02:00',4,'2023-09-21 15:02:14',4,0,NULL,NULL,NULL,'4f7cc18d-1104-4427-b582-f73b99bd0837'),(2569,'Self test Kits distributed','Self test Kits distributed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Self test Kits distributed\n Self test Kits distributed\n \n 2023-09-21 13:02:50 UTC\n \n 2023-09-21 13:04:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2569\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:02:50',4,'2023-09-21 15:04:03',4,0,NULL,NULL,NULL,'5cc879f5-78be-4f74-9cd0-06ae596deffe'),(2570,'Cervical Cancer Screening clients with visits consulted','Cervical Cancer Screening clients with visits consulted','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Cervical Cancer Screening clients with visits consulted\n Cervical Cancer Screening clients with visits consulted\n \n 2023-09-21 13:02:56 UTC\n \n 2023-09-21 13:03:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2570\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id \n JOIN obs o on o.encounter_id=en.encounter_id \n and o.concept_id = 4511 and o.voided =0 \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n and v.visit_type_id = 21 \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 15:02:56',4,'2023-09-21 15:03:08',4,0,NULL,NULL,NULL,'cf21c6a3-0a19-44c7-b2c7-e14246d7bc96'),(2571,'Under5 Clients Seen','Under5 Clients Seen','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Under5 Clients Seen\n Under5 Clients Seen\n \n 2023-09-21 13:03:36 UTC\n \n 2023-09-21 13:05:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2571\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:03:36',4,'2023-09-21 15:05:20',4,0,NULL,NULL,NULL,'d8654256-acae-40b0-a3c2-feafeb2f36ad'),(2572,'eRegister Monitoring Report','eRegister Monitoring Report','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n eRegister Monitoring Report\n eRegister Monitoring Report\n \n 2023-09-21 13:06:13 UTC\n \n 2023-09-21 13:26:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2572\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-09-21 15:06:13',4,'2023-09-21 15:26:06',4,0,NULL,NULL,NULL,'a9290709-3dd9-4bfe-823d-b1702d10ec0f'),(2573,'eRegister Monitoring Report Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n eRegister Monitoring Report Data Set\n \n 2023-09-21 13:06:21 UTC\n \n 2023-09-22 08:47:46 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2573\n \n \n \n ANC_Consul\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n \n \n ANC_Seen\n \n \n \n \n \n \n \n \n \n ANC_Visits\n \n \n \n \n \n \n \n \n \n ART_Consul\n \n \n \n \n \n \n \n \n \n ART_Visits\n \n \n \n \n \n \n \n \n \n Cerv_Consu\n \n \n \n \n \n \n \n \n \n Cerv_Scree\n \n \n \n \n \n \n \n \n \n Cerv_Visit\n \n \n \n \n \n \n \n \n \n ClntsOnArt\n \n \n \n \n \n \n \n \n \n FP_Consult\n \n \n \n \n \n \n \n \n \n FP_Seen\n \n \n \n \n \n \n \n \n \n FP_Visits\n \n \n \n \n \n \n \n \n \n HEI_Consul\n \n \n \n \n \n \n \n \n \n HEI_Seen\n \n \n \n \n \n \n \n \n \n HEI_Visits\n \n \n \n \n \n \n \n \n \n HTS_Consul\n \n \n \n \n \n \n \n \n \n HTS_Seen\n \n \n \n \n \n \n \n \n \n HTS_Visits\n \n \n \n \n \n \n \n \n \n LTest_Rev\n \n \n \n \n \n \n \n \n \n LTest_Sent\n \n \n \n \n \n \n \n \n \n PNC_Attend\n \n \n \n \n \n \n \n \n \n PNC_Consul\n \n \n \n \n \n \n \n \n \n PNC_Visits\n \n \n \n \n \n \n \n \n \n Self_tes_D\n \n \n \n \n \n \n \n \n \n TB_Consult\n \n \n \n \n \n \n \n \n \n TB_Visits\n \n \n \n \n \n \n \n \n \n Tx_New\n \n \n \n \n \n \n \n \n \n Under5_Con\n \n \n \n \n \n \n \n \n \n Under5_See\n \n \n \n \n \n \n \n \n \n Under5_Vis\n \n \n \n \n \n \n \n \n \n','2023-09-21 13:06:21',4,'2023-09-22 08:47:46',4,0,NULL,NULL,NULL,'a971d8e2-a66a-487c-aae4-36c6f14a3328'),(2574,' ANC clients with visits started',' ANC clients with visits started','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n ANC clients with visits started\n ANC clients with visits started\n \n 2023-09-21 13:07:00 UTC\n \n 2023-09-21 13:07:46 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2574\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:07:00',4,'2023-09-21 15:07:46',4,0,NULL,NULL,NULL,'69485106-52a5-452e-91ef-6ecf80894a7f'),(2575,'ART clients with visits consulted','ART clients with visits consulted','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n ART clients with visits consulted\n ART clients with visits consulted\n \n 2023-09-21 13:08:16 UTC\n \n 2023-09-21 13:08:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2575\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:08:16',4,'2023-09-21 15:08:50',4,0,NULL,NULL,NULL,'7cce44cb-0809-4493-84bb-2fdbe745ceab'),(2576,'ART clients with visits started','ART clients with visits started','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n ART clients with visits started\n ART clients with visits started\n \n 2023-09-21 13:09:47 UTC\n \n 2023-09-21 13:11:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2576\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:09:47',4,'2023-09-21 15:11:10',4,0,NULL,NULL,NULL,'a5551436-00f8-45c4-aa3b-6aaae3160f55'),(2577,'Clients initiated on ART this month','Clients initiated on ART this month','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients initiated on ART this month\n Clients initiated on ART this month\n \n 2023-09-21 13:11:24 UTC\n \n 2023-09-21 13:12:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2577\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:11:24',4,'2023-09-21 15:12:20',4,0,NULL,NULL,NULL,'e6b92d7a-5f7e-4001-957e-30b6be452168'),(2578,'ANC clients with visits consulted','ANC clients with visits consulted','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n ANC clients with visits consulted\n ANC clients with visits consulted\n \n 2023-09-21 13:11:45 UTC\n \n 2023-09-21 13:12:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2578\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:11:45',4,'2023-09-21 15:12:58',4,0,NULL,NULL,NULL,'5c7fcfb9-3d39-4225-a4f3-8ed358e16626'),(2579,'TB clients with visits started','TB clients with visits started','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB clients with visits started\n TB clients with visits started\n \n 2023-09-21 13:13:10 UTC\n \n 2023-09-21 13:13:56 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2579\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:13:10',4,'2023-09-21 15:13:56',4,0,NULL,NULL,NULL,'09767de3-79b3-43e2-82da-339278f5e10d'),(2580,'TB clients with visits consulted','TB clients with visits consulted','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB clients with visits consulted\n TB clients with visits consulted\n \n 2023-09-21 13:14:13 UTC\n \n 2023-09-21 13:16:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2580\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:14:13',4,'2023-09-21 15:16:03',4,0,NULL,NULL,NULL,'d4ae74d3-d618-4e3b-8d10-4c54e5f3b75a'),(2581,'HTS clients with visits started','HTS clients with visits started','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HTS clients with visits started\n HTS clients with visits started\n \n 2023-09-21 13:16:45 UTC\n \n 2023-09-21 13:17:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2581\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:16:45',4,'2023-09-21 15:17:18',4,0,NULL,NULL,NULL,'91f470f1-71bf-4a21-bd12-efe0fe142c0a'),(2582,'HTS clients with visits consulted','HTS clients with visits consulted','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HTS clients with visits consulted\n HTS clients with visits consulted\n \n 2023-09-21 13:17:44 UTC\n \n 2023-09-21 13:18:19 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2582\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:17:44',4,'2023-09-21 15:18:19',4,0,NULL,NULL,NULL,'2bd858aa-2daf-4fd2-9028-9d6fba579a89'),(2583,'PNC clients with visits started','PNC clients with visits started','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PNC clients with visits started\n PNC clients with visits started\n \n 2023-09-21 13:18:49 UTC\n \n 2023-09-21 13:19:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2583\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:18:49',4,'2023-09-21 15:19:20',4,0,NULL,NULL,NULL,'80003d94-268b-4726-ba0d-0fa830e90463'),(2584,'PNC clients with visits consulted','PNC clients with visits consulted','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PNC clients with visits consulted\n PNC clients with visits consulted\n \n 2023-09-21 13:19:39 UTC\n \n 2023-09-21 13:20:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2584\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:19:39',4,'2023-09-21 15:20:18',4,0,NULL,NULL,NULL,'e64fd32d-8284-4fb5-a227-8f338859ceaa'),(2586,'HEI clients with visits started','HEI clients with visits started','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HEI clients with visits started\n HEI clients with visits started\n \n 2023-09-21 13:23:38 UTC\n \n 2023-09-21 13:24:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2586\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:23:38',4,'2023-09-21 15:24:10',4,0,NULL,NULL,NULL,'e7e581aa-9b90-4f56-b8a1-9bfc607f8b4f'),(2587,'HEI clients with visits consulted','HEI clients with visits consulted','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HEI clients with visits consulted\n HEI clients with visits consulted\n \n 2023-09-21 13:24:38 UTC\n \n 2023-09-21 13:25:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2587\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:24:38',4,'2023-09-21 15:25:05',4,0,NULL,NULL,NULL,'dd05778e-c5bd-4430-90fa-fd97b36402d2'),(2588,'Family Planning clients with visits started','Family Planning clients with visits started','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Family Planning clients with visits started\n Family Planning clients with visits started\n \n 2023-09-21 13:25:31 UTC\n \n 2023-09-21 13:26:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2588\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:25:31',4,'2023-09-21 15:26:32',4,0,NULL,NULL,NULL,'3278fb6f-2276-4390-a5c2-9863d056f3a0'),(2589,'Family Planning clients with visits consulted','Family Planning clients with visits consulted','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Family Planning clients with visits consulted\n Family Planning clients with visits consulted\n \n 2023-09-21 13:26:58 UTC\n \n 2023-09-21 13:27:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2589\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:26:58',4,'2023-09-21 15:27:32',4,0,NULL,NULL,NULL,'822f0677-6a2b-47cf-9265-0841d65e9716'),(2590,'Under 5 clients with visits consulted','Under 5 clients with visits consulted','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Under 5 clients with visits consulted\n Under 5 clients with visits consulted\n \n 2023-09-21 13:28:28 UTC\n \n 2023-09-21 13:31:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2590\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:28:28',4,'2023-09-21 15:31:36',4,0,NULL,NULL,NULL,'3a2857b0-1d9c-4f7d-95e9-abcba540935d'),(2591,'Under 5 clients with visits started','Under 5 clients with visits started','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Under 5 clients with visits started\n Under 5 clients with visits started\n \n 2023-09-21 13:30:05 UTC\n \n 2023-09-21 13:30:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2591\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:30:05',4,'2023-09-21 15:30:36',4,0,NULL,NULL,NULL,'f62e6fdd-a64b-4619-925c-d86fc3987060'),(2592,'Clients current on ART','Clients current on ART','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients current on ART\n Clients current on ART\n \n 2023-09-21 13:31:58 UTC\n \n 2023-09-21 13:35:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2592\n (SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n person.gender AS Gender, \n observed_age_group.name AS age_group, \n observed_age_group.sort_order AS sort_order \n \n from obs o \n -- CLIENTS NEWLY INITIATED ON ART \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND (o.concept_id = 2249 \n \n AND MONTH(o.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(o.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n ) \n AND patient.voided = 0 AND o.voided = 0 \n AND o.person_id not in ( \n select distinct os.person_id from obs os \n where os.concept_id = 3634 \n AND os.value_coded = 2095 \n and os.voided = 0 \n AND MONTH(os.obs_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.obs_datetime) = YEAR(CAST(:endDate AS DATE)) \n ) \n \n and o.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages') AS Newly_Initiated_ART_Clients \nORDER BY Newly_Initiated_ART_Clients.patientName) \n \nUNION \n \n(SELECT Id \nFROM ( \n \nselect distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n person.gender AS Gender, \n observed_age_group.name AS age_group, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- CLIENTS SEEN FOR ART \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND (o.concept_id = 3843 AND o.value_coded = 3841 OR o.value_coded = 3842) \n AND MONTH(o.obs_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(o.obs_datetime) = YEAR(CAST(:endDate AS DATE)) \n AND patient.voided = 0 AND o.voided = 0 \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n \n) AS Clients_Seen \n \nWHERE Clients_Seen.Id not in ( \n select distinct patient.patient_id AS Id \n from obs o \n -- CLIENTS INITIATED ON ART \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND (o.concept_id = 2249 \n AND MONTH(o.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(o.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n ) \n AND patient.voided = 0 AND o.voided = 0 \n AND o.person_id not in ( \n select distinct os.person_id from obs os \n where os.concept_id = 3634 \n AND os.value_coded = 2095 \n and os.voided = 0 \n AND MONTH(os.obs_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.obs_datetime) = YEAR(CAST(:endDate AS DATE)) \n ) \n \n ) \nAND Clients_Seen.Id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 and os.voided = 0 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 and os.voided = 0 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \nAND Clients_Seen.Id not in \n ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 and os.voided = 0 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) \n and o.person_id in ( \n -- Death \n select distinct p.person_id \n from person p \n where dead = 1 \n and death_date <= CAST(:endDate AS DATE) \n and voided = 0 \n ) \n ) \nAND Clients_Seen.Id not in ( \n -- Visitors \n select o.person_id \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as examination_timing \n from obs oss \n where oss.concept_id = 5416 and oss.value_coded =1 and oss.voided=0 \n and cast(oss.obs_datetime as date) >= cast(:startDate as date) \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where concept_id = 5416 \n and o.obs_datetime = max_observation \n ) \n \nORDER BY Clients_Seen.patientName) \n \nUNION \n \n \n-- INCLUDE MISSED APPOINTMENTS WITHIN 28 DAYS ACCORDING TO THE NEW PEPFAR GUIDELINE \n(SELECT Id \nFROM \n (select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n person.gender AS Gender, \n observed_age_group.name AS age_group, \n observed_age_group.sort_order AS sort_order \n \n from obs o \n -- CLIENTS WHO MISSED APPOINTMENTS < 28 DAYS \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n -- begin \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up < cast(:endDate as date) \n and DATEDIFF(CAST(:endDate AS DATE),latest_follow_up) <= 28 \n \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where (os.concept_id = 3843 AND os.value_coded = 3841 OR os.value_coded = 3842) \n AND MONTH(os.obs_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.obs_datetime) = YEAR(CAST(:endDate AS DATE)) \n and os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND MONTH(os.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n and os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n \n -- TOUTS \n select tout_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.obs_datetime AS latest_consultation \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(max(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 2403 \n and obs_datetime <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 2398 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as tout_clients \n where tout_clients.latest_consultation < cast(:endDate as date) \n \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n \n ) \n \n and active_clients.person_id not in( \n -- Visitors \n select o.person_id \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as examination_timing \n from obs oss \n where oss.concept_id = 5416 and oss.value_coded =1 and oss.voided=0 \n and cast(oss.obs_datetime as date) >= cast(:startDate as date) \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where concept_id = 5416 \n and o.obs_datetime = max_observation \n ) \n ) \n -- end \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages') AS TwentyEightDayDefaulters \n order by TwentyEightDayDefaulters.patientName) \n \n \nUNION \n \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n person.gender AS Gender, \n observed_age_group.name AS age_group, \n observed_age_group.sort_order AS sort_order \n \n from obs o \n \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n -- begin \n select active_clients.person_id-- , active_clients.latest_follow_up \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where (os.concept_id = 3843 AND os.value_coded = 3841 OR os.value_coded = 3842) \n AND MONTH(os.obs_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.obs_datetime) = YEAR(CAST(:endDate AS DATE)) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND MONTH(os.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 and os.voided = 0 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 and os.voided = 0 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select o.person_id \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as examination_timing \n from obs oss \n where oss.concept_id = 5416 and oss.value_coded =1 and oss.voided=0 \n and cast(oss.obs_datetime as date) >= cast(:startDate as date) \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where concept_id = 5416 \n and o.obs_datetime = max_observation \n ) \n ) \n -- end \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages') AS Seen_Previous_ART_Clients \nORDER BY Seen_Previous_ART_Clients.patientName) \n\n','2023-09-21 15:31:58',4,'2023-09-21 15:35:41',4,0,NULL,NULL,NULL,'ad403c3b-d759-44ab-8965-252ca6127ce7'),(2593,'Cervical Cancer Screening clients with visits started','Cervical Cancer Screening clients with visits started','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Cervical Cancer Screening clients with visits started\n Cervical Cancer Screening clients with visits started\n \n 2023-09-21 13:32:10 UTC\n \n 2023-09-21 13:32:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2593\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:32:10',4,'2023-09-21 15:32:43',4,0,NULL,NULL,NULL,'c7967fcd-a8b7-41d4-b540-364a60a59621'),(2594,'Cervical Cancer Screening clients with visits consulted','Cervical Cancer Screening clients with visits consulted','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Cervical Cancer Screening clients with visits consulted\n Cervical Cancer Screening clients with visits consulted\n \n 2023-09-21 13:33:06 UTC\n \n 2023-09-21 13:34:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2594\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:33:06',4,'2023-09-21 15:34:03',4,0,NULL,NULL,NULL,'b526566e-555d-40c6-88d4-0b89242b1dde'),(2595,'Clients current on ART','Clients current on ART','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients current on ART\n Clients current on ART\n \n 2023-09-21 13:36:28 UTC\n \n 2023-09-21 13:37:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2595\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:36:28',4,'2023-09-21 15:37:08',4,0,NULL,NULL,NULL,'1db1c64d-177f-4ecc-b1d7-c9fd2b029eff'),(2596,'Clients with LAB tests sent','Clients with LAB tests sent','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients with LAB tests sent\n Clients with LAB tests sent\n \n 2023-09-22 08:35:11 UTC\n \n 2023-09-22 08:35:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2596\n select distinct patient.patient_id AS Id \n from orders o \n INNER JOIN patient ON o.patient_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n AND o.concept_id = 5484 \n AND CAST(o.date_created AS DATE)>= CAST(:startDate AS DATE) \n AND CAST(o.date_created AS DATE) <= CAST(:endDate AS DATE) \n LEFT OUTER JOIN patient_identifier p ON p.patient_id = person.person_id AND p.identifier_type = 5\n','2023-09-22 08:35:11',4,'2023-09-22 08:35:51',4,0,NULL,NULL,NULL,'f06f1ccb-c048-44d3-8037-35f8660a6b95'),(2597,'Clients with LAB tests sent','Clients with LAB tests sent','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients with LAB tests sent\n Clients with LAB tests sent\n \n 2023-09-22 08:36:30 UTC\n \n 2023-09-22 08:38:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2597\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-22 08:36:30',4,'2023-09-22 08:38:26',4,0,NULL,NULL,NULL,'c29cff5d-5919-4b60-8ab7-c6d4c7ea01da'),(2598,'Clients with LAB tests received','Clients with LAB tests received','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients with LAB tests received\n Clients with LAB tests received\n \n 2023-09-22 08:39:02 UTC\n \n 2024-02-06 09:57:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2598\n Select pId \n From \n ( \n select oss.person_id as pId, concat(oss.value_numeric, " ", "copies/ml") as Results \n from obs oss \n where oss.concept_id = 5485 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) >= cast(:startDate as date) \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n \n UNION \n \n select oss.person_id as pId, "LDL" as Results \n from obs oss \n where oss.concept_id = 5489 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) >= cast(:startDate as date) \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n \n ) As received_results\n','2023-09-22 14:09:02',4,'2024-02-06 15:27:28',4,0,NULL,NULL,NULL,'6939902b-1909-4f24-b71d-da60ab1d131b'),(2599,'Clients with LAB tests received','Clients with LAB tests received','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients with LAB tests received\n Clients with LAB tests received\n \n 2023-09-22 08:39:53 UTC\n \n 2023-09-22 08:42:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2599\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-22 08:39:53',4,'2023-09-22 08:42:39',4,0,NULL,NULL,NULL,'e47a29f8-b851-480f-9812-e54da393fdb9'); +INSERT INTO `serialized_object` VALUES (2480,'Clients given 6A with >=20Copies Viral Load','Clients given 6A with >=20Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6A with >=20Copies Viral Load\n Clients given 6A with >=20Copies Viral Load\n \n 2023-08-17 14:35:48 UTC\n \n 2023-08-17 14:36:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2480\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:35:48',4,'2023-08-17 16:36:40',4,0,NULL,NULL,NULL,'aaaf1254-b937-4fdd-abdf-7f99bc97c9e4'),(2481,'Clients given 5e with poor adherence','Clients given 5e with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5e with poor adherence\n Clients given 5e with poor adherence\n \n 2023-08-17 14:36:47 UTC\n \n 2023-08-17 14:37:52 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2481\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:36:47',4,'2023-08-17 16:37:52',4,0,NULL,NULL,NULL,'b6365db8-5402-488e-bf43-1b4b3869592c'),(2482,'Clients given 6A with <20 Copies Viral Load','Clients given 6A with <20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6A with <20 Copies Viral Load\n Clients given 6A with <20 Copies Viral Load\n \n 2023-08-17 14:37:57 UTC\n \n 2023-08-17 14:40:25 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2482\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:37:57',4,'2023-08-17 16:40:25',4,0,NULL,NULL,NULL,'6dc49bb6-9be8-4b6b-9db7-7cd1e9e9832b'),(2483,'Clients given 5e with fair adherence','Clients given 5e with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5e with fair adherence\n Clients given 5e with fair adherence\n \n 2023-08-17 14:38:45 UTC\n \n 2023-08-17 14:40:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2483\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:38:45',4,'2023-08-17 16:40:42',4,0,NULL,NULL,NULL,'c9761b31-3a7f-4cdb-bce2-e422d0f0a1d9'),(2484,'Clients given 6A with Undetectable Viral Load','Clients given 6A with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6A with Undetectable Viral Load\n Clients given 6A with Undetectable Viral Load\n \n 2023-08-17 14:41:52 UTC\n \n 2023-08-17 14:43:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2484\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:41:52',4,'2023-08-17 16:43:11',4,0,NULL,NULL,NULL,'88ff8b16-c2f3-4f73-accf-0b799dbd4357'),(2485,'Clients given 6B with >=20Copies Viral Load','Clients given 6B with >=20Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6B with >=20Copies Viral Load\n Clients given 6B with >=20Copies Viral Load\n \n 2023-08-17 14:43:49 UTC\n \n 2023-08-17 15:26:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2485\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:43:49',4,'2023-08-17 17:26:07',4,0,NULL,NULL,NULL,'3e4ca350-0d23-4326-b54b-1da860205aa2'),(2486,'Clients given 5e with good adherence','Clients given 5e with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5e with good adherence\n Clients given 5e with good adherence\n \n 2023-08-17 14:44:26 UTC\n \n 2023-08-17 14:46:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2486\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:44:26',4,'2023-08-17 16:46:50',4,0,NULL,NULL,NULL,'bf269091-cd68-4987-adc0-88a0d53b0799'),(2487,'Clients given 5f with poor adherence','Clients given 5f with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5f with poor adherence\n Clients given 5f with poor adherence\n \n 2023-08-17 14:45:30 UTC\n \n 2023-08-17 14:47:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2487\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:45:30',4,'2023-08-17 16:47:18',4,0,NULL,NULL,NULL,'8628ac34-e4de-44ad-bf49-0cd48799c0e0'),(2488,'Clients given 5f with fair adherence','Clients given 5f with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5f with fair adherence\n Clients given 5f with fair adherence\n \n 2023-08-17 14:47:44 UTC\n \n 2023-08-17 14:48:56 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2488\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:47:44',4,'2023-08-17 16:48:56',4,0,NULL,NULL,NULL,'05773449-f7c2-428e-b2d7-13d526846f6d'),(2489,'Clients given 5f with good adherence','Clients given 5f with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5f with good adherence\n Clients given 5f with good adherence\n \n 2023-08-17 14:48:23 UTC\n \n 2023-08-17 14:51:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2489\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:48:23',4,'2023-08-17 16:51:06',4,0,NULL,NULL,NULL,'0a2c5054-fcf0-46e8-94bd-150cc697fad7'),(2490,'Clients given 5g with poor adherence','Clients given 5g with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5g with poor adherence\n Clients given 5g with poor adherence\n \n 2023-08-17 14:51:41 UTC\n \n 2023-08-17 14:52:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2490\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:51:41',4,'2023-08-17 16:52:53',4,0,NULL,NULL,NULL,'92f0cb76-2f6b-4be0-b525-90c4d4665b90'),(2491,'Clients given 5g with fair adherence','Clients given 5g with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5g with fair adherence\n Clients given 5g with fair adherence\n \n 2023-08-17 14:54:10 UTC\n \n 2023-08-17 14:55:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2491\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:54:10',4,'2023-08-17 16:55:17',4,0,NULL,NULL,NULL,'d159ee3c-798c-4b94-ae55-f17634b6bd38'),(2492,'Clients given 5g with good adherence','Clients given 5g with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5g with good adherence\n Clients given 5g with good adherence\n \n 2023-08-17 14:55:50 UTC\n \n 2023-08-17 14:56:54 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2492\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:55:50',4,'2023-08-17 16:56:54',4,0,NULL,NULL,NULL,'2c0bc567-51cc-4892-a4ce-5266c8e9cf58'),(2493,'Clients given 5h with poor adherence','Clients given 5h with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5h with poor adherence\n Clients given 5h with poor adherence\n \n 2023-08-17 14:56:39 UTC\n \n 2023-08-17 14:58:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2493\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:56:39',4,'2023-08-17 16:58:17',4,0,NULL,NULL,NULL,'18332615-0cd2-4f3c-a2dd-537056310823'),(2494,'Clients given 5h with fair adherence','Clients given 5h with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5h with fair adherence\n Clients given 5h with fair adherence\n \n 2023-08-17 14:57:51 UTC\n \n 2023-08-17 14:59:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2494\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:57:51',4,'2023-08-17 16:59:12',4,0,NULL,NULL,NULL,'9bee8b12-d34c-4ec0-a136-cdc38d312f76'),(2495,'Clients given 5h with good adherence','Clients given 5h with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5h with good adherence\n Clients given 5h with good adherence\n \n 2023-08-17 14:59:01 UTC\n \n 2023-08-17 15:00:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2495\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:59:01',4,'2023-08-17 17:00:11',4,0,NULL,NULL,NULL,'8d2837ca-19e0-461e-8bde-fdee3e9f117c'),(2496,'Clients given 6a with poor adherence','Clients given 6a with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6a with poor adherence\n Clients given 6a with poor adherence\n \n 2023-08-17 15:00:41 UTC\n \n 2023-08-17 15:01:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2496\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:00:41',4,'2023-08-17 17:01:40',4,0,NULL,NULL,NULL,'25323965-1cc3-4c63-b997-5c6ff173ad1b'),(2497,'Clients given 6a with fair adherence','Clients given 6a with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6a with fair adherence\n Clients given 6a with fair adherence\n \n 2023-08-17 15:01:29 UTC\n \n 2023-08-17 15:03:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2497\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:01:29',4,'2023-08-17 17:03:14',4,0,NULL,NULL,NULL,'38990f18-eb9c-43ff-8323-96c3a6eb90c2'),(2498,'Clients given 6a with good adherence','Clients given 6a with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6a with good adherence\n Clients given 6a with good adherence\n \n 2023-08-17 15:02:51 UTC\n \n 2023-08-17 15:04:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2498\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:02:51',4,'2023-08-17 17:04:00',4,0,NULL,NULL,NULL,'2e00abe1-aed1-485e-858f-2a0baf0eaf3c'),(2499,'Clients given 6b with poor adherence','Clients given 6b with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6b with poor adherence\n Clients given 6b with poor adherence\n \n 2023-08-17 15:04:48 UTC\n \n 2023-08-17 15:06:13 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2499\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:04:48',4,'2023-08-17 17:06:13',4,0,NULL,NULL,NULL,'2452d808-0319-435c-8a68-0f849c38d53e'),(2500,'Clients given 6b with fair adherence','Clients given 6b with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6b with fair adherence\n Clients given 6b with fair adherence\n \n 2023-08-17 15:06:01 UTC\n \n 2023-08-17 15:08:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2500\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:06:01',4,'2023-08-17 17:08:42',4,0,NULL,NULL,NULL,'6a9e9b7e-3e06-4f47-9abb-ad685a5d86ca'),(2501,'Clients given 6b with good adherence','Clients given 6b with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6b with good adherence\n Clients given 6b with good adherence\n \n 2023-08-17 15:06:55 UTC\n \n 2023-08-17 15:09:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2501\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:06:55',4,'2023-08-17 17:09:06',4,0,NULL,NULL,NULL,'8340a9bc-f2fc-4a2d-ab84-74569dfe8a86'),(2502,'Clients given 6c with poor adherence','Clients given 6c with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6c with poor adherence\n Clients given 6c with poor adherence\n \n 2023-08-17 15:09:40 UTC\n \n 2023-08-17 15:11:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2502\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:09:40',4,'2023-08-17 17:11:01',4,0,NULL,NULL,NULL,'052f51db-d6e4-4078-9f3f-bed7d17b48bd'),(2503,'Clients given 6c with fair adherence','Clients given 6c with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6c with fair adherence\n Clients given 6c with fair adherence\n \n 2023-08-17 15:10:40 UTC\n \n 2023-08-17 15:12:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2503\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:10:40',4,'2023-08-17 17:12:06',4,0,NULL,NULL,NULL,'f8e62785-7303-493a-9c20-6c9f4280faf0'),(2504,'Clients given 6c with good adherence','Clients given 6c with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6c with good adherence\n Clients given 6c with good adherence\n \n 2023-08-17 15:11:54 UTC\n \n 2023-08-17 15:13:48 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2504\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:11:54',4,'2023-08-17 17:13:48',4,0,NULL,NULL,NULL,'9b361e36-e897-4212-8c7f-26121e595425'),(2505,'Clients given 6d with poor adherence','Clients given 6d with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6d with poor adherence\n Clients given 6d with poor adherence\n \n 2023-08-17 15:13:21 UTC\n \n 2023-08-17 15:15:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2505\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:13:21',4,'2023-08-17 17:15:04',4,0,NULL,NULL,NULL,'56b2509b-811c-4452-8432-5807792f207a'),(2506,'Clients given 6d with fair adherence','Clients given 6d with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6d with fair adherence\n Clients given 6d with fair adherence\n \n 2023-08-17 15:14:20 UTC\n \n 2023-08-17 15:16:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2506\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:14:20',4,'2023-08-17 17:16:21',4,0,NULL,NULL,NULL,'2808446d-305f-4bf7-b83b-3a5aad7cc119'),(2507,'Clients given 6d with good adherence','Clients given 6d with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6d with good adherence\n Clients given 6d with good adherence\n \n 2023-08-17 15:17:32 UTC\n \n 2023-08-17 15:17:52 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2507\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6d \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4703)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-17 17:17:32',4,'2023-08-17 17:17:52',4,0,NULL,NULL,NULL,'a10f7cfb-6012-4c2a-8f4f-f9ef7cdd8310'),(2508,'Clients given 6d with good adherence','Clients given 6d with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6d with good adherence\n Clients given 6d with good adherence\n \n 2023-08-17 15:18:32 UTC\n \n 2023-08-17 15:19:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2508\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:18:32',4,'2023-08-17 17:19:41',4,0,NULL,NULL,NULL,'e271c92e-f3e8-4218-a758-f2d91fd4173e'),(2509,'Clients given 6e with poor adherence','Clients given 6e with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6e with poor adherence\n Clients given 6e with poor adherence\n \n 2023-08-17 15:19:01 UTC\n \n 2023-08-17 15:20:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2509\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:19:01',4,'2023-08-17 17:20:53',4,0,NULL,NULL,NULL,'8c2c0191-d6e6-4f9c-a84d-976f24a47e5a'),(2510,'Clients given 6e with fair adherence','Clients given 6e with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6e with fair adherence\n Clients given 6e with fair adherence\n \n 2023-08-17 15:20:17 UTC\n \n 2023-08-17 15:22:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2510\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:20:17',4,'2023-08-17 17:22:00',4,0,NULL,NULL,NULL,'16552ea9-b4bb-4ae3-ae13-c04d366a5a72'),(2511,'Clients given 6e with good adherence','Clients given 6e with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6e with good adherence\n Clients given 6e with good adherence\n \n 2023-08-17 15:21:28 UTC\n \n 2023-08-17 15:23:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2511\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:21:28',4,'2023-08-17 17:23:08',4,0,NULL,NULL,NULL,'ca215c1b-6a15-42a3-b752-9ce21c651e13'),(2512,'Clients given 6f with poor adherence','Clients given 6f with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6f with poor adherence\n Clients given 6f with poor adherence\n \n 2023-08-17 15:22:56 UTC\n \n 2023-08-17 15:24:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2512\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:22:56',4,'2023-08-17 17:24:10',4,0,NULL,NULL,NULL,'ba0a85d0-9c18-49b9-8c42-417c8d96221c'),(2513,'Clients given 6f with fair adherence','Clients given 6f with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6f with fair adherence\n Clients given 6f with fair adherence\n \n 2023-08-17 15:23:41 UTC\n \n 2023-08-17 15:25:35 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2513\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:23:41',4,'2023-08-17 17:25:35',4,0,NULL,NULL,NULL,'7abe4ec4-ba33-4f66-97c3-33ffd356c478'),(2514,'Clients given 6f with good adherence','Clients given 6f with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6f with good adherence\n Clients given 6f with good adherence\n \n 2023-08-17 15:25:08 UTC\n \n 2023-08-17 15:27:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2514\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:25:08',4,'2023-08-17 17:27:07',4,0,NULL,NULL,NULL,'605e06e0-b274-46a5-8404-e45f6bdbf36d'),(2515,'Clients given 6B with <20 Copies Viral Load','Clients given 6B with <20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6B with <20 Copies Viral Load\n Clients given 6B with <20 Copies Viral Load\n \n 2023-08-17 16:05:27 UTC\n \n 2023-08-17 16:06:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2515\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 18:05:27',4,'2023-08-17 18:06:26',4,0,NULL,NULL,NULL,'57a592d4-f5a1-4ac8-afd9-dbabd8335120'),(2516,'Clients given 6B with Undetectable Viral Load','Clients given 6B with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6B with Undetectable Viral Load\n Clients given 6B with Undetectable Viral Load\n \n 2023-08-17 16:07:16 UTC\n \n 2023-08-17 17:13:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2516\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 18:07:16',4,'2023-08-17 19:13:12',4,0,NULL,NULL,NULL,'9a6c692c-675e-490a-827d-788308c41aa2'),(2517,'Clients given 6C with >=20 Copies Viral Load','Clients given 6C with >=20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C with >=20 Copies Viral Load\n Clients given 6C with >=20 Copies Viral Load\n \n 2023-08-17 16:09:20 UTC\n \n 2023-08-17 16:10:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2517\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 18:09:20',4,'2023-08-17 18:10:11',4,0,NULL,NULL,NULL,'2b0f18d1-d6bc-48db-81e9-139e7127a014'),(2518,'Clients given 6C with <20 Copies Viral Load','Clients given 6C with <20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C with <20 Copies Viral Load\n Clients given 6C with <20 Copies Viral Load\n \n 2023-08-17 16:11:36 UTC\n \n 2023-08-17 16:12:54 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2518\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 18:11:36',4,'2023-08-17 18:12:54',4,0,NULL,NULL,NULL,'b95e0670-059d-4690-986c-e7b162edc56a'),(2519,'Clients given 6C with Undetectable Viral Load','Clients given 6C with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C with Undetectable Viral Load\n Clients given 6C with Undetectable Viral Load\n \n 2023-08-17 16:13:36 UTC\n \n 2023-08-17 16:14:33 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2519\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 18:13:36',4,'2023-08-17 18:14:33',4,0,NULL,NULL,NULL,'ef772750-6723-46e8-b1cd-2c843e8dd384'),(2520,'Clients given 6D with >=20Copies Viral Load','Clients given 6D with >=20Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D with >=20Copies Viral Load\n Clients given 6D with >=20Copies Viral Load\n \n 2023-08-17 16:15:12 UTC\n \n 2023-08-17 16:16:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2520\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 18:15:12',4,'2023-08-17 18:16:15',4,0,NULL,NULL,NULL,'7067eaf1-d98c-4806-a595-c20526eb9695'),(2521,'Clients given 6D with <20 Copies Viral Load','Clients given 6D with <20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D with <20 Copies Viral Load\n Clients given 6D with <20 Copies Viral Load\n \n 2023-08-17 16:17:05 UTC\n \n 2023-08-17 16:18:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2521\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 18:17:05',4,'2023-08-17 18:18:05',4,0,NULL,NULL,NULL,'cc8e5238-6071-4a37-b946-f6e9bf94dd26'),(2522,'Clients given 6D with Undetectable Viral Load','Clients given 6D with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D with Undetectable Viral Load\n Clients given 6D with Undetectable Viral Load\n \n 2023-08-17 16:18:46 UTC\n \n 2023-08-17 16:19:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2522\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 18:18:46',4,'2023-08-17 18:19:45',4,0,NULL,NULL,NULL,'1df8beb0-cc67-496d-ba90-fa0dbc121691'),(2523,'Clients given 6E with >=20Copies Viral Load','Clients given 6E with >=20Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E with >=20Copies Viral Load\n Clients given 6E with >=20Copies Viral Load\n \n 2023-08-17 16:20:29 UTC\n \n 2023-08-17 16:21:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2523\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 18:20:29',4,'2023-08-17 18:21:30',4,0,NULL,NULL,NULL,'6462e250-cf41-469a-83d7-e8b085ae587d'),(2524,'Clients given 6E with <20 Copies Viral Load','Clients given 6E with <20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E with <20 Copies Viral Load\n Clients given 6E with <20 Copies Viral Load\n \n 2023-08-17 16:22:10 UTC\n \n 2023-08-17 16:24:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2524\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 18:22:10',4,'2023-08-17 18:24:14',4,0,NULL,NULL,NULL,'3492f4eb-af9b-448f-b4f1-fe314ce449f1'),(2525,'Children ARV Regimen_3rdLine_Adherence','Children ARV Regimen_3rdLine_Adherence','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_Adherence\n Children ARV Regimen_3rdLine_Adherence\n \n 2023-08-17 16:26:16 UTC\n \n 2023-08-17 16:26:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2525\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-17 18:26:16',4,'2023-08-17 18:26:28',4,0,NULL,NULL,NULL,'3262e4c0-f728-4cc8-ac30-b7413a14a644'),(2526,'Children ARV Regimen_3rdLine_Adherence Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_Adherence Data Set\n \n 2023-08-17 16:26:28 UTC\n \n 2023-08-17 16:38:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2526\n \n \n \n 6A_fair\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n \n \n 6A_good\n \n \n \n \n \n \n \n \n \n 6A_poor\n \n \n \n \n \n \n \n \n \n 6B_fair\n \n \n \n \n \n \n \n \n \n 6B_good\n \n \n \n \n \n \n \n \n \n 6B_poor\n \n \n \n \n \n \n \n \n \n 6C_fair\n \n \n \n \n \n \n \n \n \n 6C_good\n \n \n \n \n \n \n \n \n \n 6C_poor\n \n \n \n \n \n \n \n \n \n 6D_fair\n \n \n \n \n \n \n \n \n \n 6D_good\n \n \n \n \n \n \n \n \n \n 6D_poor\n \n \n \n \n \n \n \n \n \n 6E_fair\n \n \n \n \n \n \n \n \n \n 6E_good\n \n \n \n \n \n \n \n \n \n 6E_poor\n \n \n \n \n \n \n \n \n \n 6F_fair\n \n \n \n \n \n \n \n \n \n 6F_good\n \n \n \n \n \n \n \n \n \n 6F_poor\n \n \n \n \n \n \n \n \n \n','2023-08-17 18:26:28',4,'2023-08-17 18:38:11',4,0,NULL,NULL,NULL,'9011d1b7-91da-465d-a4c7-38ea98126d13'),(2527,'Children ARV Regimen_2ndLine_Adherence','Children ARV Regimen_2ndLine_Adherence','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_Adherence\n Children ARV Regimen_2ndLine_Adherence\n \n 2023-08-17 16:40:24 UTC\n \n 2023-08-17 16:40:35 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2527\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-17 18:40:24',4,'2023-08-17 18:40:35',4,0,NULL,NULL,NULL,'ab24cc2a-a3ac-43a7-91c6-65bc90b27ae4'),(2528,'Children ARV Regimen_2ndLine_Adherence Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_Adherence Data Set\n \n 2023-08-17 16:40:35 UTC\n \n 2023-08-17 16:59:47 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2528\n \n \n \n 5A_fair\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n \n \n 5A_good\n \n \n \n \n \n \n \n \n \n 5A_poor\n \n \n \n \n \n \n \n \n \n 5B_fair\n \n \n \n \n \n \n \n \n \n 5B_good\n \n \n \n \n \n \n \n \n \n 5B_poor\n \n \n \n \n \n \n \n \n \n 5C_fair\n \n \n \n \n \n \n \n \n \n 5C_good\n \n \n \n \n \n \n \n \n \n 5C_poor\n \n \n \n \n \n \n \n \n \n 5D_fair\n \n \n \n \n \n \n \n \n \n 5D_good\n \n \n \n \n \n \n \n \n \n 5D_poor\n \n \n \n \n \n \n \n \n \n 5E_fair\n \n \n \n \n \n \n \n \n \n 5E_good\n \n \n \n \n \n \n \n \n \n 5E_poor\n \n \n \n \n \n \n \n \n \n 5F_fair\n \n \n \n \n \n \n \n \n \n 5F_good\n \n \n \n \n \n \n \n \n \n 5F_poor\n \n \n \n \n \n \n \n \n \n 5G_fair\n \n \n \n \n \n \n \n \n \n 5G_good\n \n \n \n \n \n \n \n \n \n 5G_poor\n \n \n \n \n \n \n \n \n \n 5H_fair\n \n \n \n \n \n \n \n \n \n 5H_good\n \n \n \n \n \n \n \n \n \n 5H_poor\n \n \n \n \n \n \n \n \n \n','2023-08-17 18:40:35',4,'2023-08-17 18:59:47',4,0,NULL,NULL,NULL,'63956153-c9e8-480d-b057-96de951cf024'),(2529,'Clients given 6E with Undetectable Viral Load','Clients given 6E with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E with Undetectable Viral Load\n Clients given 6E with Undetectable Viral Load\n \n 2023-08-17 16:48:58 UTC\n \n 2023-08-17 16:50:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2529\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 18:48:58',4,'2023-08-17 18:50:03',4,0,NULL,NULL,NULL,'836381fd-7adf-42ba-8ab4-01e9259a41f5'),(2530,'Clients given 6F with >=20Copies Viral Load','Clients given 6F with >=20Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F with >=20Copies Viral Load\n Clients given 6F with >=20Copies Viral Load\n \n 2023-08-17 16:51:45 UTC\n \n 2023-08-17 16:53:52 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2530\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 18:51:45',4,'2023-08-17 18:53:52',4,0,NULL,NULL,NULL,'b8f0e53a-22a7-40e9-a9e6-e7ce266d4a19'),(2531,'Clients given 6F with <20 Copies Viral Load','Clients given 6F with <20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F with <20 Copies Viral Load\n Clients given 6F with <20 Copies Viral Load\n \n 2023-08-17 16:55:01 UTC\n \n 2023-08-17 16:58:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2531\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 18:55:01',4,'2023-08-17 18:58:01',4,0,NULL,NULL,NULL,'b820ee3d-d805-468d-b7b4-2d1c5ce10a92'),(2532,'Children ARV Regimen_3rdLine_Viral_Load','Children ARV Regimen_3rdLine_Viral_Load','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_Viral_Load\n Children ARV Regimen_3rdLine_Viral_Load\n \n 2023-08-17 16:58:13 UTC\n \n 2023-08-17 16:58:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2532\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-17 18:58:13',4,'2023-08-17 18:58:43',4,0,NULL,NULL,NULL,'72eeaaa5-8c87-4939-a657-99b15cc3ab35'),(2533,'Children ARV Regimen_3rdLine_Viral_Load Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_Viral_Load Data Set\n \n 2023-08-17 16:58:43 UTC\n \n 2023-08-17 17:29:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2533\n \n \n \n 6A<20\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n \n \n 6A>=20\n \n \n \n \n \n \n \n \n \n 6AUndetect\n \n \n \n \n \n \n \n \n \n 6B<20\n \n \n \n \n \n \n \n \n \n 6B>=20\n \n \n \n \n \n \n \n \n \n 6BUndetect\n \n \n \n \n \n \n \n \n \n 6C<20\n \n \n \n \n \n \n \n \n \n 6C>=20\n \n \n \n \n \n \n \n \n \n 6CUndetect\n \n \n \n \n \n \n \n \n \n 6D<20\n \n \n \n \n \n \n \n \n \n 6D>=20\n \n \n \n \n \n \n \n \n \n 6DUndetect\n \n \n \n \n \n \n \n \n \n 6E<20\n \n \n \n \n \n \n \n \n \n 6E>=20\n \n \n \n \n \n \n \n \n \n 6EUndetect\n \n \n \n \n \n \n \n \n \n 6F<20\n \n \n \n \n \n \n \n \n \n 6F>=20\n \n \n \n \n \n \n \n \n \n 6FUndetect\n \n \n \n \n \n \n \n \n \n','2023-08-17 18:58:43',4,'2023-08-17 19:29:02',4,0,NULL,NULL,NULL,'0a51f76b-0306-47fa-947d-55305024054a'),(2534,'Clients given 6F with Undetectable Viral Load','Clients given 6F with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F with Undetectable Viral Load\n Clients given 6F with Undetectable Viral Load\n \n 2023-08-17 16:59:07 UTC\n \n 2023-08-17 17:02:35 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2534\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 18:59:07',4,'2023-08-17 19:02:35',4,0,NULL,NULL,NULL,'b1f06b90-64db-4554-8e81-989e206ed34a'),(2535,'Children ARV Regimen_2ndLine_Viral_Load','Children ARV Regimen_2ndLine_Viral_Load','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_Viral_Load\n Children ARV Regimen_2ndLine_Viral_Load\n \n 2023-08-17 17:06:27 UTC\n \n 2023-08-17 17:06:48 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2535\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-17 19:06:27',4,'2023-08-17 19:06:48',4,0,NULL,NULL,NULL,'701df245-5766-4e37-9d54-89e6ecedb217'),(2536,'Children ARV Regimen_2ndLine_Viral_Load Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_Viral_Load Data Set\n \n 2023-08-17 17:06:48 UTC\n \n 2023-08-17 17:26:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2536\n \n \n \n 5A_Undetec\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n \n \n 5A<20\n \n \n \n \n \n \n \n \n \n 5A>=20\n \n \n \n \n \n \n \n \n \n 5B_Undetec\n \n \n \n \n \n \n \n \n \n 5B<20\n \n \n \n \n \n \n \n \n \n 5B>=20\n \n \n \n \n \n \n \n \n \n 5C_Undetec\n \n \n \n \n \n \n \n \n \n 5C<20\n \n \n \n \n \n \n \n \n \n 5C>=20\n \n \n \n \n \n \n \n \n \n 5E_Undetec\n \n \n \n \n \n \n \n \n \n 5E<20\n \n \n \n \n \n \n \n \n \n 5E>=20\n \n \n \n \n \n \n \n \n \n 5F_Undetec\n \n \n \n \n \n \n \n \n \n 5F<20\n \n \n \n \n \n \n \n \n \n 5F>=20\n \n \n \n \n \n \n \n \n \n 5G_Undetec\n \n \n \n \n \n \n \n \n \n 5G<20\n \n \n \n \n \n \n \n \n \n 5G>=20\n \n \n \n \n \n \n \n \n \n 5H_Undetec\n \n \n \n \n \n \n \n \n \n 5H<20\n \n \n \n \n \n \n \n \n \n 5H>=20\n \n \n \n \n \n \n \n \n \n','2023-08-17 19:06:48',4,'2023-08-17 19:26:20',4,0,NULL,NULL,NULL,'2790255e-587f-411d-9f8a-dbca36aa7e0d'),(2537,'ART clients with visits started','ART clients with visits started','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n ART clients with visits started\n ART clients with visits started\n \n 2023-09-21 12:40:58 UTC\n \n 2024-02-06 12:32:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2537\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1, 2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id and vt.visit_type_id in (10,19) \n JOIN obs o on o.encounter_id=en.encounter_id \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 18:10:58',4,'2024-02-06 18:02:59',4,0,NULL,NULL,NULL,'5de36ef7-faa8-422d-943d-fdd6ad3497a0'),(2538,'ART clients with visits consulted','ART clients with visits consulted','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n ART clients with visits consulted\n ART clients with visits consulted\n \n 2023-09-21 12:41:53 UTC\n \n 2024-02-06 12:38:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2538\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id and vt.visit_type_id in (10,19) \n JOIN obs o on o.encounter_id=en.encounter_id \n and o.concept_id in (3843, 4276) and o.voided =0 \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 18:11:53',4,'2024-02-06 18:08:12',4,0,NULL,NULL,NULL,'9340a449-ab16-4a98-8dcb-240635a9042d'),(2539,'Clients initiated on ART this month','Clients initiated on ART this month','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients initiated on ART this month\n Clients initiated on ART this month\n \n 2023-09-21 12:42:21 UTC\n \n 2024-02-06 10:21:22 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2539\n select distinct patient.patient_id AS Id \n \n from obs o \n -- CLIENTS NEWLY INITIATED ON ART \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND (o.concept_id = 2249 \n \n AND CAST(o.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n AND patient.voided = 0 AND o.voided = 0 \n AND o.person_id not in ( \n select distinct os.person_id from obs os \n where os.concept_id = 3634 \n AND os.value_coded = 2095 \n and os.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and o.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages'\n','2023-09-21 18:12:21',4,'2024-02-06 15:51:22',4,0,NULL,NULL,NULL,'d3e386aa-99a9-4463-9e81-f663ca35cad2'),(2540,'TB clients with visits started','TB clients with visits started','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB clients with visits started\n TB clients with visits started\n \n 2023-09-21 12:42:50 UTC\n \n 2023-09-21 12:43:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2540\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id \n JOIN obs o on o.encounter_id=en.encounter_id \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n and v.visit_type_id = 13 \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 14:42:50',4,'2023-09-21 14:43:05',4,0,NULL,NULL,NULL,'e6d2d518-2160-4fc8-84dc-a680c609b27f'),(2541,'TB clients with visits consulted','TB clients with visits consulted','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB clients with visits consulted\n TB clients with visits consulted\n \n 2023-09-21 12:44:18 UTC\n \n 2023-09-21 12:45:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2541\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id \n JOIN obs o on o.encounter_id=en.encounter_id \n and o.concept_id in (4153,1158) and o.voided =0 \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n and v.visit_type_id = 13 \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 14:44:18',4,'2023-09-21 14:45:05',4,0,NULL,NULL,NULL,'d205535e-f890-488a-a256-a69835a9a9d8'),(2542,'HTS Clients Seen','HTS Clients Seen','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HTS Clients Seen\n HTS Clients Seen\n \n 2023-09-21 12:45:02 UTC\n \n 2023-09-21 12:45:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2542\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in( \nSELECT Id \nFROM ( \n select distinct o.person_id as Id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n where o.concept_id = 4845 and o.value_coded = 4847 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n ) as A \n)\n','2023-09-21 14:45:02',4,'2023-09-21 14:45:39',4,0,NULL,NULL,NULL,'ce0fbba8-f81e-4f15-9da5-b341fd68b611'),(2543,'HTS clients with visits started','HTS clients with visits started','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HTS clients with visits started\n HTS clients with visits started\n \n 2023-09-21 12:45:52 UTC\n \n 2023-09-21 12:46:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2543\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id \n JOIN obs o on o.encounter_id=en.encounter_id \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n and v.visit_type_id = 15 \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 14:45:52',4,'2023-09-21 14:46:05',4,0,NULL,NULL,NULL,'fe7fb845-5325-4d00-8cab-7041e6759f04'),(2544,'1st Postnatal (PNC) Attendance','1st Postnatal (PNC) Attendance','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n 1st Postnatal (PNC) Attendance\n 1st Postnatal (PNC) Attendance\n \n 2023-09-21 12:46:47 UTC\n \n 2023-09-21 12:47:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2544\n select \n o.person_id \nfrom obs o \ninner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as examination_timing \n from obs oss \n where oss.concept_id = 4393 and oss.voided=0 \n and cast(oss.obs_datetime as date) >= cast(:startDate as date) \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where concept_id = 4393 \n and o.obs_datetime = max_observation\n','2023-09-21 14:46:47',4,'2023-09-21 14:47:10',4,0,NULL,NULL,NULL,'290d3497-9608-4796-9826-1dc624696dbd'),(2545,'HTS clients with visits consulted','HTS clients with visits consulted','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HTS clients with visits consulted\n HTS clients with visits consulted\n \n 2023-09-21 12:47:27 UTC\n \n 2023-09-21 12:47:54 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2545\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id \n JOIN obs o on o.encounter_id=en.encounter_id \n and o.concept_id = 4238 and o.voided =0 \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n and v.visit_type_id = 15 \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 14:47:27',4,'2023-09-21 14:47:54',4,0,NULL,NULL,NULL,'35051ec1-423c-4ede-a68f-88e94f2dc6a2'),(2546,'Self test Kits distributed','Self test Kits distributed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Self test Kits distributed\n Self test Kits distributed\n \n 2023-09-21 12:48:21 UTC\n \n 2023-09-21 12:48:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2546\n (select patient.patient_id AS Id \n from obs o \n -- HTS SELF TEST STRATEGY \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n AND o.concept_id = 4833 and o.value_coded = 4834 \n AND patient.voided = 0 AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n ) \n \nUNION ALL \n(select patient.patient_id AS Id \n from obs o \n -- HTS SELF TEST STRATEGY \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n AND o.concept_id = 4836 and o.value_coded in (4837, 4838, 4839) \n AND patient.voided = 0 AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n )\n','2023-09-21 14:48:21',4,'2023-09-21 14:48:36',4,0,NULL,NULL,NULL,'4ef31fd0-53cc-4296-adc1-1b74455e2a5f'),(2547,'ANC clients with visits started','ANC clients with visits started','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n ANC clients with visits started\n ANC clients with visits started\n \n 2023-09-21 12:49:04 UTC\n \n 2023-09-21 12:49:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2547\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id \n JOIN obs o on o.encounter_id=en.encounter_id \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n and v.visit_type_id = 16 \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 14:49:04',4,'2023-09-21 14:49:44',4,0,NULL,NULL,NULL,'928922c7-633f-4cb0-9149-88ae7e50e237'),(2548,'Under5 Clients Seen','Under5 Clients Seen','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Under5 Clients Seen\n Under5 Clients Seen\n \n 2023-09-21 12:49:57 UTC\n \n 2023-09-21 12:50:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2548\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in( \nSELECT Id \nFROM ( \n select distinct o.person_id as Id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n where o.concept_id = 4285 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n ) as A \n)\n','2023-09-21 14:49:57',4,'2023-09-21 14:50:12',4,0,NULL,NULL,NULL,'93a89f3f-f556-4592-b12e-cf8849d58b58'),(2549,'ANC clients with visits consulted','ANC clients with visits consulted','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n ANC clients with visits consulted\n ANC clients with visits consulted\n \n 2023-09-21 12:50:25 UTC\n \n 2023-09-21 12:51:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2549\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id \n JOIN obs o on o.encounter_id=en.encounter_id \n and o.concept_id = 4663 and o.voided =0 \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n and v.visit_type_id = 16 \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 14:50:25',4,'2023-09-21 14:51:08',4,0,NULL,NULL,NULL,'ab0560b8-8a8b-4759-983b-d3b0d69afafa'),(2550,'HEI Clients Seen','HEI Clients Seen','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HEI Clients Seen\n HEI Clients Seen\n \n 2023-09-21 12:51:29 UTC\n \n 2024-02-06 12:40:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2550\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in( \nSELECT Id \nFROM ( \n select distinct o.person_id as Id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n where o.concept_id in (4189,4558) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n ) as A \n)\n','2023-09-21 18:21:29',4,'2024-02-06 18:10:40',4,0,NULL,NULL,NULL,'f8e02920-02de-4c2b-9b44-6974b937b51c'),(2551,'PNC clients with visits started','PNC clients with visits started','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PNC clients with visits started\n PNC clients with visits started\n \n 2023-09-21 12:51:49 UTC\n \n 2023-09-21 12:52:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2551\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id \n JOIN obs o on o.encounter_id=en.encounter_id \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n and v.visit_type_id = 17 \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 14:51:49',4,'2023-09-21 14:52:21',4,0,NULL,NULL,NULL,'dddf7e03-38fe-419f-81a4-625dabb0fd4e'),(2552,'Family Planning Clients seen','Family Planning Clients seen','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Family Planning Clients seen\n Family Planning Clients seen\n \n 2023-09-21 12:52:28 UTC\n \n 2023-09-21 12:52:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2552\n select \n o.person_id \nfrom obs o \ninner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as examination_timing \n from obs oss \n where oss.concept_id = 4557 and oss.voided=0 \n and cast(oss.obs_datetime as date) >= cast(:startDate as date) \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where concept_id = 4557 \n and o.obs_datetime = max_observation\n','2023-09-21 14:52:28',4,'2023-09-21 14:52:43',4,0,NULL,NULL,NULL,'287d14af-8d53-48d0-8cf4-47f141b0e9ea'),(2553,'PNC clients with visits consulted','PNC clients with visits consulted','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PNC clients with visits consulted\n PNC clients with visits consulted\n \n 2023-09-21 12:52:50 UTC\n \n 2023-09-21 12:53:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2553\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id \n JOIN obs o on o.encounter_id=en.encounter_id \n and o.concept_id = 4386 and o.voided =0 \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n and v.visit_type_id = 17 \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 14:52:50',4,'2023-09-21 14:53:03',4,0,NULL,NULL,NULL,'bf6795b4-6d7f-49bd-aff7-53781f102898'),(2554,'Cervical Cancer Screening clients seen','Cervical Cancer Screening clients seen','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Cervical Cancer Screening clients seen\n Cervical Cancer Screening clients seen\n \n 2023-09-21 12:53:29 UTC\n \n 2023-10-17 13:11:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2554\n select \n o.person_id \nfrom obs o \ninner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as examination_timing \n from obs oss \n where oss.concept_id = 4511 and oss.voided=0 \n and cast(oss.obs_datetime as date) >= cast(:startDate as date) \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where concept_id = 4511 \n and o.obs_datetime = max_observation\n','2023-09-21 18:23:29',4,'2023-10-17 18:41:36',4,0,NULL,NULL,NULL,'f436cc71-62c7-413d-81b3-0f6bbad88a73'),(2555,'HEI clients with visits started','HEI clients with visits started','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HEI clients with visits started\n HEI clients with visits started\n \n 2023-09-21 12:54:17 UTC\n \n 2023-09-21 12:54:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2555\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id \n JOIN obs o on o.encounter_id=en.encounter_id \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n and v.visit_type_id = 18 \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 14:54:17',4,'2023-09-21 14:54:29',4,0,NULL,NULL,NULL,'e26ba5ce-54c6-4693-8f0c-52aae22ce97b'),(2556,'ANC Clients Seen','ANC Clients Seen','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n ANC Clients Seen\n ANC Clients Seen\n \n 2023-09-21 12:54:42 UTC\n \n 2023-09-21 12:54:57 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2556\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in( \nSELECT Id \nFROM ( \n select distinct o.person_id as Id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n where o.concept_id = 4663 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n ) as A \n)\n','2023-09-21 14:54:42',4,'2023-09-21 14:54:57',4,0,NULL,NULL,NULL,'f58dd29e-bfcf-411a-a5fa-789722177fd1'),(2557,'HEI clients with visits consulted','HEI clients with visits consulted','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HEI clients with visits consulted\n HEI clients with visits consulted\n \n 2023-09-21 12:55:13 UTC\n \n 2023-09-21 12:56:33 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2557\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id \n JOIN obs o on o.encounter_id=en.encounter_id \n and o.concept_id in (4558, 4186) and o.voided =0 \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n and v.visit_type_id = 18 \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 14:55:13',4,'2023-09-21 14:56:33',4,0,NULL,NULL,NULL,'2bcc29bb-b22f-4866-8035-f7f1db1ead87'),(2558,'ANC Clients Seen','ANC Clients Seen','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n ANC Clients Seen\n ANC Clients Seen\n \n 2023-09-21 12:55:47 UTC\n \n 2023-09-21 12:56:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2558\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 14:55:47',4,'2023-09-21 14:56:41',4,0,NULL,NULL,NULL,'7006c9eb-caa2-4617-9151-d6872b35e3a1'),(2559,'Cervical Cancer Screening clients seen','Cervical Cancer Screening clients seen','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Cervical Cancer Screening clients seen\n Cervical Cancer Screening clients seen\n \n 2023-09-21 12:57:08 UTC\n \n 2023-09-21 12:57:52 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2559\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 14:57:08',4,'2023-09-21 14:57:52',4,0,NULL,NULL,NULL,'697c637f-d0ae-45a2-9eab-f4f9012c2412'),(2560,'Family Planning clients with visits started','Family Planning clients with visits started','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Family Planning clients with visits started\n Family Planning clients with visits started\n \n 2023-09-21 12:57:35 UTC\n \n 2023-09-21 12:57:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2560\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id \n JOIN obs o on o.encounter_id=en.encounter_id \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n and v.visit_type_id = 22 \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 14:57:35',4,'2023-09-21 14:57:59',4,0,NULL,NULL,NULL,'a713664a-9547-4de1-bcea-eab77e351ec5'),(2561,'Family Planning Clients seen','Family Planning Clients seen','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Family Planning Clients seen\n Family Planning Clients seen\n \n 2023-09-21 12:58:35 UTC\n \n 2023-09-21 12:59:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2561\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 14:58:35',4,'2023-09-21 14:59:30',4,0,NULL,NULL,NULL,'4934d5cb-a141-4144-9937-59b8bb142789'),(2562,'Family Planning clients with visits consulted','Family Planning clients with visits consulted','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Family Planning clients with visits consulted\n Family Planning clients with visits consulted\n \n 2023-09-21 12:58:46 UTC\n \n 2023-09-21 12:59:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2562\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id \n JOIN obs o on o.encounter_id=en.encounter_id \n and o.concept_id = 4557 and o.voided =0 \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n and v.visit_type_id = 22 \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 14:58:46',4,'2023-09-21 14:59:18',4,0,NULL,NULL,NULL,'ada60155-c22d-4ad4-b960-45bb814acd47'),(2563,'HEI Clients Seen','HEI Clients Seen','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HEI Clients Seen\n HEI Clients Seen\n \n 2023-09-21 12:59:50 UTC\n \n 2023-09-21 13:00:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2563\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 14:59:50',4,'2023-09-21 15:00:32',4,0,NULL,NULL,NULL,'8f5713d9-1797-48ed-92ba-7a6bbc3f02be'),(2564,'Under 5 clients with visits started','Under 5 clients with visits started','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Under 5 clients with visits started\n Under 5 clients with visits started\n \n 2023-09-21 12:59:58 UTC\n \n 2023-09-21 13:00:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2564\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id \n JOIN obs o on o.encounter_id=en.encounter_id \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n and v.visit_type_id = 20 \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 14:59:58',4,'2023-09-21 15:00:12',4,0,NULL,NULL,NULL,'b569e5c1-aab8-4a67-955c-b09d0c5c1b6b'),(2565,'Under 5 clients with visits consulted','Under 5 clients with visits consulted','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Under 5 clients with visits consulted\n Under 5 clients with visits consulted\n \n 2023-09-21 13:00:57 UTC\n \n 2023-09-21 13:01:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2565\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id \n JOIN obs o on o.encounter_id=en.encounter_id \n and o.concept_id = 4285 and o.voided =0 \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n and v.visit_type_id = 20 \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 15:00:57',4,'2023-09-21 15:01:12',4,0,NULL,NULL,NULL,'ae2b5eee-422b-4307-a985-7bd763147582'),(2566,'HTS Clients Seen','HTS Clients Seen','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HTS Clients Seen\n HTS Clients Seen\n \n 2023-09-21 13:00:59 UTC\n \n 2023-09-21 13:01:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2566\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:00:59',4,'2023-09-21 15:01:59',4,0,NULL,NULL,NULL,'198319c7-6986-4599-8b2a-886ed81d7c37'),(2567,'1st Postnatal (PNC) Attendance','1st Postnatal (PNC) Attendance','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n 1st Postnatal (PNC) Attendance\n 1st Postnatal (PNC) Attendance\n \n 2023-09-21 13:01:44 UTC\n \n 2023-09-21 13:02:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2567\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:01:44',4,'2023-09-21 15:02:26',4,0,NULL,NULL,NULL,'07589d1a-d289-491c-a8dd-ac6e506b6eca'),(2568,'Cervical Cancer Screening clients with visits started','Cervical Cancer Screening clients with visits started','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Cervical Cancer Screening clients with visits started\n Cervical Cancer Screening clients with visits started\n \n 2023-09-21 13:02:00 UTC\n \n 2023-09-21 13:02:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2568\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id \n JOIN obs o on o.encounter_id=en.encounter_id \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n and v.visit_type_id = 21 \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 15:02:00',4,'2023-09-21 15:02:14',4,0,NULL,NULL,NULL,'4f7cc18d-1104-4427-b582-f73b99bd0837'),(2569,'Self test Kits distributed','Self test Kits distributed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Self test Kits distributed\n Self test Kits distributed\n \n 2023-09-21 13:02:50 UTC\n \n 2023-09-21 13:04:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2569\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:02:50',4,'2023-09-21 15:04:03',4,0,NULL,NULL,NULL,'5cc879f5-78be-4f74-9cd0-06ae596deffe'),(2570,'Cervical Cancer Screening clients with visits consulted','Cervical Cancer Screening clients with visits consulted','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Cervical Cancer Screening clients with visits consulted\n Cervical Cancer Screening clients with visits consulted\n \n 2023-09-21 13:02:56 UTC\n \n 2023-09-21 13:03:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2570\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id \n JOIN obs o on o.encounter_id=en.encounter_id \n and o.concept_id = 4511 and o.voided =0 \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n and v.visit_type_id = 21 \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 15:02:56',4,'2023-09-21 15:03:08',4,0,NULL,NULL,NULL,'cf21c6a3-0a19-44c7-b2c7-e14246d7bc96'),(2571,'Under5 Clients Seen','Under5 Clients Seen','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Under5 Clients Seen\n Under5 Clients Seen\n \n 2023-09-21 13:03:36 UTC\n \n 2023-09-21 13:05:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2571\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:03:36',4,'2023-09-21 15:05:20',4,0,NULL,NULL,NULL,'d8654256-acae-40b0-a3c2-feafeb2f36ad'),(2572,'eRegister Monitoring Report','eRegister Monitoring Report','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n eRegister Monitoring Report\n eRegister Monitoring Report\n \n 2023-09-21 13:06:13 UTC\n \n 2023-09-21 13:26:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2572\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-09-21 15:06:13',4,'2023-09-21 15:26:06',4,0,NULL,NULL,NULL,'a9290709-3dd9-4bfe-823d-b1702d10ec0f'),(2573,'eRegister Monitoring Report Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n eRegister Monitoring Report Data Set\n \n 2023-09-21 13:06:21 UTC\n \n 2023-09-22 08:47:46 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2573\n \n \n \n ANC_Consul\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n \n \n ANC_Seen\n \n \n \n \n \n \n \n \n \n ANC_Visits\n \n \n \n \n \n \n \n \n \n ART_Consul\n \n \n \n \n \n \n \n \n \n ART_Visits\n \n \n \n \n \n \n \n \n \n Cerv_Consu\n \n \n \n \n \n \n \n \n \n Cerv_Scree\n \n \n \n \n \n \n \n \n \n Cerv_Visit\n \n \n \n \n \n \n \n \n \n ClntsOnArt\n \n \n \n \n \n \n \n \n \n FP_Consult\n \n \n \n \n \n \n \n \n \n FP_Seen\n \n \n \n \n \n \n \n \n \n FP_Visits\n \n \n \n \n \n \n \n \n \n HEI_Consul\n \n \n \n \n \n \n \n \n \n HEI_Seen\n \n \n \n \n \n \n \n \n \n HEI_Visits\n \n \n \n \n \n \n \n \n \n HTS_Consul\n \n \n \n \n \n \n \n \n \n HTS_Seen\n \n \n \n \n \n \n \n \n \n HTS_Visits\n \n \n \n \n \n \n \n \n \n LTest_Rev\n \n \n \n \n \n \n \n \n \n LTest_Sent\n \n \n \n \n \n \n \n \n \n PNC_Attend\n \n \n \n \n \n \n \n \n \n PNC_Consul\n \n \n \n \n \n \n \n \n \n PNC_Visits\n \n \n \n \n \n \n \n \n \n Self_tes_D\n \n \n \n \n \n \n \n \n \n TB_Consult\n \n \n \n \n \n \n \n \n \n TB_Visits\n \n \n \n \n \n \n \n \n \n Tx_New\n \n \n \n \n \n \n \n \n \n Under5_Con\n \n \n \n \n \n \n \n \n \n Under5_See\n \n \n \n \n \n \n \n \n \n Under5_Vis\n \n \n \n \n \n \n \n \n \n','2023-09-21 13:06:21',4,'2023-09-22 08:47:46',4,0,NULL,NULL,NULL,'a971d8e2-a66a-487c-aae4-36c6f14a3328'),(2574,' ANC clients with visits started',' ANC clients with visits started','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n ANC clients with visits started\n ANC clients with visits started\n \n 2023-09-21 13:07:00 UTC\n \n 2023-09-21 13:07:46 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2574\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:07:00',4,'2023-09-21 15:07:46',4,0,NULL,NULL,NULL,'69485106-52a5-452e-91ef-6ecf80894a7f'),(2575,'ART clients with visits consulted','ART clients with visits consulted','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n ART clients with visits consulted\n ART clients with visits consulted\n \n 2023-09-21 13:08:16 UTC\n \n 2023-09-21 13:08:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2575\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:08:16',4,'2023-09-21 15:08:50',4,0,NULL,NULL,NULL,'7cce44cb-0809-4493-84bb-2fdbe745ceab'),(2576,'ART clients with visits started','ART clients with visits started','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n ART clients with visits started\n ART clients with visits started\n \n 2023-09-21 13:09:47 UTC\n \n 2023-09-21 13:11:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2576\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:09:47',4,'2023-09-21 15:11:10',4,0,NULL,NULL,NULL,'a5551436-00f8-45c4-aa3b-6aaae3160f55'),(2577,'Clients initiated on ART this month','Clients initiated on ART this month','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients initiated on ART this month\n Clients initiated on ART this month\n \n 2023-09-21 13:11:24 UTC\n \n 2023-09-21 13:12:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2577\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:11:24',4,'2023-09-21 15:12:20',4,0,NULL,NULL,NULL,'e6b92d7a-5f7e-4001-957e-30b6be452168'),(2578,'ANC clients with visits consulted','ANC clients with visits consulted','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n ANC clients with visits consulted\n ANC clients with visits consulted\n \n 2023-09-21 13:11:45 UTC\n \n 2023-09-21 13:12:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2578\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:11:45',4,'2023-09-21 15:12:58',4,0,NULL,NULL,NULL,'5c7fcfb9-3d39-4225-a4f3-8ed358e16626'),(2579,'TB clients with visits started','TB clients with visits started','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB clients with visits started\n TB clients with visits started\n \n 2023-09-21 13:13:10 UTC\n \n 2023-09-21 13:13:56 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2579\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:13:10',4,'2023-09-21 15:13:56',4,0,NULL,NULL,NULL,'09767de3-79b3-43e2-82da-339278f5e10d'),(2580,'TB clients with visits consulted','TB clients with visits consulted','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB clients with visits consulted\n TB clients with visits consulted\n \n 2023-09-21 13:14:13 UTC\n \n 2023-09-21 13:16:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2580\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:14:13',4,'2023-09-21 15:16:03',4,0,NULL,NULL,NULL,'d4ae74d3-d618-4e3b-8d10-4c54e5f3b75a'),(2581,'HTS clients with visits started','HTS clients with visits started','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HTS clients with visits started\n HTS clients with visits started\n \n 2023-09-21 13:16:45 UTC\n \n 2023-09-21 13:17:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2581\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:16:45',4,'2023-09-21 15:17:18',4,0,NULL,NULL,NULL,'91f470f1-71bf-4a21-bd12-efe0fe142c0a'),(2582,'HTS clients with visits consulted','HTS clients with visits consulted','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HTS clients with visits consulted\n HTS clients with visits consulted\n \n 2023-09-21 13:17:44 UTC\n \n 2023-09-21 13:18:19 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2582\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:17:44',4,'2023-09-21 15:18:19',4,0,NULL,NULL,NULL,'2bd858aa-2daf-4fd2-9028-9d6fba579a89'),(2583,'PNC clients with visits started','PNC clients with visits started','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PNC clients with visits started\n PNC clients with visits started\n \n 2023-09-21 13:18:49 UTC\n \n 2023-09-21 13:19:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2583\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:18:49',4,'2023-09-21 15:19:20',4,0,NULL,NULL,NULL,'80003d94-268b-4726-ba0d-0fa830e90463'),(2584,'PNC clients with visits consulted','PNC clients with visits consulted','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PNC clients with visits consulted\n PNC clients with visits consulted\n \n 2023-09-21 13:19:39 UTC\n \n 2023-09-21 13:20:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2584\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:19:39',4,'2023-09-21 15:20:18',4,0,NULL,NULL,NULL,'e64fd32d-8284-4fb5-a227-8f338859ceaa'),(2586,'HEI clients with visits started','HEI clients with visits started','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HEI clients with visits started\n HEI clients with visits started\n \n 2023-09-21 13:23:38 UTC\n \n 2023-09-21 13:24:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2586\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:23:38',4,'2023-09-21 15:24:10',4,0,NULL,NULL,NULL,'e7e581aa-9b90-4f56-b8a1-9bfc607f8b4f'),(2587,'HEI clients with visits consulted','HEI clients with visits consulted','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HEI clients with visits consulted\n HEI clients with visits consulted\n \n 2023-09-21 13:24:38 UTC\n \n 2023-09-21 13:25:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2587\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:24:38',4,'2023-09-21 15:25:05',4,0,NULL,NULL,NULL,'dd05778e-c5bd-4430-90fa-fd97b36402d2'),(2588,'Family Planning clients with visits started','Family Planning clients with visits started','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Family Planning clients with visits started\n Family Planning clients with visits started\n \n 2023-09-21 13:25:31 UTC\n \n 2023-09-21 13:26:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2588\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:25:31',4,'2023-09-21 15:26:32',4,0,NULL,NULL,NULL,'3278fb6f-2276-4390-a5c2-9863d056f3a0'),(2589,'Family Planning clients with visits consulted','Family Planning clients with visits consulted','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Family Planning clients with visits consulted\n Family Planning clients with visits consulted\n \n 2023-09-21 13:26:58 UTC\n \n 2023-09-21 13:27:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2589\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:26:58',4,'2023-09-21 15:27:32',4,0,NULL,NULL,NULL,'822f0677-6a2b-47cf-9265-0841d65e9716'),(2590,'Under 5 clients with visits consulted','Under 5 clients with visits consulted','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Under 5 clients with visits consulted\n Under 5 clients with visits consulted\n \n 2023-09-21 13:28:28 UTC\n \n 2023-09-21 13:31:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2590\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:28:28',4,'2023-09-21 15:31:36',4,0,NULL,NULL,NULL,'3a2857b0-1d9c-4f7d-95e9-abcba540935d'),(2591,'Under 5 clients with visits started','Under 5 clients with visits started','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Under 5 clients with visits started\n Under 5 clients with visits started\n \n 2023-09-21 13:30:05 UTC\n \n 2023-09-21 13:30:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2591\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:30:05',4,'2023-09-21 15:30:36',4,0,NULL,NULL,NULL,'f62e6fdd-a64b-4619-925c-d86fc3987060'),(2592,'Clients current on ART','Clients current on ART','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients current on ART\n Clients current on ART\n \n 2023-09-21 13:31:58 UTC\n \n 2023-09-21 13:35:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2592\n (SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n person.gender AS Gender, \n observed_age_group.name AS age_group, \n observed_age_group.sort_order AS sort_order \n \n from obs o \n -- CLIENTS NEWLY INITIATED ON ART \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND (o.concept_id = 2249 \n \n AND MONTH(o.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(o.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n ) \n AND patient.voided = 0 AND o.voided = 0 \n AND o.person_id not in ( \n select distinct os.person_id from obs os \n where os.concept_id = 3634 \n AND os.value_coded = 2095 \n and os.voided = 0 \n AND MONTH(os.obs_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.obs_datetime) = YEAR(CAST(:endDate AS DATE)) \n ) \n \n and o.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages') AS Newly_Initiated_ART_Clients \nORDER BY Newly_Initiated_ART_Clients.patientName) \n \nUNION \n \n(SELECT Id \nFROM ( \n \nselect distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n person.gender AS Gender, \n observed_age_group.name AS age_group, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- CLIENTS SEEN FOR ART \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND (o.concept_id = 3843 AND o.value_coded = 3841 OR o.value_coded = 3842) \n AND MONTH(o.obs_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(o.obs_datetime) = YEAR(CAST(:endDate AS DATE)) \n AND patient.voided = 0 AND o.voided = 0 \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n \n) AS Clients_Seen \n \nWHERE Clients_Seen.Id not in ( \n select distinct patient.patient_id AS Id \n from obs o \n -- CLIENTS INITIATED ON ART \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND (o.concept_id = 2249 \n AND MONTH(o.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(o.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n ) \n AND patient.voided = 0 AND o.voided = 0 \n AND o.person_id not in ( \n select distinct os.person_id from obs os \n where os.concept_id = 3634 \n AND os.value_coded = 2095 \n and os.voided = 0 \n AND MONTH(os.obs_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.obs_datetime) = YEAR(CAST(:endDate AS DATE)) \n ) \n \n ) \nAND Clients_Seen.Id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 and os.voided = 0 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 and os.voided = 0 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \nAND Clients_Seen.Id not in \n ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 and os.voided = 0 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) \n and o.person_id in ( \n -- Death \n select distinct p.person_id \n from person p \n where dead = 1 \n and death_date <= CAST(:endDate AS DATE) \n and voided = 0 \n ) \n ) \nAND Clients_Seen.Id not in ( \n -- Visitors \n select o.person_id \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as examination_timing \n from obs oss \n where oss.concept_id = 5416 and oss.value_coded =1 and oss.voided=0 \n and cast(oss.obs_datetime as date) >= cast(:startDate as date) \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where concept_id = 5416 \n and o.obs_datetime = max_observation \n ) \n \nORDER BY Clients_Seen.patientName) \n \nUNION \n \n \n-- INCLUDE MISSED APPOINTMENTS WITHIN 28 DAYS ACCORDING TO THE NEW PEPFAR GUIDELINE \n(SELECT Id \nFROM \n (select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n person.gender AS Gender, \n observed_age_group.name AS age_group, \n observed_age_group.sort_order AS sort_order \n \n from obs o \n -- CLIENTS WHO MISSED APPOINTMENTS < 28 DAYS \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n -- begin \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up < cast(:endDate as date) \n and DATEDIFF(CAST(:endDate AS DATE),latest_follow_up) <= 28 \n \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where (os.concept_id = 3843 AND os.value_coded = 3841 OR os.value_coded = 3842) \n AND MONTH(os.obs_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.obs_datetime) = YEAR(CAST(:endDate AS DATE)) \n and os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND MONTH(os.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n and os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n \n -- TOUTS \n select tout_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.obs_datetime AS latest_consultation \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(max(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 2403 \n and obs_datetime <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 2398 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as tout_clients \n where tout_clients.latest_consultation < cast(:endDate as date) \n \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n \n ) \n \n and active_clients.person_id not in( \n -- Visitors \n select o.person_id \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as examination_timing \n from obs oss \n where oss.concept_id = 5416 and oss.value_coded =1 and oss.voided=0 \n and cast(oss.obs_datetime as date) >= cast(:startDate as date) \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where concept_id = 5416 \n and o.obs_datetime = max_observation \n ) \n ) \n -- end \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages') AS TwentyEightDayDefaulters \n order by TwentyEightDayDefaulters.patientName) \n \n \nUNION \n \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n person.gender AS Gender, \n observed_age_group.name AS age_group, \n observed_age_group.sort_order AS sort_order \n \n from obs o \n \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n -- begin \n select active_clients.person_id-- , active_clients.latest_follow_up \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where (os.concept_id = 3843 AND os.value_coded = 3841 OR os.value_coded = 3842) \n AND MONTH(os.obs_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.obs_datetime) = YEAR(CAST(:endDate AS DATE)) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND MONTH(os.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 and os.voided = 0 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 and os.voided = 0 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select o.person_id \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as examination_timing \n from obs oss \n where oss.concept_id = 5416 and oss.value_coded =1 and oss.voided=0 \n and cast(oss.obs_datetime as date) >= cast(:startDate as date) \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where concept_id = 5416 \n and o.obs_datetime = max_observation \n ) \n ) \n -- end \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages') AS Seen_Previous_ART_Clients \nORDER BY Seen_Previous_ART_Clients.patientName) \n\n','2023-09-21 15:31:58',4,'2023-09-21 15:35:41',4,0,NULL,NULL,NULL,'ad403c3b-d759-44ab-8965-252ca6127ce7'),(2593,'Cervical Cancer Screening clients with visits started','Cervical Cancer Screening clients with visits started','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Cervical Cancer Screening clients with visits started\n Cervical Cancer Screening clients with visits started\n \n 2023-09-21 13:32:10 UTC\n \n 2023-09-21 13:32:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2593\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:32:10',4,'2023-09-21 15:32:43',4,0,NULL,NULL,NULL,'c7967fcd-a8b7-41d4-b540-364a60a59621'),(2594,'Cervical Cancer Screening clients with visits consulted','Cervical Cancer Screening clients with visits consulted','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Cervical Cancer Screening clients with visits consulted\n Cervical Cancer Screening clients with visits consulted\n \n 2023-09-21 13:33:06 UTC\n \n 2023-09-21 13:34:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2594\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:33:06',4,'2023-09-21 15:34:03',4,0,NULL,NULL,NULL,'b526566e-555d-40c6-88d4-0b89242b1dde'),(2595,'Clients current on ART','Clients current on ART','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients current on ART\n Clients current on ART\n \n 2023-09-21 13:36:28 UTC\n \n 2023-09-21 13:37:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2595\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:36:28',4,'2023-09-21 15:37:08',4,0,NULL,NULL,NULL,'1db1c64d-177f-4ecc-b1d7-c9fd2b029eff'),(2596,'Clients with LAB tests sent','Clients with LAB tests sent','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients with LAB tests sent\n Clients with LAB tests sent\n \n 2023-09-22 08:35:11 UTC\n \n 2023-09-22 08:35:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2596\n select distinct patient.patient_id AS Id \n from orders o \n INNER JOIN patient ON o.patient_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n AND o.concept_id = 5484 \n AND CAST(o.date_created AS DATE)>= CAST(:startDate AS DATE) \n AND CAST(o.date_created AS DATE) <= CAST(:endDate AS DATE) \n LEFT OUTER JOIN patient_identifier p ON p.patient_id = person.person_id AND p.identifier_type = 5\n','2023-09-22 08:35:11',4,'2023-09-22 08:35:51',4,0,NULL,NULL,NULL,'f06f1ccb-c048-44d3-8037-35f8660a6b95'),(2597,'Clients with LAB tests sent','Clients with LAB tests sent','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients with LAB tests sent\n Clients with LAB tests sent\n \n 2023-09-22 08:36:30 UTC\n \n 2023-09-22 08:38:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2597\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-22 08:36:30',4,'2023-09-22 08:38:26',4,0,NULL,NULL,NULL,'c29cff5d-5919-4b60-8ab7-c6d4c7ea01da'),(2598,'Clients with LAB tests received','Clients with LAB tests received','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients with LAB tests received\n Clients with LAB tests received\n \n 2023-09-22 08:39:02 UTC\n \n 2024-02-06 09:57:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2598\n Select pId \n From \n ( \n select oss.person_id as pId, concat(oss.value_numeric, " ", "copies/ml") as Results \n from obs oss \n where oss.concept_id = 5485 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) >= cast(:startDate as date) \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n \n UNION \n \n select oss.person_id as pId, "LDL" as Results \n from obs oss \n where oss.concept_id = 5489 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) >= cast(:startDate as date) \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n \n ) As received_results\n','2023-09-22 14:09:02',4,'2024-02-06 15:27:28',4,0,NULL,NULL,NULL,'6939902b-1909-4f24-b71d-da60ab1d131b'),(2599,'Clients with LAB tests received','Clients with LAB tests received','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients with LAB tests received\n Clients with LAB tests received\n \n 2023-09-22 08:39:53 UTC\n \n 2023-09-22 08:42:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2599\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-22 08:39:53',4,'2023-09-22 08:42:39',4,0,NULL,NULL,NULL,'e47a29f8-b851-480f-9812-e54da393fdb9'),(2600,'Contacts of TB Patients','Contacts of TB Patients','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Contacts of TB Patients\n Contacts of TB Patients\n \n 2024-02-27 09:43:12 UTC\n \n 2024-02-27 10:34:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2600\n select contact.person_id \n from \n (select B.person_id, B.obs_datetime \n from obs B \n inner join \n (select person_id, max(obs_datetime) as latest_consultation \n from obs where concept_id = 5926 \n and obs_datetime <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.latest_consultation = B.obs_datetime \n where concept_id = 5962 and value_coded = 2146 \n and A.latest_consultation = B.obs_datetime \n and voided = 0 \n group by B.person_id \n ) as contact\n','2024-02-27 15:13:12',4,'2024-02-27 16:04:55',4,0,NULL,NULL,NULL,'f74fefb2-b6d4-4c26-b214-fdb965aeb103'),(2601,'Contacts of TB Patients screened for TB','Contacts of TB Patients screened for TB','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Contacts of TB Patients screened for TB\n Contacts of TB Patients screened for TB\n \n 2024-02-27 10:35:41 UTC\n \n 2024-02-27 10:36:09 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2601\n select contact.person_id \n from \n (select B.person_id \n from obs B \n inner join \n (select person_id, max(obs_datetime) as latest_consultation \n from obs where concept_id = 5904 \n and obs_datetime <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.latest_consultation = B.obs_datetime \n where concept_id = 5962 and value_coded = 2146 \n and A.latest_consultation = B.obs_datetime \n and voided = 0 \n group by B.person_id \n ) as contact\n','2024-02-27 16:05:41',4,'2024-02-27 16:06:09',4,0,NULL,NULL,NULL,'6733708e-c472-4c84-89a2-13e0938a8360'),(2602,'Presumptive TB contacts with bacteriologic result(s)','Presumptive TB contacts with bacteriologic test result (s)','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Presumptive TB contacts with bacteriologic result(s)\n Presumptive TB contacts with bacteriologic test result (s)\n \n 2024-02-27 14:08:31 UTC\n \n 2024-02-27 14:16:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2602\n \n select distinct Id \n FROM \n ( \n -- Bacteriologically confirmed Genotypic test results and Phenotypic test results \n select distinct person_id as Id \n From obs o \n where o.concept_id in (3814, 3815) \n and cast(o.obs_datetime as date) >= CAST(:startDate AS DATE) \n and cast(o.obs_datetime as date) <= CAST(:endDate AS DATE) \n and o.voided = 0 \n \n -- MTB not Detected \n and o.person_id in \n ( \n select distinct o.person_id \n from obs o \n inner join \n ( \n select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as examination_timing \n from obs oss \n where oss.concept_id in (5954,5433,5955,5956,5959) \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.Id = o.person_id \n where o.concept_id in (3787,3805,3840,5957) \n and o.voided=0 \n and cast(o.obs_datetime as date) = cast(max_observation as date) \n \n ) \n \n ) As Pulmonary_Bacteriologic\n','2024-02-27 19:38:31',4,'2024-02-27 19:46:55',4,0,NULL,NULL,NULL,'5c82cebb-b76f-4acd-a416-752578f29546'),(2603,'Contacts of TB Patients who are positive to a bacteriologic test ','Contacts of TB Patients who are positive to a bacteriologic test ','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Contacts of TB Patients who are positive to a bacteriologic test \n Contacts of TB Patients who are positive to a bacteriologic test \n \n 2024-02-27 14:17:57 UTC\n \n 2024-02-27 17:56:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2603\n select distinct Id \n FROM \n ( \n -- Bacteriologically results \n select distinct person_id as Id \n From obs o \n where o.concept_id = 5953 \n and cast(o.obs_datetime as date) >= CAST(:startDate AS DATE) \n and cast(o.obs_datetime as date) <= CAST(:endDate AS DATE) \n and o.voided = 0 \n \n -- MTB Detected \n and o.person_id in \n ( \n select distinct o.person_id \n from obs o \n inner join \n ( \n select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as examination_timing \n from obs oss \n where oss.concept_id in (5954,5433,5955,5956,5959) \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.Id = o.person_id \n where o.concept_id in (3787,3805,3840,5957) \n and o.value_coded in (3816,3817,3718, 1738, 3828,3829,3830, 3831, 3832,3833,3834, 3835,3836, 3837,3838,3839) \n and o.voided=0 \n and cast(o.obs_datetime as date) = cast(max_observation as date) \n \n ) \n \n ) As Pulmonary_Bacteriologic\n','2024-02-27 19:47:57',4,'2024-02-27 23:26:03',4,0,NULL,NULL,NULL,'c632d1d1-ddd1-40ca-bdfd-8df133511db3'),(2604,'Contacts of TB Patients who are positive bacteriologic test & started TB treatment','Contacts of TB Patients who are positive to a bacteriologic test and started on TB treatment','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Contacts of TB Patients who are positive bacteriologic test & started TB treatment\n Contacts of TB Patients who are positive to a bacteriologic test and started on TB treatment\n \n 2024-02-27 18:19:38 UTC\n \n 2024-02-27 18:20:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2604\n select distinct Id \n FROM \n ( \n -- Bacteriologically results \n select distinct person_id as Id \n From obs o \n where o.concept_id = 5953 \n and cast(o.obs_datetime as date) >= CAST(:startDate AS DATE) \n and cast(o.obs_datetime as date) <= CAST(:endDate AS DATE) \n and o.voided = 0 \n \n -- MTB Detected \n and o.person_id in \n ( \n select distinct o.person_id \n from obs o \n inner join \n ( \n select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as examination_timing \n from obs oss \n where oss.concept_id in (5954,5433,5955,5956,5959) \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.Id = o.person_id \n where o.concept_id in (3787,3805,3840,5957) \n and o.value_coded in (3816,3817,3718, 1738, 3828,3829,3830, 3831, 3832,3833,3834, 3835,3836, 3837,3838,3839) \n and o.voided=0 \n and cast(o.obs_datetime as date) = cast(max_observation as date) \n \n ) \n \n ) As Pulmonary_Bacteriologic \n inner join ( \n select ob.person_id as pId \n FROM obs ob \n -- Pulmonary TB \n where ob.concept_id = 2237 \n AND cast(ob.value_datetime as date) >= CAST(:startDate AS DATE) \n and cast(ob.value_datetime as date) <= CAST(:endDate AS DATE) \n and ob.voided = 0 \n ) as Pulmonary \n on Pulmonary_Bacteriologic.Id = Pulmonary.pId\n','2024-02-27 23:49:38',4,'2024-02-27 23:50:06',4,0,NULL,NULL,NULL,'d2360af2-f13b-4b10-978f-5f230a0a83d7'),(2605,'Contacts of TB patients - Presumptive','Contacts of TB patients who have one or more signs and symptoms of TB (Presumptive)','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Contacts of TB patients - Presumptive\n Contacts of TB patients who have one or more signs and symptoms of TB (Presumptive)\n \n 2024-02-27 18:31:50 UTC\n \n 2024-02-27 18:32:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2605\n select ob.person_id as pId \n FROM obs ob \n where ob.concept_id = 5940 \n AND cast(ob.obs_datetime as date) >= CAST(:startDate AS DATE) \n and cast(ob.obs_datetime as date) <= CAST(:endDate AS DATE) \n and ob.voided = 0\n','2024-02-28 00:01:50',4,'2024-02-28 00:02:42',4,0,NULL,NULL,NULL,'17e19631-0322-48e3-8a42-352880f64b8f'),(2606,'Detection_Age','TB detection age groups','org.openmrs.module.reporting.indicator.dimension.Dimension','org.openmrs.module.reporting.indicator.dimension.CohortDefinitionDimension','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Detection_Age\n TB detection age groups\n \n 2024-02-27 18:42:36 UTC\n \n 2024-02-27 18:47:04 UTC\n \n \n endDate\n \n java.util.Date\n true\n \n \n 2606\n \n \n 15+years\n \n \n \n \n maxAge\n 120\n \n \n minAge\n 15\n \n \n effectiveDate\n ${endDate}\n \n \n \n \n \n 5-14yrs\n \n \n \n \n maxAge\n 14\n \n \n minAge\n 5\n \n \n effectiveDate\n ${endDate}\n \n \n \n \n \n <5yrs\n \n \n \n \n maxAge\n 4\n \n \n minAge\n 0\n \n \n effectiveDate\n ${endDate}\n \n \n \n \n \n','2024-02-28 00:12:36',4,'2024-02-28 00:17:04',4,0,NULL,NULL,NULL,'c12ee61b-5bc3-4476-866b-3a5a1ac37038'),(2607,'Contacts of TB Patients','Contacts of TB Patients','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Contacts of TB Patients\n Contacts of TB Patients\n \n 2024-02-27 18:52:39 UTC\n \n 2024-02-27 18:54:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2607\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 00:22:39',4,'2024-02-28 00:24:05',4,0,NULL,NULL,NULL,'ec97d270-a1a8-4d2c-ae71-b6ffcb555781'),(2610,'Contacts of TB Patients screened for TB','Contacts of TB Patients screened for TB','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Contacts of TB Patients screened for TB\n Contacts of TB Patients screened for TB\n \n 2024-02-27 19:00:00 UTC\n \n 2024-02-27 19:00:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2610\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 00:30:00',4,'2024-02-28 00:30:51',4,0,NULL,NULL,NULL,'1fefae20-e24c-4809-97a3-0bb2942ca618'),(2611,'Contacts of TB patients -Presumptive','Contacts of TB patients who have one or more signs and symptoms of TB (Presumptive)','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Contacts of TB patients -Presumptive\n Contacts of TB patients who have one or more signs and symptoms of TB (Presumptive)\n \n 2024-02-27 19:02:10 UTC\n \n 2024-02-27 19:03:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2611\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 00:32:10',4,'2024-02-28 00:33:04',4,0,NULL,NULL,NULL,'61a06072-21c6-492d-94c7-f59c8980ce28'),(2612,'Presumptive TB contacts with bacteriologic test result (s)','Presumptive TB contacts with bacteriologic test result (s)','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Presumptive TB contacts with bacteriologic test result (s)\n Presumptive TB contacts with bacteriologic test result (s)\n \n 2024-02-27 19:04:19 UTC\n \n 2024-02-27 19:10:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2612\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 00:34:19',4,'2024-02-28 00:40:31',4,0,NULL,NULL,NULL,'93c6d789-932b-4b13-903a-1c238427492c'),(2614,'Contacts of TB Patients who are positive to a bacteriologic test ','Contacts of TB Patients who are positive to a bacteriologic test ','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Contacts of TB Patients who are positive to a bacteriologic test \n Contacts of TB Patients who are positive to a bacteriologic test \n \n 2024-02-27 19:11:53 UTC\n \n 2024-02-27 19:12:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2614\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 00:41:53',4,'2024-02-28 00:42:39',4,0,NULL,NULL,NULL,'ad43ca8a-5327-49d6-82a9-d4a5b532e54e'),(2615,'Contacts of TB Patients who are positive to a bacteriologic test and started on TB treatment','Contacts of TB Patients who are positive to a bacteriologic test and started on TB treatment','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Contacts of TB Patients who are positive to a bacteriologic test and started on TB treatment\n Contacts of TB Patients who are positive to a bacteriologic test and started on TB treatment\n \n 2024-02-27 19:13:47 UTC\n \n 2024-02-27 19:14:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2615\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 00:43:47',4,'2024-02-28 00:44:36',4,0,NULL,NULL,NULL,'eecb27c4-5eea-4c61-8093-2e76f27c5733'),(2616,'TB Case Detection - Block 2: Contact Tracing and screening ','TB Case Detection - Block 2: Contact Tracing and screening ','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Case Detection - Block 2: Contact Tracing and screening \n TB Case Detection - Block 2: Contact Tracing and screening \n \n 2024-02-27 19:18:00 UTC\n \n 2024-02-27 19:18:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2616\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2024-02-28 00:48:00',4,'2024-02-28 00:48:20',4,0,NULL,NULL,NULL,'18beaf66-8afb-4c42-85f3-6a4f9e6e4c86'),(2617,'TB Case Detection - Block 2: Contact Tracing and screening Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Case Detection - Block 2: Contact Tracing and screening Data Set\n \n 2024-02-27 19:18:20 UTC\n \n 2024-02-27 19:48:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2617\n \n \n Detection_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n AlPosBacTB\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n \n \n AllBacRes\n \n \n \n \n \n \n \n \n \n AllConPres\n \n \n \n \n \n \n \n \n \n AllConScre\n \n \n \n \n \n \n \n \n \n AllContact\n \n \n \n \n \n \n \n \n \n AllPosBact\n \n \n \n \n \n \n \n \n \n BacRes5-14\n \n \n \n \n Detection_Age\n 5-14yrs\n \n \n \n \n \n BacRes<5ys\n \n \n \n \n Detection_Age\n <5yrs\n \n \n \n \n \n Con15+ys\n \n \n \n \n Detection_Age\n 15+years\n \n \n \n \n \n ConPre15+y\n \n \n \n \n \n \n ConPre5-14\n \n \n \n \n \n \n ConPres<5y\n \n \n \n \n \n \n ConScr15+y\n \n \n \n \n \n \n ConScr5-14\n \n \n \n \n \n \n ConScr<5ys\n \n \n \n \n \n \n Cont5-14ys\n \n \n \n \n \n \n Cont<5ys\n \n \n \n \n \n \n PoBaTB5-14\n \n \n \n \n \n \n PoBacTB15+\n \n \n \n \n \n \n PosBac15+y\n \n \n \n \n \n \n PosBac5-14\n \n \n \n \n \n \n PosBac<5ys\n \n \n \n \n \n \n PosBacTB<5\n \n \n \n \n \n \n','2024-02-28 00:48:20',4,'2024-02-28 01:18:21',4,0,NULL,NULL,NULL,'8ce17921-9b17-4c08-9bfc-679a5d0d56da'),(2618,'TB patients given 2RHZE/4RHE weighing 30-39kg','TB patients given 2RHZE/4RHE weighing 30-39kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4RHE weighing 30-39kg\n TB patients given 2RHZE/4RHE weighing 30-39kg\n \n 2024-02-28 09:00:45 UTC\n \n 2024-02-28 09:01:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2618\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6002 -- 2RHZE/4RHE \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=30 and _weight < 40 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 14:30:45',4,'2024-02-28 14:31:30',4,0,NULL,NULL,NULL,'bce1bee1-bb3f-4a76-afef-2247f4cd563d'),(2619,'TB patients given 2RHZE/4RHE weighing 40-54kg','TB patients given 2RHZE/4RHE weighing 40-54kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4RHE weighing 40-54kg\n TB patients given 2RHZE/4RHE weighing 40-54kg\n \n 2024-02-28 09:03:00 UTC\n \n 2024-02-28 09:03:22 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2619\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6002 -- 2RHZE/4RHE \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=40 and _weight < 55 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 14:33:00',4,'2024-02-28 14:33:22',4,0,NULL,NULL,NULL,'1e603efc-b71c-45c5-8c9b-8f3126d88455'),(2620,'TB patients given 2RHZE/4RHE weighing 55-70kg','TB patients given 2RHZE/4RHE weighing 55-70kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4RHE weighing 55-70kg\n TB patients given 2RHZE/4RHE weighing 55-70kg\n \n 2024-02-28 09:03:53 UTC\n \n 2024-02-28 09:04:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2620\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6002 -- 2RHZE/4RHE \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=55 and _weight <= 70 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 14:33:53',4,'2024-02-28 14:34:42',4,0,NULL,NULL,NULL,'7a53ac46-5c90-4320-83ff-2f59647d980f'),(2621,'TB patients given 2RHZE/4RHE weighing > 70','TB patients given 2RHZE/4RHE weighing > 70','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4RHE weighing > 70\n TB patients given 2RHZE/4RHE weighing > 70\n \n 2024-02-28 09:05:44 UTC\n \n 2024-02-28 09:06:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2621\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6002 -- 2RHZE/4RHE \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight > 70 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 14:35:44',4,'2024-02-28 14:36:26',4,0,NULL,NULL,NULL,'fe5b0998-1225-4b7e-b565-e15fa88e7ca7'),(2622,'TB patients given 2HPMZ/2HPM weighing 40-50kg','TB patients given 2HPMZ/2HPM weighing 40-50kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HPMZ/2HPM weighing 40-50kg\n TB patients given 2HPMZ/2HPM weighing 40-50kg\n \n 2024-02-28 09:08:25 UTC\n \n 2024-02-28 09:08:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2622\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6003 -- 2HPMZ/2HPM \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=40 and _weight < 50 \n)weight__ \nON regimen.Id = weight__.Id \n\n','2024-02-28 14:38:25',4,'2024-02-28 14:38:53',4,0,NULL,NULL,NULL,'97d1eb39-6c72-4cd7-85f2-a7667daea615'),(2623,'TB patients given 2HPMZ/2HPM weighing 50-65kg','TB patients given 2HPMZ/2HPM weighing 50-65kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HPMZ/2HPM weighing 50-65kg\n TB patients given 2HPMZ/2HPM weighing 50-65kg\n \n 2024-02-28 09:09:48 UTC\n \n 2024-02-28 09:10:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2623\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6003 -- 2HPMZ/2HPM \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=50 and _weight < 65 \n)weight__ \nON regimen.Id = weight__.Id \n\n','2024-02-28 14:39:48',4,'2024-02-28 14:40:58',4,0,NULL,NULL,NULL,'4698f622-e7a9-4dd9-8c2d-6af54419f71f'),(2624,'TB patients given 2HPMZ/2HPM weighing > 65kg','TB patients given 2HPMZ/2HPM weighing > 65kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HPMZ/2HPM weighing > 65kg\n TB patients given 2HPMZ/2HPM weighing > 65kg\n \n 2024-02-28 09:11:30 UTC\n \n 2024-02-28 09:12:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2624\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6003 -- 2HPMZ/2HPM \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=65 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 14:41:30',4,'2024-02-28 14:42:01',4,0,NULL,NULL,NULL,'707a44a5-5cd1-46d8-9880-4c4396914acc'),(2625,'TB patients given 2RHZE/4HR weighing <2kg','TB patients given 2RHZE/4HR weighing <2kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing <2kg\n TB patients given 2RHZE/4HR weighing <2kg\n \n 2024-02-28 09:16:33 UTC\n \n 2024-02-28 09:18:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2625\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6004 -- 2RHZE/4HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight < 2 \n)weight__ \nON regimen.Id = weight__.Id \n\n','2024-02-28 14:46:33',4,'2024-02-28 14:48:07',4,0,NULL,NULL,NULL,'4c663664-65db-4048-8554-4546b580ff2f'),(2626,'TB patients given 2RHZE/4HR weighing 2-2.9kg','TB patients given 2RHZE/4HR weighing 2-2.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing 2-2.9kg\n TB patients given 2RHZE/4HR weighing 2-2.9kg\n \n 2024-02-28 09:17:03 UTC\n \n 2024-02-28 09:18:56 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2626\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6004 -- 2RHZE/4HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=2 and _weight <=2.9 \n)weight__ \nON regimen.Id = weight__.Id \n\n','2024-02-28 14:47:03',4,'2024-02-28 14:48:56',4,0,NULL,NULL,NULL,'bcc6e6f5-8e74-4a51-bf4e-74f9aa16c937'),(2627,'TB patients given 2RHZE/4HR weighing 3-3.9kg','TB patients given 2RHZE/4HR weighing 3-3.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing 3-3.9kg\n TB patients given 2RHZE/4HR weighing 3-3.9kg\n \n 2024-02-28 09:17:29 UTC\n \n 2024-02-28 09:19:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2627\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6004 -- 2RHZE/4HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=3 and _weight <=3.9 \n)weight__ \nON regimen.Id = weight__.Id \n\n','2024-02-28 14:47:29',4,'2024-02-28 14:49:26',4,0,NULL,NULL,NULL,'5f931adb-9e99-4e78-a063-02bd6d424205'),(2628,'TB patients given 2RHZE/4HR weighing 4-7.9kg','TB patients given 2RHZE/4HR weighing 4-7.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing 4-7.9kg\n TB patients given 2RHZE/4HR weighing 4-7.9kg\n \n 2024-02-28 09:20:41 UTC\n \n 2024-02-28 09:22:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2628\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6004 -- 2RHZE/4HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=4 and _weight <=7.9 \n)weight__ \nON regimen.Id = weight__.Id \n\n','2024-02-28 14:50:41',4,'2024-02-28 14:52:44',4,0,NULL,NULL,NULL,'e45460ed-89cd-4be9-a60b-b3b96c18690c'),(2629,'TB patients given 2RHZE/4HR weighing 8-11.9kg','TB patients given 2RHZE/4HR weighing 8-11.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing 8-11.9kg\n TB patients given 2RHZE/4HR weighing 8-11.9kg\n \n 2024-02-28 09:21:07 UTC\n \n 2024-02-28 09:23:25 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2629\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6004 -- 2RHZE/4HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=8 and _weight <=11.9 \n)weight__ \nON regimen.Id = weight__.Id \n\n','2024-02-28 14:51:07',4,'2024-02-28 14:53:25',4,0,NULL,NULL,NULL,'abc8ec30-9c64-4b20-90d5-84d305425137'),(2630,'TB patients given 2RHZE/4HR weighing 12-15.9kg','TB patients given 2RHZE/4HR weighing 12-15.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing 12-15.9kg\n TB patients given 2RHZE/4HR weighing 12-15.9kg\n \n 2024-02-28 09:21:43 UTC\n \n 2024-02-28 09:24:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2630\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6004 -- 2RHZE/4HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=12 and _weight <=15.9 \n)weight__ \nON regimen.Id = weight__.Id \n\n','2024-02-28 14:51:43',4,'2024-02-28 14:54:08',4,0,NULL,NULL,NULL,'52ec3a8d-b3e6-41dc-aa67-2ff1a07dfd2d'),(2631,'TB patients given 2RHZE/4HR weighing 16-24.9kg','TB patients given 2RHZE/4HR weighing 16-24.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing 16-24.9kg\n TB patients given 2RHZE/4HR weighing 16-24.9kg\n \n 2024-02-28 09:24:47 UTC\n \n 2024-02-28 09:26:48 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2631\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6004 -- 2RHZE/4HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=16 and _weight <=24.9 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 14:54:47',4,'2024-02-28 14:56:48',4,0,NULL,NULL,NULL,'aaaa184e-66a3-41ee-805d-63a160e900d7'),(2632,'TB patients given 2RHZE/4HR weighing 25-<30kg','TB patients given 2RHZE/4HR weighing 25-<30kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing 25-<30kg\n TB patients given 2RHZE/4HR weighing 25-<30kg\n \n 2024-02-28 09:25:32 UTC\n \n 2024-02-28 09:27:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2632\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6004 -- 2RHZE/4HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=25 and _weight <30 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 14:55:32',4,'2024-02-28 14:57:11',4,0,NULL,NULL,NULL,'0f4326f5-cd2a-4800-a7cb-fe455816074e'),(2633,'TB patients given 2RHZE/4HR weighing 30-<35kg','TB patients given 2RHZE/4HR weighing 30-<35kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing 30-<35kg\n TB patients given 2RHZE/4HR weighing 30-<35kg\n \n 2024-02-28 09:25:58 UTC\n \n 2024-02-28 09:27:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2633\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6004 -- 2RHZE/4HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=30 and _weight <35 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 14:55:58',4,'2024-02-28 14:57:39',4,0,NULL,NULL,NULL,'a8c81b22-814f-4ec1-870c-a46e92de3ee2'),(2634,'TB patients given 2RHZE/4HR weighing 35-<50kg','TB patients given 2RHZE/4HR weighing 35-<50kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing 35-<50kg\n TB patients given 2RHZE/4HR weighing 35-<50kg\n \n 2024-02-28 09:28:44 UTC\n \n 2024-02-28 09:30:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2634\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6004 -- 2RHZE/4HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=35 and _weight <50 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 14:58:44',4,'2024-02-28 15:00:43',4,0,NULL,NULL,NULL,'780376a9-7a64-41f5-8f4d-0bcae15e9ca9'),(2635,'TB patients given 2RHZE/4HR weighing 50-<65kg','TB patients given 2RHZE/4HR weighing 50-<65kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing 50-<65kg\n TB patients given 2RHZE/4HR weighing 50-<65kg\n \n 2024-02-28 09:29:39 UTC\n \n 2024-02-28 09:31:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2635\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6004 -- 2RHZE/4HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=50 and _weight <65 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 14:59:39',4,'2024-02-28 15:01:03',4,0,NULL,NULL,NULL,'7adf4555-6be7-4db8-911c-41e8087ab25f'),(2636,'TB patients given 2RHZE/4HR weighing >65kg','TB patients given 2RHZE/4HR weighing >65kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing >65kg\n TB patients given 2RHZE/4HR weighing >65kg\n \n 2024-02-28 09:30:09 UTC\n \n 2024-02-28 09:31:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2636\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6004 -- 2RHZE/4HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=65 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:00:09',4,'2024-02-28 15:01:20',4,0,NULL,NULL,NULL,'3ba100cc-0cf9-491d-a702-3382611c1f47'),(2637,'TB patients given 2HRE/10HR weighing < 2kg','TB patients given 2HRE/10HR weighing < 2kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing < 2kg\n TB patients given 2HRE/10HR weighing < 2kg\n \n 2024-02-28 09:46:22 UTC\n \n 2024-02-28 09:47:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2637\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6006 -- 2HRE/10HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight<2 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:16:22',4,'2024-02-28 15:17:53',4,0,NULL,NULL,NULL,'c7f2046d-c7a7-4d48-9c85-2a455c7dbdc0'),(2638,'TB patients given 2HRE/10HR weighing 2-2.9kg','TB patients given 2HRE/10HR weighing 2-2.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing 2-2.9kg\n TB patients given 2HRE/10HR weighing 2-2.9kg\n \n 2024-02-28 09:46:56 UTC\n \n 2024-02-28 09:48:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2638\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6006 -- 2HRE/10HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=2 and _weight <=2.9 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:16:56',4,'2024-02-28 15:18:18',4,0,NULL,NULL,NULL,'de0d0c97-70f7-4883-bc11-e831a85a64bd'),(2639,'TB patients given 2HRE/10HR weighing 3-3.9kg','TB patients given 2HRE/10HR weighing 3-3.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing 3-3.9kg\n TB patients given 2HRE/10HR weighing 3-3.9kg\n \n 2024-02-28 09:47:20 UTC\n \n 2024-02-28 09:48:37 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2639\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6006 -- 2HRE/10HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=3 and _weight <=3.9 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:17:20',4,'2024-02-28 15:18:37',4,0,NULL,NULL,NULL,'8a6d80b4-4f5f-416d-8242-73f18ca89178'),(2640,'TB patients given 2HRE/10HR weighing 4-7.9kg','TB patients given 2HRE/10HR weighing 4-7.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing 4-7.9kg\n TB patients given 2HRE/10HR weighing 4-7.9kg\n \n 2024-02-28 09:49:19 UTC\n \n 2024-02-28 09:50:56 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2640\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6006 -- 2HRE/10HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=4 and _weight <=7.9 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:19:19',4,'2024-02-28 15:20:56',4,0,NULL,NULL,NULL,'38551c29-6e79-4f40-9411-9beecdee568e'),(2641,'TB patients given 2HRE/10HR weighing 8-11.9kg','TB patients given 2HRE/10HR weighing 8-11.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing 8-11.9kg\n TB patients given 2HRE/10HR weighing 8-11.9kg\n \n 2024-02-28 09:49:56 UTC\n \n 2024-02-28 09:51:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2641\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6006 -- 2HRE/10HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=8 and _weight <=11.9 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:19:56',4,'2024-02-28 15:21:15',4,0,NULL,NULL,NULL,'59ff1d6e-fe8b-4ca9-9b15-10937a9fa334'),(2642,'TB patients given 2HRE/10HR weighing 12-15.9kg','TB patients given 2HRE/10HR weighing 12-15.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing 12-15.9kg\n TB patients given 2HRE/10HR weighing 12-15.9kg\n \n 2024-02-28 09:50:27 UTC\n \n 2024-02-28 09:51:35 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2642\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6006 -- 2HRE/10HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=12 and _weight <=15.9 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:20:27',4,'2024-02-28 15:21:35',4,0,NULL,NULL,NULL,'1fab63d8-a077-4f3d-b679-8ea75eefc879'),(2643,'TB patients given 2HRE/10HR weighing 16-24.9kg','TB patients given 2HRE/10HR weighing 16-24.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing 16-24.9kg\n TB patients given 2HRE/10HR weighing 16-24.9kg\n \n 2024-02-28 09:52:51 UTC\n \n 2024-02-28 09:54:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2643\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6006 -- 2HRE/10HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=16 and _weight <=24.9 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:22:51',4,'2024-02-28 15:24:31',4,0,NULL,NULL,NULL,'e3ca9790-a1cc-4ede-adb2-2adf7417ef0e'),(2644,'TB patients given 2HRE/10HR weighing 25-<30kg','TB patients given 2HRE/10HR weighing 25-<30kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing 25-<30kg\n TB patients given 2HRE/10HR weighing 25-<30kg\n \n 2024-02-28 09:53:35 UTC\n \n 2024-02-28 09:54:52 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2644\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6006 -- 2HRE/10HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=25 and _weight <30 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:23:35',4,'2024-02-28 15:24:52',4,0,NULL,NULL,NULL,'61d82671-e514-447c-9f93-6ff18cefcc43'),(2645,'TB patients given 2HRE/10HR weighing 30-<35kg','TB patients given 2HRE/10HR weighing 30-<35kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing 30-<35kg\n TB patients given 2HRE/10HR weighing 30-<35kg\n \n 2024-02-28 09:53:58 UTC\n \n 2024-02-28 09:55:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2645\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6006 -- 2HRE/10HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=30 and _weight <35 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:23:58',4,'2024-02-28 15:25:23',4,0,NULL,NULL,NULL,'ba68f071-b28c-4593-9eb5-d766c4059246'),(2646,'TB patients given 2HRE/10HR weighing 35-<50kg','TB patients given 2HRE/10HR weighing 35-<50kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing 35-<50kg\n TB patients given 2HRE/10HR weighing 35-<50kg\n \n 2024-02-28 09:56:05 UTC\n \n 2024-02-28 09:57:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2646\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6006 -- 2HRE/10HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=35 and _weight <50 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:26:05',4,'2024-02-28 15:27:36',4,0,NULL,NULL,NULL,'97a65448-6d14-44c7-b5f6-c9239129cc04'),(2647,'TB patients given 2HRE/10HR weighing 50-<65kg','TB patients given 2HRE/10HR weighing 50-<65kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing 50-<65kg\n TB patients given 2HRE/10HR weighing 50-<65kg\n \n 2024-02-28 09:58:05 UTC\n \n 2024-02-28 09:59:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2647\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6006 -- 2HRE/10HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=50 and _weight <65 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:28:05',4,'2024-02-28 15:29:08',4,0,NULL,NULL,NULL,'d55f2b31-4ae3-474d-888a-e00f28cb793d'),(2648,'TB patients given 2HRE/10HR weighing > 65kg','TB patients given 2HRE/10HR weighing > 65kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing > 65kg\n TB patients given 2HRE/10HR weighing > 65kg\n \n 2024-02-28 09:58:37 UTC\n \n 2024-02-28 09:59:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2648\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6006 -- 2HRE/10HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=65 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:28:37',4,'2024-02-28 15:29:30',4,0,NULL,NULL,NULL,'1f23c88a-059b-4f38-b2eb-fc6799b4f222'),(2649,'TB patients given 2RHZE/2HR weighing < 2kg','TB patients given 2RHZE/2HR weighing < 2kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing < 2kg\n TB patients given 2RHZE/2HR weighing < 2kg\n \n 2024-02-28 10:01:29 UTC\n \n 2024-02-28 10:02:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2649\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6005 -- 2RHZE/2HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight<2 \n)weight__ \nON regimen.Id = weight__.Id \n\n','2024-02-28 15:31:29',4,'2024-02-28 15:32:50',4,0,NULL,NULL,NULL,'8d42e0e8-c79a-4f69-abc6-4fa27df65a30'),(2650,'TB patients given 2RHZE/2HR weighing 2-2.9kg','TB patients given 2RHZE/2HR weighing 2-2.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing 2-2.9kg\n TB patients given 2RHZE/2HR weighing 2-2.9kg\n \n 2024-02-28 10:01:54 UTC\n \n 2024-02-28 10:03:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2650\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6005 -- 2RHZE/2HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=2 and _weight <=2.9 \n)weight__ \nON regimen.Id = weight__.Id \n\n','2024-02-28 15:31:54',4,'2024-02-28 15:33:05',4,0,NULL,NULL,NULL,'b2fe9c79-18fe-49be-aa3c-b7bfbd65ba1c'),(2651,'TB patients given 2RHZE/2HR weighing 3-3.9kg','TB patients given 2RHZE/2HR weighing 3-3.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing 3-3.9kg\n TB patients given 2RHZE/2HR weighing 3-3.9kg\n \n 2024-02-28 10:02:16 UTC\n \n 2024-02-28 10:03:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2651\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6005 -- 2RHZE/2HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=3 and _weight <=3.9 \n)weight__ \nON regimen.Id = weight__.Id \n\n','2024-02-28 15:32:16',4,'2024-02-28 15:33:21',4,0,NULL,NULL,NULL,'22385e11-6674-42cb-9da8-78d2340fb975'),(2652,'B patients given 2RHZE/2HR weighing 4-7.9kg','B patients given 2RHZE/2HR weighing 4-7.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n B patients given 2RHZE/2HR weighing 4-7.9kg\n B patients given 2RHZE/2HR weighing 4-7.9kg\n \n 2024-02-28 10:04:18 UTC\n \n 2024-02-28 10:05:37 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2652\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6005 -- 2RHZE/2HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=4 and _weight <=7.9 \n)weight__ \nON regimen.Id = weight__.Id \n\n','2024-02-28 15:34:18',4,'2024-02-28 15:35:37',4,0,NULL,NULL,NULL,'356dbe3c-dd76-4e39-b486-3e86492b4eb0'),(2653,'B patients given 2RHZE/2HR weighing 8-11.9kg','B patients given 2RHZE/2HR weighing 8-11.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n B patients given 2RHZE/2HR weighing 8-11.9kg\n B patients given 2RHZE/2HR weighing 8-11.9kg\n \n 2024-02-28 10:04:50 UTC\n \n 2024-02-28 10:06:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2653\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6005 -- 2RHZE/2HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=8 and _weight <=11.9 \n)weight__ \nON regimen.Id = weight__.Id \n\n','2024-02-28 15:34:50',4,'2024-02-28 15:36:00',4,0,NULL,NULL,NULL,'3d88ce54-fe6f-45ec-9628-303ede656df6'),(2654,'B patients given 2RHZE/2HR weighing 12-15.9kg','B patients given 2RHZE/2HR weighing 12-15.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n B patients given 2RHZE/2HR weighing 12-15.9kg\n B patients given 2RHZE/2HR weighing 12-15.9kg\n \n 2024-02-28 10:05:14 UTC\n \n 2024-02-28 10:06:38 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2654\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6005 -- 2RHZE/2HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=12 and _weight <=15.9 \n)weight__ \nON regimen.Id = weight__.Id \n\n','2024-02-28 15:35:14',4,'2024-02-28 15:36:38',4,0,NULL,NULL,NULL,'f072dc00-cc6a-4c1d-b049-3d71fdd7c418'),(2655,'TB patients given 2RHZE/2HR weighing 4-7.9kg','TB patients given 2RHZE/2HR weighing 4-7.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing 4-7.9kg\n TB patients given 2RHZE/2HR weighing 4-7.9kg\n \n 2024-02-28 10:10:03 UTC\n \n 2024-02-28 10:11:16 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2655\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6005 -- 2RHZE/2HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=4 and _weight <=7.9 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:40:03',4,'2024-02-28 15:41:16',4,0,NULL,NULL,NULL,'5d170b44-4744-44a0-8b5c-9a147276a165'),(2656,'TB patients given 2RHZE/2HR weighing 8-11.9kg','TB patients given 2RHZE/2HR weighing 8-11.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing 8-11.9kg\n TB patients given 2RHZE/2HR weighing 8-11.9kg\n \n 2024-02-28 10:10:27 UTC\n \n 2024-02-28 10:11:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2656\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6005 -- 2RHZE/2HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=8 and _weight <=11.9 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:40:27',4,'2024-02-28 15:41:41',4,0,NULL,NULL,NULL,'4c12f685-7ba2-4a98-85d9-e8c718af019c'),(2657,'TB patients given 2RHZE/2HR weighing 12-15.9kg','TB patients given 2RHZE/2HR weighing 12-15.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing 12-15.9kg\n TB patients given 2RHZE/2HR weighing 12-15.9kg\n \n 2024-02-28 10:10:49 UTC\n \n 2024-02-28 10:11:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2657\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6005 -- 2RHZE/2HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=12 and _weight <=15.9 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:40:49',4,'2024-02-28 15:41:59',4,0,NULL,NULL,NULL,'2da2a070-b7ba-4cd7-90c5-41cddf07a601'),(2658,'TB patients given 2RHZE/2HR weighing 16-24.9kg','TB patients given 2RHZE/2HR weighing 16-24.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing 16-24.9kg\n TB patients given 2RHZE/2HR weighing 16-24.9kg\n \n 2024-02-28 10:12:34 UTC\n \n 2024-02-28 10:13:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2658\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6005 -- 2RHZE/2HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=16 and _weight <=24.9 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:42:34',4,'2024-02-28 15:43:58',4,0,NULL,NULL,NULL,'ecfd9cec-ff1f-4d86-b760-18ee712a0d36'),(2659,'TB patients given 2RHZE/2HR weighing 25-<30kg','TB patients given 2RHZE/2HR weighing 25-<30kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing 25-<30kg\n TB patients given 2RHZE/2HR weighing 25-<30kg\n \n 2024-02-28 10:13:03 UTC\n \n 2024-02-28 10:14:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2659\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6005 -- 2RHZE/2HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=25 and _weight <30 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:43:03',4,'2024-02-28 15:44:18',4,0,NULL,NULL,NULL,'66c43d8e-18e2-41e5-a0b0-501a2b508a22'),(2660,'TB patients given 2RHZE/2HR weighing 30-<35kg','TB patients given 2RHZE/2HR weighing 30-<35kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing 30-<35kg\n TB patients given 2RHZE/2HR weighing 30-<35kg\n \n 2024-02-28 10:13:24 UTC\n \n 2024-02-28 10:14:35 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2660\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6005 -- 2RHZE/2HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=30 and _weight <35 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:43:24',4,'2024-02-28 15:44:35',4,0,NULL,NULL,NULL,'362a2af4-9cdc-4380-8631-4188d1354417'),(2661,'TB patients given 2RHZE/2HR weighing 35-<50kg','TB patients given 2RHZE/2HR weighing 35-<50kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing 35-<50kg\n TB patients given 2RHZE/2HR weighing 35-<50kg\n \n 2024-02-28 10:15:06 UTC\n \n 2024-02-28 10:16:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2661\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6005 -- 2RHZE/2HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=35 and _weight <50 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:45:06',4,'2024-02-28 15:46:29',4,0,NULL,NULL,NULL,'210d7eb7-846b-42fe-a1e5-c47bc1450cb6'),(2662,'TB patients given 2RHZE/2HR weighing 50-<65kg','TB patients given 2RHZE/2HR weighing 50-<65kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing 50-<65kg\n TB patients given 2RHZE/2HR weighing 50-<65kg\n \n 2024-02-28 10:15:34 UTC\n \n 2024-02-28 10:17:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2662\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6005 -- 2RHZE/2HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=50 and _weight <65 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:45:34',4,'2024-02-28 15:47:01',4,0,NULL,NULL,NULL,'8662ce61-9594-487c-9c1c-c683a2f95180'),(2663,'TB patients given 2RHZE/2HR weighing >65kg','TB patients given 2RHZE/2HR weighing >65kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing >65kg\n TB patients given 2RHZE/2HR weighing >65kg\n \n 2024-02-28 10:16:01 UTC\n \n 2024-02-28 10:36:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2663\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6005 -- 2RHZE/2HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=65 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:46:01',4,'2024-02-28 16:06:50',4,0,NULL,NULL,NULL,'d0c91360-93f7-4b62-a335-38d1f9e8e458'),(2664,'TB patients given 2HPMZ/2HPM weighing 40-50kg','TB patients given 2HPMZ/2HPM weighing 40-50kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HPMZ/2HPM weighing 40-50kg\n TB patients given 2HPMZ/2HPM weighing 40-50kg\n \n 2024-02-28 10:38:37 UTC\n \n 2024-02-28 10:40:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2664\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 16:08:37',4,'2024-02-28 16:10:21',4,0,NULL,NULL,NULL,'267131cd-92f8-4d89-9153-7666479e3d96'),(2665,'TB patients given 2HPMZ/2HPM weighing 50-65kg','TB patients given 2HPMZ/2HPM weighing 50-65kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HPMZ/2HPM weighing 50-65kg\n TB patients given 2HPMZ/2HPM weighing 50-65kg\n \n 2024-02-28 10:40:43 UTC\n \n 2024-02-28 10:42:38 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2665\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 16:10:43',4,'2024-02-28 16:12:38',4,0,NULL,NULL,NULL,'a2cce7b4-84b0-407c-a850-045310956d08'),(2666,'TB patients given 2HPMZ/2HPM weighing > 65kg','TB patients given 2HPMZ/2HPM weighing > 65kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HPMZ/2HPM weighing > 65kg\n TB patients given 2HPMZ/2HPM weighing > 65kg\n \n 2024-02-28 10:41:20 UTC\n \n 2024-02-28 10:43:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2666\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 16:11:20',4,'2024-02-28 16:13:29',4,0,NULL,NULL,NULL,'66aa10a3-2291-4f8a-a710-af0231160982'),(2667,'TB patients given 2RHZE/4RHE weighing 30-39kg','TB patients given 2RHZE/4RHE weighing 30-39kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4RHE weighing 30-39kg\n TB patients given 2RHZE/4RHE weighing 30-39kg\n \n 2024-02-28 10:45:02 UTC\n \n 2024-02-28 10:47:52 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2667\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 16:15:02',4,'2024-02-28 16:17:52',4,0,NULL,NULL,NULL,'507430f5-598c-485d-876a-0e1dbcdaea22'),(2668,'TB patients given 2RHZE/4RHE weighing 40-54kg','TB patients given 2RHZE/4RHE weighing 40-54kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4RHE weighing 40-54kg\n TB patients given 2RHZE/4RHE weighing 40-54kg\n \n 2024-02-28 10:46:01 UTC\n \n 2024-02-28 10:48:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2668\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 16:16:01',4,'2024-02-28 16:18:15',4,0,NULL,NULL,NULL,'2d8b3440-8b64-4836-8097-0ee78b1421f9'),(2669,'TB patients given 2RHZE/4RHE weighing 55-70kg','TB patients given 2RHZE/4RHE weighing 55-70kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4RHE weighing 55-70kg\n TB patients given 2RHZE/4RHE weighing 55-70kg\n \n 2024-02-28 10:47:03 UTC\n \n COUNT\n','2024-02-28 16:17:03',4,NULL,NULL,0,NULL,NULL,NULL,'77aaf4be-b225-465a-b3dc-685757328958'),(2670,'TB patients given 2RHZE/4RHE weighing 55-70kg','TB patients given 2RHZE/4RHE weighing 55-70kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4RHE weighing 55-70kg\n TB patients given 2RHZE/4RHE weighing 55-70kg\n \n 2024-02-28 10:47:06 UTC\n \n 2024-02-28 10:49:09 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2670\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 16:17:06',4,'2024-02-28 16:19:09',4,0,NULL,NULL,NULL,'4ca65f2c-58a1-46f2-be7d-d2e0b8b52eca'),(2671,'TB patients given 2RHZE/4RHE weighing > 70','TB patients given 2RHZE/4RHE weighing > 70','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4RHE weighing > 70\n TB patients given 2RHZE/4RHE weighing > 70\n \n 2024-02-28 10:48:45 UTC\n \n 2024-02-28 10:51:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2671\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 16:18:45',4,'2024-02-28 16:21:07',4,0,NULL,NULL,NULL,'aacf0718-0185-42a7-8e9f-dc32a196d708'),(2672,'TB patients given 2RHZE/4HR weighing <2kg','TB patients given 2RHZE/4HR weighing <2kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing <2kg\n TB patients given 2RHZE/4HR weighing <2kg\n \n 2024-02-28 10:52:59 UTC\n \n 2024-02-28 10:55:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2672\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 16:22:59',4,'2024-02-28 16:25:06',4,0,NULL,NULL,NULL,'fcef6215-4d11-4edb-a132-3a001295eac7'),(2673,'TB patients given 2RHZE/4HR weighing 2-2.9kg','TB patients given 2RHZE/4HR weighing 2-2.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing 2-2.9kg\n TB patients given 2RHZE/4HR weighing 2-2.9kg\n \n 2024-02-28 10:53:34 UTC\n \n COUNT\n','2024-02-28 16:23:34',4,NULL,NULL,0,NULL,NULL,NULL,'a0f2d45a-30f4-4c5f-af64-3a6ccb151c33'),(2674,'TB patients given 2RHZE/4HR weighing 2-2.9kg','TB patients given 2RHZE/4HR weighing 2-2.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing 2-2.9kg\n TB patients given 2RHZE/4HR weighing 2-2.9kg\n \n 2024-02-28 10:53:37 UTC\n \n 2024-02-28 10:57:48 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2674\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 16:23:37',4,'2024-02-28 16:27:48',4,0,NULL,NULL,NULL,'a5aff9a2-2ff6-49ce-a1f9-5b2c07874d5c'),(2675,'TB patients given 2RHZE/4HR weighing 3-3.9kg','TB patients given 2RHZE/4HR weighing 3-3.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing 3-3.9kg\n TB patients given 2RHZE/4HR weighing 3-3.9kg\n \n 2024-02-28 10:56:04 UTC\n \n 2024-02-28 10:58:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2675\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 16:26:04',4,'2024-02-28 16:28:10',4,0,NULL,NULL,NULL,'06a8c0b0-b7a3-4443-b168-9816354d5519'),(2676,'TB patients given 2RHZE/4HR weighing 4-7.9kg','TB patients given 2RHZE/4HR weighing 4-7.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing 4-7.9kg\n TB patients given 2RHZE/4HR weighing 4-7.9kg\n \n 2024-02-28 10:57:21 UTC\n \n 2024-02-28 10:59:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2676\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 16:27:21',4,'2024-02-28 16:29:15',4,0,NULL,NULL,NULL,'fba7f805-6a0e-4a02-89fe-d8fe6491ff51'),(2677,'TB patients given 2RHZE/4HR weighing 8-11.9kg','TB patients given 2RHZE/4HR weighing 8-11.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing 8-11.9kg\n TB patients given 2RHZE/4HR weighing 8-11.9kg\n \n 2024-02-28 10:59:49 UTC\n \n 2024-02-28 11:03:52 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2677\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 16:29:49',4,'2024-02-28 16:33:52',4,0,NULL,NULL,NULL,'acb3c52b-cd20-4b33-8b0e-f8f8865d283c'),(2678,'TB patients given 2RHZE/4HR weighing 12-15.9kg','TB patients given 2RHZE/4HR weighing 12-15.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing 12-15.9kg\n TB patients given 2RHZE/4HR weighing 12-15.9kg\n \n 2024-02-28 11:00:16 UTC\n \n 2024-02-28 11:04:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2678\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 16:30:16',4,'2024-02-28 16:34:11',4,0,NULL,NULL,NULL,'af2dc223-8a19-46b1-b8ae-add6e943f891'),(2679,'TB patients given 2RHZE/4HR weighing 16-24.9kg','TB patients given 2RHZE/4HR weighing 16-24.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing 16-24.9kg\n TB patients given 2RHZE/4HR weighing 16-24.9kg\n \n 2024-02-28 11:00:43 UTC\n \n 2024-02-28 11:04:34 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2679\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 16:30:43',4,'2024-02-28 16:34:34',4,0,NULL,NULL,NULL,'693ddd70-5db7-46ba-8195-670f174b867f'),(2680,'TB patients given 2RHZE/4HR weighing 25-<30kg','TB patients given 2RHZE/4HR weighing 25-<30kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing 25-<30kg\n TB patients given 2RHZE/4HR weighing 25-<30kg\n \n 2024-02-28 11:01:10 UTC\n \n 2024-02-28 11:04:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2680\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 16:31:10',4,'2024-02-28 16:34:58',4,0,NULL,NULL,NULL,'2bd66740-4941-4932-8876-43e12c912ef0'),(2681,'TB patients given 2RHZE/4HR weighing 30-<35kg','TB patients given 2RHZE/4HR weighing 30-<35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing 30-<35kg\n TB patients given 2RHZE/4HR weighing 30-<35kg\n \n 2024-02-28 11:05:44 UTC\n \n 2024-02-28 11:08:52 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2681\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 16:35:44',4,'2024-02-28 16:38:52',4,0,NULL,NULL,NULL,'5201f808-7174-4785-b5a8-fb855cb1bc00'),(2682,'TB patients given 2RHZE/4HR weighing 35-<50kg','TB patients given 2RHZE/4HR weighing 35-<50kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing 35-<50kg\n TB patients given 2RHZE/4HR weighing 35-<50kg\n \n 2024-02-28 11:07:34 UTC\n \n 2024-02-28 11:10:34 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2682\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 16:37:34',4,'2024-02-28 16:40:34',4,0,NULL,NULL,NULL,'663aa7b1-0169-4cd3-aabb-1d33b0a54706'),(2683,'TB patients given 2RHZE/4HR weighing 50-<65kg','TB patients given 2RHZE/4HR weighing 50-<65kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing 50-<65kg\n TB patients given 2RHZE/4HR weighing 50-<65kg\n \n 2024-02-28 11:07:58 UTC\n \n 2024-02-28 11:10:49 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2683\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 16:37:58',4,'2024-02-28 16:40:49',4,0,NULL,NULL,NULL,'a07688e5-85a2-468b-9dc8-13a8c1100b47'),(2684,'TB patients given 2RHZE/4HR weighing >65kg','TB patients given 2RHZE/4HR weighing >65kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing >65kg\n TB patients given 2RHZE/4HR weighing >65kg\n \n 2024-02-28 11:08:27 UTC\n \n 2024-02-28 11:11:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2684\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 16:38:27',4,'2024-02-28 16:41:07',4,0,NULL,NULL,NULL,'70b78a75-3be5-4dc5-a191-21ce2d9621ee'),(2685,'TB patients given 2HRE/10HR weighing < 2kg','TB patients given 2HRE/10HR weighing < 2kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing < 2kg\n TB patients given 2HRE/10HR weighing < 2kg\n \n 2024-02-28 13:08:41 UTC\n \n 2024-02-28 13:14:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2685\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 18:38:41',4,'2024-02-28 18:44:55',4,0,NULL,NULL,NULL,'e8ffcdff-a39c-463b-8da6-a622ef5cefaf'),(2686,'TB patients given 2HRE/10HR weighing 2-2.9kg','TB patients given 2HRE/10HR weighing 2-2.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing 2-2.9kg\n TB patients given 2HRE/10HR weighing 2-2.9kg\n \n 2024-02-28 13:09:10 UTC\n \n 2024-02-28 13:15:22 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2686\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 18:39:10',4,'2024-02-28 18:45:22',4,0,NULL,NULL,NULL,'fd54220d-0eea-4c40-91d3-6842888ba3b5'),(2687,'TB patients given 2HRE/10HR weighing 3-3.9kg','TB patients given 2HRE/10HR weighing 3-3.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing 3-3.9kg\n TB patients given 2HRE/10HR weighing 3-3.9kg\n \n 2024-02-28 13:09:39 UTC\n \n 2024-02-28 13:16:19 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2687\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 18:39:39',4,'2024-02-28 18:46:19',4,0,NULL,NULL,NULL,'be84889c-0395-437b-9400-c2a7e8eb2ccf'),(2688,'TB patients given 2HRE/10HR weighing 4-7.9kg','TB patients given 2HRE/10HR weighing 4-7.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing 4-7.9kg\n TB patients given 2HRE/10HR weighing 4-7.9kg\n \n 2024-02-28 13:10:10 UTC\n \n 2024-02-28 13:16:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2688\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 18:40:10',4,'2024-02-28 18:46:40',4,0,NULL,NULL,NULL,'a204e666-8840-4614-bf83-af7330f68aaa'),(2689,'TB patients given 2HRE/10HR weighing 8-11.9kg','TB patients given 2HRE/10HR weighing 8-11.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing 8-11.9kg\n TB patients given 2HRE/10HR weighing 8-11.9kg\n \n 2024-02-28 13:17:57 UTC\n \n 2024-02-28 13:23:09 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2689\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 18:47:57',4,'2024-02-28 18:53:09',4,0,NULL,NULL,NULL,'139114c2-da7a-4749-89b4-e99e72994d81'),(2690,'TB patients given 2HRE/10HR weighing 12-15.9kg','TB patients given 2HRE/10HR weighing 12-15.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing 12-15.9kg\n TB patients given 2HRE/10HR weighing 12-15.9kg\n \n 2024-02-28 13:19:00 UTC\n \n 2024-02-28 13:23:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2690\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 18:49:00',4,'2024-02-28 18:53:27',4,0,NULL,NULL,NULL,'346da8a7-01a5-4c66-b438-15b66599e85d'),(2691,'TB patients given 2HRE/10HR weighing 16-24.9kg','TB patients given 2HRE/10HR weighing 16-24.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing 16-24.9kg\n TB patients given 2HRE/10HR weighing 16-24.9kg\n \n 2024-02-28 13:19:33 UTC\n \n 2024-02-28 13:23:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2691\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 18:49:33',4,'2024-02-28 18:53:55',4,0,NULL,NULL,NULL,'697a3eab-7fc5-4656-b90c-c8f503ba104e'),(2692,'TB patients given 2HRE/10HR weighing 25-<30kg','TB patients given 2HRE/10HR weighing 25-<30kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing 25-<30kg\n TB patients given 2HRE/10HR weighing 25-<30kg\n \n 2024-02-28 13:20:00 UTC\n \n 2024-02-28 13:24:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2692\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 18:50:00',4,'2024-02-28 18:54:21',4,0,NULL,NULL,NULL,'9aaeb85e-bf5b-4cfd-ac28-53cdb1bd4675'),(2693,'TB patients given 2HRE/10HR weighing 30-<35kg','TB patients given 2HRE/10HR weighing 30-<35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing 30-<35kg\n TB patients given 2HRE/10HR weighing 30-<35kg\n \n 2024-02-28 13:26:24 UTC\n \n 2024-02-28 13:30:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2693\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 18:56:24',4,'2024-02-28 19:00:36',4,0,NULL,NULL,NULL,'614b47d9-f71d-43f7-9f20-348a7341b425'),(2694,'TB patients given 2HRE/10HR weighing 35-<50kg','TB patients given 2HRE/10HR weighing 35-<50kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing 35-<50kg\n TB patients given 2HRE/10HR weighing 35-<50kg\n \n 2024-02-28 13:27:03 UTC\n \n 2024-02-28 13:30:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2694\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 18:57:03',4,'2024-02-28 19:00:58',4,0,NULL,NULL,NULL,'90a894c8-2f13-45b8-a9ff-718cc0b5d958'),(2695,'TB patients given 2HRE/10HR weighing 50-<65kg','TB patients given 2HRE/10HR weighing 50-<65kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing 50-<65kg\n TB patients given 2HRE/10HR weighing 50-<65kg\n \n 2024-02-28 13:27:34 UTC\n \n 2024-02-28 13:31:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2695\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 18:57:34',4,'2024-02-28 19:01:21',4,0,NULL,NULL,NULL,'310e9e3a-ae90-4d16-b876-81d55f05e601'),(2696,'TB patients given 2HRE/10HR weighing > 65kg','TB patients given 2HRE/10HR weighing > 65kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing > 65kg\n TB patients given 2HRE/10HR weighing > 65kg\n \n 2024-02-28 13:28:06 UTC\n \n 2024-02-28 13:31:54 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2696\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 18:58:06',4,'2024-02-28 19:01:54',4,0,NULL,NULL,NULL,'fb06b275-034c-492c-bb27-10bef23fce0d'),(2697,'TB patients given 2RHZE/2HR weighing 2-2.9kg','TB patients given 2RHZE/2HR weighing 2-2.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing 2-2.9kg\n TB patients given 2RHZE/2HR weighing 2-2.9kg\n \n 2024-02-28 13:38:38 UTC\n \n 2024-02-28 13:43:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2697\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 19:08:38',4,'2024-02-28 19:13:00',4,0,NULL,NULL,NULL,'d5432933-9558-4f54-8f6e-abc5e9a0223b'),(2698,'TB patients given 2RHZE/2HR weighing 3-3.9kg','TB patients given 2RHZE/2HR weighing 3-3.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing 3-3.9kg\n TB patients given 2RHZE/2HR weighing 3-3.9kg\n \n 2024-02-28 13:39:06 UTC\n \n 2024-02-28 13:48:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2698\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 19:09:06',4,'2024-02-28 19:18:32',4,0,NULL,NULL,NULL,'9379b271-3680-47a4-a2be-8145d4e58fa0'),(2699,'TB patients given 2RHZE/2HR weighing 4-7.9kg','TB patients given 2RHZE/2HR weighing 4-7.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing 4-7.9kg\n TB patients given 2RHZE/2HR weighing 4-7.9kg\n \n 2024-02-28 13:40:21 UTC\n \n 2024-02-28 13:48:54 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2699\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 19:10:21',4,'2024-02-28 19:18:54',4,0,NULL,NULL,NULL,'c0729714-b7a1-4c39-b44a-dd01fcb1aecc'),(2700,'TB patients given 2RHZE/2HR weighing 8-11.9kg','TB patients given 2RHZE/2HR weighing 8-11.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing 8-11.9kg\n TB patients given 2RHZE/2HR weighing 8-11.9kg\n \n 2024-02-28 13:42:30 UTC\n \n 2024-02-28 13:51:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2700\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 19:12:30',4,'2024-02-28 19:21:42',4,0,NULL,NULL,NULL,'17375042-6d27-4096-a84b-bbe596fd7580'),(2701,'TB patients given 2RHZE/2HR weighing 12-15.9kg','TB patients given 2RHZE/2HR weighing 12-15.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing 12-15.9kg\n TB patients given 2RHZE/2HR weighing 12-15.9kg\n \n 2024-02-28 14:06:02 UTC\n \n 2024-02-28 14:14:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2701\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 19:36:02',4,'2024-02-28 19:44:26',4,0,NULL,NULL,NULL,'57ab8f00-8036-404f-9365-a541b14bca39'),(2702,'TB patients given 2RHZE/2HR weighing 16-24.9kg','TB patients given 2RHZE/2HR weighing 16-24.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing 16-24.9kg\n TB patients given 2RHZE/2HR weighing 16-24.9kg\n \n 2024-02-28 14:07:12 UTC\n \n 2024-02-28 14:14:09 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2702\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 19:37:12',4,'2024-02-28 19:44:09',4,0,NULL,NULL,NULL,'385c3355-f68b-4e23-9658-503b7056e688'),(2703,'TB patients given 2RHZE/2HR weighing 25-<30kg','TB patients given 2RHZE/2HR weighing 25-<30kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing 25-<30kg\n TB patients given 2RHZE/2HR weighing 25-<30kg\n \n 2024-02-28 14:08:18 UTC\n \n 2024-02-28 14:13:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2703\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 19:38:18',4,'2024-02-28 19:43:50',4,0,NULL,NULL,NULL,'ee38e990-b599-423f-8a88-51ab26f92f1c'),(2704,'TB patients given 2RHZE/2HR weighing < 2kg','TB patients given 2RHZE/2HR weighing < 2kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing < 2kg\n TB patients given 2RHZE/2HR weighing < 2kg\n \n 2024-02-28 14:10:05 UTC\n \n 2024-02-28 14:13:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2704\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 19:40:05',4,'2024-02-28 19:43:31',4,0,NULL,NULL,NULL,'316b34a7-3579-4f2a-9c1e-59ab23cc0188'),(2705,'TB patients given 2RHZE/2HR weighing 30-<35kg','TB patients given 2RHZE/2HR weighing 30-<35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing 30-<35kg\n TB patients given 2RHZE/2HR weighing 30-<35kg\n \n 2024-02-28 14:15:59 UTC\n \n COUNT\n','2024-02-28 19:45:59',4,NULL,NULL,0,NULL,NULL,NULL,'979c7335-0622-4f85-a7cf-2b64b47c7cbf'),(2706,'TB patients given 2RHZE/2HR weighing 30-<35kg','TB patients given 2RHZE/2HR weighing 30-<35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing 30-<35kg\n TB patients given 2RHZE/2HR weighing 30-<35kg\n \n 2024-02-28 14:15:59 UTC\n \n 2024-02-28 14:19:57 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2706\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 19:45:59',4,'2024-02-28 19:49:57',4,0,NULL,NULL,NULL,'db9dc079-bbf6-42dc-958e-c7c002c4e97c'),(2707,'TB patients given 2RHZE/2HR weighing 35-<50kg','TB patients given 2RHZE/2HR weighing 35-<50kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing 35-<50kg\n TB patients given 2RHZE/2HR weighing 35-<50kg\n \n 2024-02-28 14:16:32 UTC\n \n 2024-02-28 14:19:49 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2707\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 19:46:32',4,'2024-02-28 19:49:49',4,0,NULL,NULL,NULL,'cb160b1b-14c9-4b6d-b4f5-b0287f0ee584'),(2708,'TB patients given 2RHZE/2HR weighing 50-<65kg','TB patients given 2RHZE/2HR weighing 50-<65kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing 50-<65kg\n TB patients given 2RHZE/2HR weighing 50-<65kg\n \n 2024-02-28 14:17:00 UTC\n \n 2024-02-28 14:21:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2708\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 19:47:00',4,'2024-02-28 19:51:28',4,0,NULL,NULL,NULL,'a605a26b-e6b2-4e39-8568-adea9afbe93c'),(2709,'TB patients given 2RHZE/2HR weighing >65kg','TB patients given 2RHZE/2HR weighing >65kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing >65kg\n TB patients given 2RHZE/2HR weighing >65kg\n \n 2024-02-28 14:17:28 UTC\n \n 2024-02-28 14:21:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2709\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 19:47:28',4,'2024-02-28 19:51:11',4,0,NULL,NULL,NULL,'79f70c54-0a3f-456a-bd82-f97868b651e3'),(2710,'TB Case Registration - Block 5','TB Case Registration - Block 5','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Case Registration - Block 5\n TB Case Registration - Block 5\n \n 2024-02-28 14:24:40 UTC\n \n 2024-02-28 14:25:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2710\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2024-02-28 19:54:40',4,'2024-02-28 19:55:12',4,0,NULL,NULL,NULL,'2043afe9-3ece-4901-a898-69be11ff0ac5'),(2711,'TB Case Registration - Block 5 Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Case Registration - Block 5 Data Set\n \n 2024-02-28 14:25:12 UTC\n \n 2024-02-29 09:52:37 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2711\n \n \n \n 2HPMZ_40-5\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n \n \n 2HPMZ_50-6\n \n \n \n \n \n \n \n \n \n 2HPMZ_65\n \n \n \n \n \n \n \n \n \n 2HRE/10H12\n \n \n \n \n \n \n \n \n \n 2HRE/10H16\n \n \n \n \n \n \n \n \n \n 2HRE/10H2-\n \n \n \n \n \n \n \n \n \n 2HRE/10H25\n \n \n \n \n \n \n \n \n \n 2HRE/10H3-\n \n \n \n \n \n \n \n \n \n 2HRE/10H30\n \n \n \n \n \n \n \n \n \n 2HRE/10H35\n \n \n \n \n \n \n \n \n \n 2HRE/10H4-\n \n \n \n \n \n \n \n \n \n 2HRE/10H50\n \n \n \n \n \n \n \n \n \n 2HRE/10H65\n \n \n \n \n \n \n \n \n \n 2HRE/10H8-\n \n \n \n \n \n \n \n \n \n 2HRE/10H<2\n \n \n \n \n \n \n \n \n \n 2RHZE/2H12\n \n \n \n \n \n \n \n \n \n 2RHZE/2H16\n \n \n \n \n \n \n \n \n \n 2RHZE/2H2-\n \n \n \n \n \n \n \n \n \n 2RHZE/2H25\n \n \n \n \n \n \n \n \n \n 2RHZE/2H3-\n \n \n \n \n \n \n \n \n \n 2RHZE/2H30\n \n \n \n \n \n \n \n \n \n 2RHZE/2H35\n \n \n \n \n \n \n \n \n \n 2RHZE/2H4-\n \n \n \n \n \n \n \n \n \n 2RHZE/2H50\n \n \n \n \n \n \n \n \n \n 2RHZE/2H65\n \n \n \n \n \n \n \n \n \n 2RHZE/2H8-\n \n \n \n \n \n \n \n \n \n 2RHZE/2H<2\n \n \n \n \n \n \n \n \n \n 2RHZE/4H12\n \n \n \n \n \n \n \n \n \n 2RHZE/4H16\n \n \n \n \n \n \n \n \n \n 2RHZE/4H2-\n \n \n \n \n \n \n \n \n \n 2RHZE/4H25\n \n \n \n \n \n \n \n \n \n 2RHZE/4H3-\n \n \n \n \n \n \n \n \n \n 2RHZE/4H30\n \n \n \n \n \n \n \n \n \n 2RHZE/4H35\n \n \n \n \n \n \n \n \n \n 2RHZE/4H4-\n \n \n \n \n \n \n \n \n \n 2RHZE/4H50\n \n \n \n \n \n \n \n \n \n 2RHZE/4H65\n \n \n \n \n \n \n \n \n \n 2RHZE/4H8-\n \n \n \n \n \n \n \n \n \n 2RHZE/4H<2\n \n \n \n \n \n \n \n \n \n 2RHZE/4R30\n \n \n \n \n \n \n \n \n \n 2RHZE/4R40\n \n \n \n \n \n \n \n \n \n 2RHZE/4R55\n \n \n \n \n \n \n \n \n \n 2RHZE/4R70\n \n \n \n \n \n \n \n \n \n','2024-02-28 19:55:12',4,'2024-02-29 15:22:37',4,0,NULL,NULL,NULL,'8be20f45-e610-469e-b1ba-5b16a08a151f'),(2712,'TB patients diagnosed with GeneXpert - sputum','TB patients diagnosed with GeneXpert - sputum','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients diagnosed with GeneXpert - sputum\n TB patients diagnosed with GeneXpert - sputum\n \n 2024-02-29 13:40:42 UTC\n \n 2024-02-29 13:41:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2712\n select diagnosis.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_diagnosis \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 3814 and o.value_coded = 3824 -- GeneXpert Sputum \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)diagnosis \n\n','2024-02-29 19:10:42',4,'2024-02-29 19:11:05',4,0,NULL,NULL,NULL,'d8a123a8-d4f2-454d-be8b-bb9ccd11c979'),(2713,'TB patients diagnosed with LPA','TB patients diagnosed with LPA','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients diagnosed with LPA\n TB patients diagnosed with LPA\n \n 2024-02-29 13:42:00 UTC\n \n 2024-02-29 13:42:37 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2713\n select diagnosis.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_diagnosis \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 3814 and o.value_coded = 3825 -- LPA \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)diagnosis\n','2024-02-29 19:12:00',4,'2024-02-29 19:12:37',4,0,NULL,NULL,NULL,'dbc7ab7e-b251-43e3-b9fc-78250f1dc6d2'),(2714,'TB patients diagnosed with smear microscopy','TB patients diagnosed with smear microscopy','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients diagnosed with smear microscopy\n TB patients diagnosed with smear microscopy\n \n 2024-02-29 13:47:25 UTC\n \n 2024-02-29 13:48:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2714\n select diagnosis.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_diagnosis \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 3815 and o.value_coded = 3819 -- Smear microscopy \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)diagnosis\n','2024-02-29 19:17:25',4,'2024-02-29 19:18:20',4,0,NULL,NULL,NULL,'86c13563-ee30-4fbe-9ee2-3ba5baa43b99'),(2715,'TB patients diagnosed with Culture','TB patients diagnosed with Culture','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients diagnosed with Culture\n TB patients diagnosed with Culture\n \n 2024-02-29 13:50:16 UTC\n \n 2024-02-29 13:50:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2715\n select diagnosis.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_diagnosis \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 3815 and o.value_coded = 3819 -- Smear microscopy \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)diagnosis\n','2024-02-29 19:20:16',4,'2024-02-29 19:20:55',4,0,NULL,NULL,NULL,'bb273381-7ea5-4c12-83fd-5f6e7e10e853'),(2716,'TB patients diagnosed with Culture','TB patients diagnosed with Culture','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients diagnosed with Culture\n TB patients diagnosed with Culture\n \n 2024-02-29 14:01:00 UTC\n \n 2024-02-29 14:06:16 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2716\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-29 19:31:00',4,'2024-02-29 19:36:16',4,0,NULL,NULL,NULL,'b9218e8a-e0af-48a8-8107-dcc9a9a7a066'),(2717,'TB patients diagnosed with GeneXpert - sputum','TB patients diagnosed with GeneXpert - sputum','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients diagnosed with GeneXpert - sputum\n TB patients diagnosed with GeneXpert - sputum\n \n 2024-02-29 14:10:38 UTC\n \n COUNT\n','2024-02-29 19:40:38',4,NULL,NULL,0,NULL,NULL,NULL,'3a5d9a42-ab26-4205-b5a2-f2f53ea6c5bc'),(2718,'TB patients diagnosed with GeneXpert - sputum','TB patients diagnosed with GeneXpert - sputum','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients diagnosed with GeneXpert - sputum\n TB patients diagnosed with GeneXpert - sputum\n \n 2024-02-29 14:10:40 UTC\n \n 2024-02-29 14:35:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2718\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-29 19:40:40',4,'2024-02-29 20:05:27',4,0,NULL,NULL,NULL,'a9c92543-222b-490d-bfa3-d2bcb6825eec'),(2719,'TB patients diagnosed with LPA','TB patients diagnosed with LPA','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients diagnosed with LPA\n TB patients diagnosed with LPA\n \n 2024-02-29 14:36:14 UTC\n \n 2024-02-29 14:38:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2719\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-29 20:06:14',4,'2024-02-29 20:08:26',4,0,NULL,NULL,NULL,'7b6eb2f0-56a4-4c91-81c2-1e4abb4e98d2'),(2720,'TB patients diagnosed with smear microscopy','TB patients diagnosed with smear microscopy','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients diagnosed with smear microscopy\n TB patients diagnosed with smear microscopy\n \n 2024-02-29 14:37:25 UTC\n \n 2024-02-29 14:39:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2720\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-29 20:07:25',4,'2024-02-29 20:09:11',4,0,NULL,NULL,NULL,'a27eacbd-b0a6-446f-950f-0402e720c4bb'); /*!40000 ALTER TABLE `serialized_object` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; @@ -84,4 +84,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2024-02-15 15:07:48 +-- Dump completed on 2024-02-29 20:10:22 From 87abbd5b39584d0259a2f28073a22a48523fd6d7 Mon Sep 17 00:00:00 2001 From: seapehim Date: Thu, 29 Feb 2024 17:14:55 +0200 Subject: [PATCH 2/3] Modified Block 6 --- Serialized_Object.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Serialized_Object.sql b/Serialized_Object.sql index 3e9702e..c5a85ef 100644 --- a/Serialized_Object.sql +++ b/Serialized_Object.sql @@ -47,7 +47,7 @@ CREATE TABLE `serialized_object` ( CONSTRAINT `serialized_object_changed_by` FOREIGN KEY (`changed_by`) REFERENCES `users` (`user_id`), CONSTRAINT `serialized_object_creator` FOREIGN KEY (`creator`) REFERENCES `users` (`user_id`), CONSTRAINT `serialized_object_retired_by` FOREIGN KEY (`retired_by`) REFERENCES `users` (`user_id`) -) ENGINE=InnoDB AUTO_INCREMENT=2721 DEFAULT CHARSET=utf8; +) ENGINE=InnoDB AUTO_INCREMENT=2727 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -71,7 +71,7 @@ INSERT INTO `serialized_object` VALUES (1776,' Clients given 6B weighing 25-34.9 INSERT INTO `serialized_object` VALUES (2042,'public_transport_notEvaluated','Public transport note evaluated','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n public_transport_notEvaluated\n Public transport note evaluated\n \n 2023-03-30 17:02:53 UTC\n \n 2023-03-30 17:03:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2042\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 4654 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2302,1068,2242,3650,3793,3794) \n and b.voided = 0 \n ) \n\n','2023-03-30 19:02:53',4,'2023-03-30 19:03:45',4,0,NULL,NULL,NULL,'7037beac-7eba-4b7f-a3b7-6636d1d435bd'),(2043,'TB Females and Completed','TB Females and Completed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Females and Completed\n TB Females and Completed\n \n 2023-03-30 17:07:55 UTC\n \n 2023-03-30 17:08:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2043\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- Female \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where person.gender = 'F' \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 2242 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 19:07:55',4,'2023-03-30 19:08:14',4,0,NULL,NULL,NULL,'82abec75-7c2a-4607-b3b1-b3ef5c6c4361'),(2044,'TB Females and Cured','TB Females and Cured','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Females and Cured\n TB Females and Cured\n \n 2023-03-30 17:08:50 UTC\n \n 2023-03-30 17:09:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2044\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- Female \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where person.gender = 'F' \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 1068 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 19:08:50',4,'2023-03-30 19:09:12',4,0,NULL,NULL,NULL,'f746ec4b-a949-4b53-86c8-4e1a71843d72'),(2045,'HHCM_notEvaluated','HHCM Note Evaluated','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM_notEvaluated\n HHCM Note Evaluated\n \n 2023-03-30 17:09:07 UTC\n \n 2023-03-30 17:09:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2045\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3777 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2302,1068,2242,3650,3793,3794) \n and b.voided = 0 \n ) \n\n','2023-03-30 19:09:07',4,'2023-03-30 19:09:44',4,0,NULL,NULL,NULL,'d8caa7dd-326a-46f7-97ee-f7205689bfda'),(2046,'HHCM_curred','HHCM Curred','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM_curred\n HHCM Curred\n \n 2023-03-30 17:10:16 UTC\n \n 2023-03-30 17:10:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2046\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3777 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (1068) \n and b.voided = 0 \n ) \n\n','2023-03-30 19:10:16',4,'2023-03-30 19:10:39',4,0,NULL,NULL,NULL,'ea1cc81f-9ccc-4401-80e9-57a84da98f58'),(2047,'TB Females and Died','TB Females and Died','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Females and Died\n TB Females and Died\n \n 2023-03-30 17:11:17 UTC\n \n 2023-03-30 17:11:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2047\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- Female \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where person.gender = 'F' \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3650 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 19:11:17',4,'2023-03-30 19:11:45',4,0,NULL,NULL,NULL,'f55690e5-8b8d-43ce-b797-f0f8707d1222'),(2048,'HHCM_completed','HHCM Completed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM_completed\n HHCM Completed\n \n 2023-03-30 17:12:02 UTC\n \n 2023-03-30 17:12:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2048\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3777 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2242) \n and b.voided = 0 \n ) \n\n','2023-03-30 19:12:02',4,'2023-03-30 19:12:21',4,0,NULL,NULL,NULL,'7dbf3689-913d-4883-ae4b-5be2aee4ba37'),(2049,'TB Females and Lost to Follow up','TB Females and Lost to Follow up','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Females and Lost to Follow up\n TB Females and Lost to Follow up\n \n 2023-03-30 17:12:17 UTC\n \n 2023-03-30 17:13:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2049\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- Female \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where person.gender = 'F' \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 2302 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 19:12:17',4,'2023-03-30 19:13:14',4,0,NULL,NULL,NULL,'71a12f10-af92-4eba-88f2-176a2cb3ae14'),(2050,'HHCM_died','HHCM Died','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM_died\n HHCM Died\n \n 2023-03-30 17:12:43 UTC\n \n 2023-03-30 17:13:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2050\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3777 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3650) \n and b.voided = 0 \n ) \n\n','2023-03-30 19:12:43',4,'2023-03-30 19:13:08',4,0,NULL,NULL,NULL,'87c6de2e-d87a-430b-a15e-d5de45e36410'),(2051,'HHCM_lost','HHCM Lost','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM_lost\n HHCM Lost\n \n 2023-03-30 17:13:35 UTC\n \n 2023-03-30 17:14:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2051\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3777 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2302) \n and b.voided = 0 \n ) \n\n','2023-03-30 19:13:35',4,'2023-03-30 19:14:00',4,0,NULL,NULL,NULL,'543f25df-61ec-4cec-847f-816fec3268ec'),(2052,'TB Females and Failed (Susceptible)','TB Females and Failed (Susceptible)','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Females and Failed (Susceptible)\n TB Females and Failed (Susceptible)\n \n 2023-03-30 17:14:08 UTC\n \n 2023-03-30 17:14:24 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2052\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- Female \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where person.gender = 'F' \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3793 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 19:14:08',4,'2023-03-30 19:14:24',4,0,NULL,NULL,NULL,'d1085653-8aca-440b-ae5c-d899217ef3b5'),(2053,'HHCM_moved','HHCM Moved','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM_moved\n HHCM Moved\n \n 2023-03-30 17:14:34 UTC\n \n 2023-03-30 17:14:52 UTC\n \n \n endDate\n \n java.util.Date\n true\n \n \n startDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2053\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3777 \n and ob.voided = 0 \n ) \n and o.person_id in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3794) \n and b.voided = 0 \n ) \n\n','2023-03-30 19:14:34',4,'2023-03-30 19:14:52',4,0,NULL,NULL,NULL,'43bc5260-c525-4968-a427-01e7febdfef1'),(2054,'TB Females and Moved to SecondLine','TB Females and Moved to SecondLine','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Females and Moved to SecondLine\n TB Females and Moved to SecondLine\n \n 2023-03-30 17:14:53 UTC\n \n 2023-03-30 17:15:09 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2054\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- Female \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where person.gender = 'F' \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3794 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 19:14:53',4,'2023-03-30 19:15:09',4,0,NULL,NULL,NULL,'56836385-8ef8-49a4-bdc7-e7ac24baadb9'),(2055,'TB Females and Not Evaluated','TB Females and Not Evaluated','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Females and Not Evaluated\n TB Females and Not Evaluated\n \n 2023-03-30 17:15:40 UTC\n \n 2023-03-30 17:16:46 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2055\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- Female \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where person.gender = 'F' \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id not in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded in (1068,2242,3650,2302,3793,3794) \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 19:15:40',4,'2023-03-30 19:16:46',4,0,NULL,NULL,NULL,'d1ccfc19-7910-4d71-8ba4-1b31cfbc17b7'),(2056,'FactoryWorker_failed','Factory worker failed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n FactoryWorker_failed\n Factory worker failed\n \n 2023-04-03 07:36:11 UTC\n \n 2023-04-03 07:53:38 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2056\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3669 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3793) \n and b.voided = 0 \n ) \n\n','2023-04-03 09:36:11',4,'2023-04-03 09:53:38',4,0,NULL,NULL,NULL,'43e35844-a8eb-4cc5-a3cd-445a052316c2'),(2057,'prison_worker_failed','Prison worker failed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n prison_worker_failed\n Prison worker failed\n \n 2023-04-03 07:55:07 UTC\n \n 2023-04-03 07:56:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2057\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3779 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3793) \n and b.voided = 0 \n ) \n\n','2023-04-03 09:55:07',4,'2023-04-03 09:56:27',4,0,NULL,NULL,NULL,'a4dd9267-3676-4a8b-b56b-65b8683f1ba6'),(2058,'health_worker_failed','Health Worker Failed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n health_worker_failed\n Health Worker Failed\n \n 2023-04-03 07:57:33 UTC\n \n 2023-04-03 07:58:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2058\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3670 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3793) \n and b.voided = 0 \n ) \n\n','2023-04-03 09:57:33',4,'2023-04-03 09:58:07',4,0,NULL,NULL,NULL,'da9db0e3-0d78-489c-bd35-eb7c68e345d0'),(2059,'public_transport_failed','Public Transport Failed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n public_transport_failed\n Public Transport Failed\n \n 2023-04-03 07:58:45 UTC\n \n 2023-04-03 07:59:38 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2059\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 4654 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3793) \n and b.voided = 0 \n ) \n\n','2023-04-03 09:58:45',4,'2023-04-03 09:59:38',4,0,NULL,NULL,NULL,'33f5b01b-0001-4fbd-8d76-43b6616c4824'),(2060,'HHCM_failed','HHCM Failed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM_failed\n HHCM Failed\n \n 2023-04-03 09:18:29 UTC\n \n 2023-04-03 09:19:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2060\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3777 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3793) \n and b.voided = 0 \n ) \n\n','2023-04-03 11:18:29',4,'2023-04-03 11:19:51',4,0,NULL,NULL,NULL,'60d6cef7-079a-4825-b6e1-cb4eb655b864'),(2061,'Mine Workers Cured','Mine Workers Cured','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Mine Workers Cured\n Mine Workers Cured\n \n 2023-04-03 09:18:52 UTC\n \n 2023-04-04 12:32:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2061\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- Mine Worker \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3776 and o.value_coded = 3667 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 1068 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-04-03 11:18:52',4,'2023-04-04 14:32:36',4,0,NULL,NULL,NULL,'9fffbcb9-e2f8-43d2-b6ae-b257c80ff52c'),(2062,'Mine Workers Completed','Mine Workers Completed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Mine Workers Completed\n Mine Workers Completed\n \n 2023-04-03 09:20:24 UTC\n \n 2023-04-04 12:31:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2062\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- Mine Worker \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3776 and o.value_coded = 3667 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 2242 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-04-03 11:20:24',4,'2023-04-04 14:31:40',4,0,NULL,NULL,NULL,'22a95602-7db7-453f-8af1-d3314651365b'),(2063,'HHXM_completed','HHXM Completed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM_completed\n HHXM Completed\n \n 2023-04-03 09:20:26 UTC\n \n 2023-04-03 09:21:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2063\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3778 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2242) \n and b.voided = 0 \n ) \n\n','2023-04-03 11:20:26',4,'2023-04-03 11:21:05',4,0,NULL,NULL,NULL,'bc440ff8-a03c-42b4-b082-393873e19cc5'),(2064,'HHXM_failed','HHXM Failed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM_failed\n HHXM Failed\n \n 2023-04-03 09:21:50 UTC\n \n 2023-04-03 22:08:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2064\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3778 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3793) \n and b.voided = 0 \n ) \n\n','2023-04-03 11:21:50',4,'2023-04-04 00:08:02',4,0,NULL,NULL,NULL,'168f05ac-dc2e-4c53-a38b-0d1ac6bc3f4c'),(2065,'Mine Workers Died','Mine Workers Died','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Mine Workers Died\n Mine Workers Died\n \n 2023-04-03 09:22:05 UTC\n \n 2023-04-04 12:33:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2065\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- Mine Worker \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3776 and o.value_coded = 3667 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3650 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-04-03 11:22:05',4,'2023-04-04 14:33:00',4,0,NULL,NULL,NULL,'75e3ca1f-9e04-4d1c-91ae-f79f18f650ee'),(2066,'HHXM_cured','HHXM Curred\r\n','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM_cured\n HHXM Curred \n\n \n 2023-04-03 09:22:14 UTC\n \n 2023-04-03 09:22:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2066\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3778 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (1068) \n and b.voided = 0 \n ) \n\n','2023-04-03 11:22:14',4,'2023-04-03 11:22:50',4,0,NULL,NULL,NULL,'1895c8dd-bf2c-4bd3-a48f-08770e349ffe'),(2067,'HHXM_moved','HHXM Moved','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM_moved\n HHXM Moved\n \n 2023-04-03 09:24:40 UTC\n \n 2023-04-03 09:27:22 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2067\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3778 \n and ob.voided = 0 \n ) \n and o.person_id in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3794) \n and b.voided = 0 \n ) \n\n','2023-04-03 11:24:40',4,'2023-04-03 11:27:22',4,0,NULL,NULL,NULL,'458408ac-2fc6-45e2-a884-8b8a75cf1d94'),(2068,'HHXM_lost','HHXM Lost','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM_lost\n HHXM Lost\n \n 2023-04-03 09:26:54 UTC\n \n 2023-04-03 09:27:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2068\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3778 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2302) \n and b.voided = 0 \n ) \n\n','2023-04-03 11:26:54',4,'2023-04-03 11:27:10',4,0,NULL,NULL,NULL,'20694047-0786-4ce8-922b-df3b23f39c56'),(2069,'Mine Workers Lost to Follow up','Mine Workers Lost to Follow up','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Mine Workers Lost to Follow up\n Mine Workers Lost to Follow up\n \n 2023-04-03 09:26:54 UTC\n \n 2023-04-04 12:33:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2069\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- Mine Worker \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3776 and o.value_coded = 3667 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 2302 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-04-03 11:26:54',4,'2023-04-04 14:33:39',4,0,NULL,NULL,NULL,'9406df9e-8673-48f0-81eb-21b60a5ded97'),(2070,'hhxm_notEvaluated','HHXm Not Evaluated','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n hhxm_notEvaluated\n HHXm Not Evaluated\n \n 2023-04-03 09:28:30 UTC\n \n 2023-04-03 09:29:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2070\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3778 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2302,1068,2242,3650,3793,3794) \n and b.voided = 0 \n ) \n\n','2023-04-03 11:28:30',4,'2023-04-03 11:29:51',4,0,NULL,NULL,NULL,'0bd16759-6ff9-4cbf-a0b0-8e9fd1efd1be'),(2071,'Mine Workers Failed (Susceptible)','Mine Workers Failed (Susceptible)','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Mine Workers Failed (Susceptible)\n Mine Workers Failed (Susceptible)\n \n 2023-04-03 09:33:26 UTC\n \n 2023-04-04 12:33:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2071\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- Mine Worker \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3776 and o.value_coded = 3667 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3793 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-04-03 11:33:26',4,'2023-04-04 14:33:18',4,0,NULL,NULL,NULL,'4bba1fe8-13ad-4c18-b549-f0aff1e6bc3f'),(2072,'hhxm_died','HHXM Died','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n hhxm_died\n HHXM Died\n \n 2023-04-03 09:34:30 UTC\n \n 2023-04-03 10:13:34 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2072\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3778 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3650) \n and b.voided = 0 \n ) \n\n','2023-04-03 11:34:30',4,'2023-04-03 12:13:34',4,0,NULL,NULL,NULL,'173bca27-99d3-497c-b83f-902bd3502875'),(2073,'Mine Workers Moved to Secondline Treatment','Mine Workers Moved to Secondline Treatment','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Mine Workers Moved to Secondline Treatment\n Mine Workers Moved to Secondline Treatment\n \n 2023-04-03 09:36:03 UTC\n \n 2023-04-04 12:29:57 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2073\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- Mine Worker \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3776 and o.value_coded = 3667 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3794 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-04-03 11:36:03',4,'2023-04-04 14:29:57',4,0,NULL,NULL,NULL,'7f349b74-1609-4786-a666-6f26b3e0934c'),(2074,'Mine Workers Not Evaluated','Mine Workers Not Evaluated','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Mine Workers Not Evaluated\n Mine Workers Not Evaluated\n \n 2023-04-03 09:39:03 UTC\n \n 2023-04-03 09:39:38 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2074\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- Mine Worker \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3776 and o.value_coded = 3667 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id not in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded in (1068,2302,3650,3793,2242,3794) \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-04-03 11:39:03',4,'2023-04-03 11:39:38',4,0,NULL,NULL,NULL,'3f20bdd4-03b5-48eb-be2e-3e7d96d9608f'),(2075,'New and Relapse Completed','New and Relapse Completed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n New and Relapse Completed\n New and Relapse Completed\n \n 2023-04-03 09:46:12 UTC\n \n 2023-04-03 09:50:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2075\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 11:46:12',4,'2023-04-03 11:50:04',4,0,NULL,NULL,NULL,'bf8fffec-423b-4d4f-9082-a61937680e08'),(2076,'TB New and Relapse Cured','TB New and Relapse Cured','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB New and Relapse Cured\n TB New and Relapse Cured\n \n 2023-04-03 09:54:54 UTC\n \n 2023-04-03 10:09:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2076\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 11:54:54',4,'2023-04-03 12:09:07',4,0,NULL,NULL,NULL,'cc3e6b66-c906-4723-bf8b-f1e3bd9a4f48'),(2077,'TB New and Relapse Died','TB New and Relapse Died','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB New and Relapse Died\n TB New and Relapse Died\n \n 2023-04-03 10:09:39 UTC\n \n 2023-04-03 10:26:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2077\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 12:09:39',4,'2023-04-03 12:26:07',4,0,NULL,NULL,NULL,'cdd51d3f-4922-459d-a23e-a62718354d0f'),(2078,'TB New and Relapse Lost to Follow-up','TB New and Relapse Lost to Follow-up','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB New and Relapse Lost to Follow-up\n TB New and Relapse Lost to Follow-up\n \n 2023-04-03 10:13:30 UTC\n \n 2023-04-03 10:22:25 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2078\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 12:13:30',4,'2023-04-03 12:22:25',4,0,NULL,NULL,NULL,'e63623be-d56c-4e8a-9fb8-fcbfd651b326'),(2079,'Ex Miner - Died','Ex Miner Died','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Ex Miner - Died\n Ex Miner Died\n \n 2023-04-03 10:15:01 UTC\n \n 2023-04-03 10:18:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2079\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 12:15:01',4,'2023-04-03 12:18:31',4,0,NULL,NULL,NULL,'4c0567b3-bc02-4b62-be5b-4e348a8a17d5'),(2080,'Ex Miner - Lost','Ex Miner Lost','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Ex Miner - Lost\n Ex Miner Lost\n \n 2023-04-03 10:15:38 UTC\n \n 2023-04-03 10:20:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2080\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 12:15:38',4,'2023-04-03 12:20:44',4,0,NULL,NULL,NULL,'1001e669-922a-43ba-be6c-4e909e4d7f30'),(2081,'Ex Miner - Not Evaluated','Ex Miner Not Evaluated','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Ex Miner - Not Evaluated\n Ex Miner Not Evaluated\n \n 2023-04-03 10:16:26 UTC\n \n 2023-04-03 10:25:22 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2081\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 12:16:26',4,'2023-04-03 12:25:22',4,0,NULL,NULL,NULL,'95297d99-247c-4cb1-8454-8cde32e41699'),(2082,'Ex Miner - Completed','Ex Miner - Completed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Ex Miner - Completed\n Ex Miner - Completed\n \n 2023-04-03 10:21:16 UTC\n \n 2023-04-03 10:53:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2082\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 12:21:16',4,'2023-04-03 12:53:45',4,0,NULL,NULL,NULL,'6512f126-9e67-46ba-aaab-e783a36a4efa'),(2083,'Ex Miner - Moved Second Line','Ex Miner moved second line','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Ex Miner - Moved Second Line\n Ex Miner moved second line\n \n 2023-04-03 10:22:16 UTC\n \n 2023-04-03 10:24:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2083\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 12:22:16',4,'2023-04-03 12:24:44',4,0,NULL,NULL,NULL,'7de4354e-95cb-4f66-8d40-0bd243779ee4'),(2084,'TB New and Relapse Failed (Susceptible)','TB New and Relapse Failed (Susceptible)','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB New and Relapse Failed (Susceptible)\n TB New and Relapse Failed (Susceptible)\n \n 2023-04-03 10:26:32 UTC\n \n 2023-04-03 11:24:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2084\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 12:26:32',4,'2023-04-03 13:24:51',4,0,NULL,NULL,NULL,'e3218a64-d243-48aa-9b9a-bbcda0104ae7'),(2085,'Ex Miner - Failed','Ex Miner - Failed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Ex Miner - Failed\n Ex Miner - Failed\n \n 2023-04-03 10:27:35 UTC\n \n 2023-04-03 11:24:34 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2085\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 12:27:35',4,'2023-04-03 13:24:34',4,0,NULL,NULL,NULL,'aa17ed03-51ed-4fde-8ad9-164f975ded80'),(2086,'TB New and Relapse Moved to second line treatment','TB New and Relapse Moved to second line treatment','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB New and Relapse Moved to second line treatment\n TB New and Relapse Moved to second line treatment\n \n 2023-04-03 10:27:42 UTC\n \n 2023-04-03 10:29:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2086\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 12:27:42',4,'2023-04-03 12:29:11',4,0,NULL,NULL,NULL,'687406cb-8ffe-4b7a-a806-583e78f04e48'),(2087,'Ex Miner - Cured','Ex Miner - Cured','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Ex Miner - Cured\n Ex Miner - Cured\n \n 2023-04-03 10:28:42 UTC\n \n 2023-04-04 09:25:16 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2087\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 12:28:42',4,'2023-04-04 11:25:16',4,0,NULL,NULL,NULL,'6210a6de-cdbc-411c-b9fc-e6a6bf2f42bc'),(2088,'Factory Worker - Complete','Factory Worker - Complete','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Factory Worker - Complete\n Factory Worker - Complete\n \n 2023-04-03 11:31:19 UTC\n \n 2023-04-03 11:33:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2088\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 13:31:19',4,'2023-04-03 13:33:02',4,0,NULL,NULL,NULL,'d1ce4f4f-9869-4fdd-afa5-da1899ae3815'),(2089,'Factory Worker - Cured','Factory Worker - Cured','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Factory Worker - Cured\n Factory Worker - Cured\n \n 2023-04-03 11:35:29 UTC\n \n 2023-04-03 11:37:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2089\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 13:35:29',4,'2023-04-03 13:37:51',4,0,NULL,NULL,NULL,'b92fab4d-1381-445b-abb1-1ba06b0957d4'),(2090,'Factory Worker - Died','Factory Worker - Died','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Factory Worker - Died\n Factory Worker - Died\n \n 2023-04-03 11:37:01 UTC\n \n 2023-04-03 11:39:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2090\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 13:37:01',4,'2023-04-03 13:39:08',4,0,NULL,NULL,NULL,'ef65034d-ed9d-452d-af2f-ababeecfa6ad'),(2091,'Factory Worker - Lost','Factory Worker - Lost','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Factory Worker - Lost\n Factory Worker - Lost\n \n 2023-04-03 11:38:56 UTC\n \n 2023-04-03 11:58:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2091\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 13:38:56',4,'2023-04-03 13:58:59',4,0,NULL,NULL,NULL,'a9e56df4-43a7-4387-828d-10c9dfb89245'),(2092,'Factory Worker - Not Evaluated','Factory Worker - Not Evaluated','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Factory Worker - Not Evaluated\n Factory Worker - Not Evaluated\n \n 2023-04-03 11:43:52 UTC\n \n 2023-04-03 11:59:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2092\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 13:43:52',4,'2023-04-03 13:59:10',4,0,NULL,NULL,NULL,'77cd1821-951d-42ed-a866-5f08fd800a9c'),(2093,'TB New and Relapse Not Evaluated','TB New and Relapse Not Evaluated','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB New and Relapse Not Evaluated\n TB New and Relapse Not Evaluated\n \n 2023-04-03 11:45:15 UTC\n \n 2023-04-03 11:52:49 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2093\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 13:45:15',4,'2023-04-03 13:52:49',4,0,NULL,NULL,NULL,'8c3908aa-5ac3-4dc9-9261-cdd7fc07e365'),(2094,'Retreatment excluding Relapse Completed','Retreatment excluding Relapse Completed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Retreatment excluding Relapse Completed\n Retreatment excluding Relapse Completed\n \n 2023-04-03 19:27:03 UTC\n \n 2023-04-04 12:39:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2094\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 21:27:03',4,'2023-04-04 14:39:55',4,0,NULL,NULL,NULL,'f3df3cc6-11ba-4ef1-9b6b-eba700de0818'),(2095,'Factory Worker - Moved to 2nd line','Factory Worker - Moved to 2nd line','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Factory Worker - Moved to 2nd line\n Factory Worker - Moved to 2nd line\n \n 2023-04-03 19:33:19 UTC\n \n 2023-04-03 19:35:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2095\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 21:33:19',4,'2023-04-03 21:35:06',4,0,NULL,NULL,NULL,'9ac7ec7c-6fa1-4771-8cb3-bcfca51f5e4b'),(2096,'Retreatment excluding Relapse Cured','Retreatment excluding Relapse Cured','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Retreatment excluding Relapse Cured\n Retreatment excluding Relapse Cured\n \n 2023-04-03 19:37:22 UTC\n \n 2023-04-03 19:42:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2096\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 21:37:22',4,'2023-04-03 21:42:14',4,0,NULL,NULL,NULL,'af4ccd45-738a-452f-ab0e-aa7588ecd131'),(2097,'Factory Worker - Failed','Factory Worker - Failed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Factory Worker - Failed\n Factory Worker - Failed\n \n 2023-04-03 19:44:52 UTC\n \n 2023-04-03 19:49:24 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2097\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 21:44:52',4,'2023-04-03 21:49:24',4,0,NULL,NULL,NULL,'f353300f-5673-4742-9115-c5b0b7e398e8'),(2098,'Retreatment excluding Relapse Died','Retreatment excluding Relapse Died','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Retreatment excluding Relapse Died\n Retreatment excluding Relapse Died\n \n 2023-04-03 19:48:30 UTC\n \n 2023-04-03 19:51:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2098\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 21:48:30',4,'2023-04-03 21:51:58',4,0,NULL,NULL,NULL,'ae6d7e28-203a-4141-b338-0a2faadc3662'),(2099,'Prison Worker - Died','Prison Worker - Died','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Prison Worker - Died\n Prison Worker - Died\n \n 2023-04-03 19:50:39 UTC\n \n 2023-04-03 19:53:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2099\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 21:50:39',4,'2023-04-03 21:53:44',4,0,NULL,NULL,NULL,'93b06207-6e95-4711-aa58-31c3a88ef1c0'),(2100,'Prison Worker - Cured','Prison Worker - Cured','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Prison Worker - Cured\n Prison Worker - Cured\n \n 2023-04-03 19:53:11 UTC\n \n 2023-04-03 19:54:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2100\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 21:53:11',4,'2023-04-03 21:54:43',4,0,NULL,NULL,NULL,'2f32e1d7-b41d-4bb7-89a3-80c3243e4948'),(2101,'Retreatment excluding Relapse Lost to follow up','Retreatment excluding Relapse Lost to follow up','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Retreatment excluding Relapse Lost to follow up\n Retreatment excluding Relapse Lost to follow up\n \n 2023-04-03 19:53:33 UTC\n \n 2023-04-03 19:55:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2101\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 21:53:33',4,'2023-04-03 21:55:20',4,0,NULL,NULL,NULL,'e5c0a844-b04b-40b4-99a4-32232d7a740e'),(2102,'Prison Worker - Completed','Prison Worker - Completed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Prison Worker - Completed\n Prison Worker - Completed\n \n 2023-04-03 19:55:01 UTC\n \n 2023-04-03 20:00:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2102\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 21:55:01',4,'2023-04-03 22:00:15',4,0,NULL,NULL,NULL,'a4e75f76-e839-46af-bdc6-8218f3df823c'),(2103,'Retreatment excluding Relapse Failed','Retreatment excluding Relapse Failed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Retreatment excluding Relapse Failed\n Retreatment excluding Relapse Failed\n \n 2023-04-03 19:57:02 UTC\n \n 2023-04-03 20:01:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2103\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 21:57:02',4,'2023-04-03 22:01:44',4,0,NULL,NULL,NULL,'abea75a9-417c-4570-a63e-5739c02c765e'),(2104,'Prison Worker - Not Evaluated','Prison Worker - Not Evaluated','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Prison Worker - Not Evaluated\n Prison Worker - Not Evaluated\n \n 2023-04-03 19:59:02 UTC\n \n 2023-04-03 20:00:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2104\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 21:59:02',4,'2023-04-03 22:00:31',4,0,NULL,NULL,NULL,'5f8c563b-7314-4359-8bb4-4f9d51fe2257'),(2105,'TB Treatment Outcome - Block 2','Block 2: TB/HIV Activities','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Treatment Outcome - Block 2\n Block 2: TB/HIV Activities\n \n 2023-04-03 20:01:22 UTC\n \n 2023-04-03 20:01:46 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2105\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-04-03 22:01:22',4,'2023-04-03 22:01:46',4,0,NULL,NULL,NULL,'e24dad06-5de1-4215-b021-85b95585a56b'),(2106,'TB Treatment Outcome - Block 2 Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Treatment Outcome - Block 2 Data Set\n \n 2023-04-03 20:01:46 UTC\n \n 2023-04-03 20:33:35 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2106\n \n \n DM_Sex\n \n \n \n \n \n \n \n \n ARTNw&Rl_F\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n \n \n \n ARTNw&Rl_M\n \n \n \n \n DM_Sex\n Males\n \n \n \n \n \n ARTRetr_F\n \n \n \n \n \n \n \n \n \n ARTRetr_M\n \n \n \n \n \n \n DapNw&Rl_F\n \n \n \n \n \n \n \n \n \n DapNw&Rl_M\n \n \n \n \n \n \n DapRetre_F\n \n \n \n \n \n \n \n \n \n DapRetre_M\n \n \n \n \n \n \n PosNw&Rs_F\n \n \n \n \n \n \n \n \n \n PosNw&Rs_M\n \n \n \n \n \n \n PosRetr_F\n \n \n \n \n \n \n \n \n \n PosRetr_M\n \n \n \n \n \n \n StsNw&Rs_F\n \n \n \n \n \n \n \n \n \n StsNw&Rs_M\n \n \n \n \n \n \n StsRetre_F\n \n \n \n \n \n \n StsRetre_M\n \n \n \n \n \n \n','2023-04-03 22:01:46',4,'2023-04-03 22:33:35',4,0,NULL,NULL,NULL,'5730236a-dfc3-4bf5-8f18-3769e49f4519'),(2107,'Prison Worker - Failed','Prison Worker - Failed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Prison Worker - Failed\n Prison Worker - Failed\n \n 2023-04-03 20:01:47 UTC\n \n 2023-04-03 20:07:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2107\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:01:47',4,'2023-04-03 22:07:43',4,0,NULL,NULL,NULL,'832801ab-b41b-4695-b0df-ada7c5c34ff7'),(2108,'Retreatment excluding Relapse Not Evaluated','Retreatment excluding Relapse Not Evaluated','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Retreatment excluding Relapse Not Evaluated\n Retreatment excluding Relapse Not Evaluated\n \n 2023-04-03 20:02:36 UTC\n \n 2023-04-03 20:05:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2108\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:02:36',4,'2023-04-03 22:05:10',4,0,NULL,NULL,NULL,'9c3205c9-eb03-46c1-b7e8-a0e9fa4b4738'),(2109,'Prison Worker - Moved to 2nd line','Prison Worker - Moved to 2nd line','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Prison Worker - Moved to 2nd line\n Prison Worker - Moved to 2nd line\n \n 2023-04-03 20:02:41 UTC\n \n 2023-04-03 20:05:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2109\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:02:41',4,'2023-04-03 22:05:28',4,0,NULL,NULL,NULL,'cee1771f-3491-455f-9b0a-a35e99f25454'),(2110,'Retreatment excluding Relapse Moved to Secondline Treatment','Retreatment excluding Relapse Moved to Secondline Treatment','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Retreatment excluding Relapse Moved to Secondline Treatment\n Retreatment excluding Relapse Moved to Secondline Treatment\n \n 2023-04-03 20:06:37 UTC\n \n 2023-04-03 20:20:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2110\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:06:37',4,'2023-04-03 22:20:31',4,0,NULL,NULL,NULL,'ee732817-3760-4a2d-9d61-f7009cd0b256'),(2111,'Prison Worker - Lost','Prison Worker - Lost','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Prison Worker - Lost\n Prison Worker - Lost\n \n 2023-04-03 20:07:00 UTC\n \n 2023-04-03 20:10:16 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2111\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:07:00',4,'2023-04-03 22:10:16',4,0,NULL,NULL,NULL,'bfa5d083-f2ca-4c04-a6d3-193176de6d61'),(2112,'RetreatRetreatment excluding Relapse Moved to Secondline Treatment','RetreatRetreatment excluding Relapse Moved to Secondline Treatment','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n RetreatRetreatment excluding Relapse Moved to Secondline Treatment\n RetreatRetreatment excluding Relapse Moved to Secondline Treatment\n \n 2023-04-03 20:13:03 UTC\n \n 2023-04-03 20:14:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2112\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- Retreatment excluding Relapse \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3785 and o.value_coded in (3786,1037) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3794 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-04-03 22:13:03',4,'2023-04-03 22:14:36',4,0,NULL,NULL,NULL,'2573846a-4c51-4427-bcba-7ed91d2c0835'),(2113,'Health Worker - Died','Health Worker - Died','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Health Worker - Died\n Health Worker - Died\n \n 2023-04-03 20:14:38 UTC\n \n 2023-04-03 20:16:57 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2113\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:14:38',4,'2023-04-03 22:16:57',4,0,NULL,NULL,NULL,'15cca65b-c4f6-4e32-8b7d-18cb047f999a'),(2114,'Health Worker - Cured','Health Worker - Cured','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Health Worker - Cured\n Health Worker - Cured\n \n 2023-04-03 20:16:23 UTC\n \n 2023-04-03 20:18:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2114\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:16:23',4,'2023-04-03 22:18:17',4,0,NULL,NULL,NULL,'efe0083b-cc7c-4394-bf4d-e4129ee2d998'),(2115,'Prison Worker - Completed','Prison Worker - Completed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Prison Worker - Completed\n Prison Worker - Completed\n \n 2023-04-03 20:18:34 UTC\n \n 2023-04-03 20:22:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2115\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:18:34',4,'2023-04-03 22:22:51',4,0,NULL,NULL,NULL,'685d03a5-0f34-426e-aa83-e12e209284b4'),(2116,'Prison Worker - Failed','Prison Worker - Failed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Prison Worker - Failed\n Prison Worker - Failed\n \n 2023-04-03 20:20:00 UTC\n \n 2023-04-03 20:22:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2116\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:20:00',4,'2023-04-03 22:22:29',4,0,NULL,NULL,NULL,'792e1555-e40d-4ebf-8b96-ebbaa769f859'),(2117,'All TB HIV positive Completed','All TB HIV positive Completed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV positive Completed\n All TB HIV positive Completed\n \n 2023-04-03 20:21:28 UTC\n \n 2023-04-03 20:31:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2117\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:21:28',4,'2023-04-03 22:31:15',4,0,NULL,NULL,NULL,'18f345bc-6ed0-42d6-893a-05ba98b38e16'),(2118,'All TB HIV positive Cured','All TB HIV positive Cured','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV positive Cured\n All TB HIV positive Cured\n \n 2023-04-03 20:25:37 UTC\n \n 2023-04-03 20:32:16 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2118\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:25:37',4,'2023-04-03 22:32:16',4,0,NULL,NULL,NULL,'4b6e2cd9-29b6-4f7b-8af7-0ab18e2af838'),(2119,'Health Worker - Completed','Health Worker - Completed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Health Worker - Completed\n Health Worker - Completed\n \n 2023-04-03 20:32:38 UTC\n \n 2023-04-03 20:39:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2119\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:32:38',4,'2023-04-03 22:39:58',4,0,NULL,NULL,NULL,'b38f490e-8d26-411a-9073-2a7e5d17e235'),(2120,'All TB HIV positive and Died','All TB HIV positive and Died','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV positive and Died\n All TB HIV positive and Died\n \n 2023-04-03 20:32:43 UTC\n \n 2023-04-03 20:35:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2120\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:32:43',4,'2023-04-03 22:35:39',4,0,NULL,NULL,NULL,'f0b13ce3-b836-4a27-a7a4-d1b83c1eb900'),(2121,'Health Worker - Not Evaluated','Health Worker - Not Evaluated','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Health Worker - Not Evaluated\n Health Worker - Not Evaluated\n \n 2023-04-03 20:32:56 UTC\n \n 2023-04-03 20:35:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2121\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:32:56',4,'2023-04-03 22:35:43',4,0,NULL,NULL,NULL,'9f750645-0dc4-488d-8a94-05e31d6b4838'),(2122,'All TB HIV positive and Lost to Follow Up','All TB HIV positive and Lost to Follow Up','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV positive and Lost to Follow Up\n All TB HIV positive and Lost to Follow Up\n \n 2023-04-03 20:33:45 UTC\n \n 2023-04-03 20:36:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2122\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:33:45',4,'2023-04-03 22:36:08',4,0,NULL,NULL,NULL,'21738598-0974-4f31-9925-1c9606d66410'),(2123,'All TB HIV positive and Failed','All TB HIV positive and Failed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV positive and Failed\n All TB HIV positive and Failed\n \n 2023-04-03 20:36:30 UTC\n \n 2023-04-03 20:40:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2123\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:36:30',4,'2023-04-03 22:40:18',4,0,NULL,NULL,NULL,'2a7766be-418e-4a5a-a204-c5fa91e6b672'),(2124,'All TB HIV positive and Not Evaluated','All TB HIV positive and Not Evaluated','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV positive and Not Evaluated\n All TB HIV positive and Not Evaluated\n \n 2023-04-03 20:37:09 UTC\n \n 2023-04-03 20:39:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2124\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:37:09',4,'2023-04-03 22:39:20',4,0,NULL,NULL,NULL,'04c0074a-fd87-44da-8d96-68d533e488ea'),(2125,'Health Worker - Lost','Health Worker - Lost','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Health Worker - Lost\n Health Worker - Lost\n \n 2023-04-03 20:40:25 UTC\n \n 2023-04-03 20:44:16 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2125\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:40:25',4,'2023-04-03 22:44:16',4,0,NULL,NULL,NULL,'925a50ba-435b-4213-a03b-6272a468cd01'),(2126,'All TB HIV positive and Moved to Secondline Treatment','All TB HIV positive and Moved to Secondline Treatment','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV positive and Moved to Secondline Treatment\n All TB HIV positive and Moved to Secondline Treatment\n \n 2023-04-03 20:40:57 UTC\n \n 2023-04-03 20:42:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2126\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:40:57',4,'2023-04-03 22:42:27',4,0,NULL,NULL,NULL,'6ed079c9-5ad9-4852-9523-95fddcbc9959'),(2127,'Health Worker - Failed','Health Worker - Failed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Health Worker - Failed\n Health Worker - Failed\n \n 2023-04-03 20:42:41 UTC\n \n 2023-04-03 20:52:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2127\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:42:41',4,'2023-04-03 22:52:06',4,0,NULL,NULL,NULL,'4ec08d1c-6427-44e0-b604-b960e585b190'),(2128,'All TB HIV Negative and Completed','All TB HIV Negative and Completed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Negative and Completed\n All TB HIV Negative and Completed\n \n 2023-04-03 20:43:07 UTC\n \n 2023-04-03 20:53:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2128\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:43:07',4,'2023-04-03 22:53:20',4,0,NULL,NULL,NULL,'d5786c86-ca76-43b1-b0a6-1bd90817af65'),(2129,'All TB HIV Negative and Cured','All TB HIV Negative and Cured','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Negative and Cured\n All TB HIV Negative and Cured\n \n 2023-04-03 20:44:07 UTC\n \n 2023-04-03 20:49:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2129\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:44:07',4,'2023-04-03 22:49:20',4,0,NULL,NULL,NULL,'a564539f-267c-452a-99d2-0f61f7c88c4f'),(2130,'Health Worker - Moved to 2nd line','Health Worker - Moved to 2nd line','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Health Worker - Moved to 2nd line\n Health Worker - Moved to 2nd line\n \n 2023-04-03 20:48:45 UTC\n \n 2023-04-03 20:55:46 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2130\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:48:45',4,'2023-04-03 22:55:46',4,0,NULL,NULL,NULL,'c0d08cc2-25dc-48f6-a9bc-db0d9b376d17'),(2131,'All TB HIV Negative and Died','All TB HIV Negative and Died','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Negative and Died\n All TB HIV Negative and Died\n \n 2023-04-03 20:51:50 UTC\n \n 2023-04-03 20:55:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2131\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:51:50',4,'2023-04-03 22:55:29',4,0,NULL,NULL,NULL,'b375d3b0-9817-419c-ad36-5513383a0191'),(2132,'Public Transport - Died','Public Transport - Died','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Public Transport - Died\n Public Transport - Died\n \n 2023-04-03 20:55:26 UTC\n \n 2023-04-03 20:57:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2132\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:55:26',4,'2023-04-03 22:57:21',4,0,NULL,NULL,NULL,'09f945ef-6ced-4c7c-924b-d83368e5b544'),(2133,'All TB HIV Negative and Failed','All TB HIV Negative and Failed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Negative and Failed\n All TB HIV Negative and Failed\n \n 2023-04-03 20:56:21 UTC\n \n 2023-04-03 21:00:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2133\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:56:21',4,'2023-04-03 23:00:30',4,0,NULL,NULL,NULL,'bce54b53-dea6-4664-bc35-b436a74551f0'),(2134,'All TB HIV Negative and Lost to Follow Up','All TB HIV Negative and Lost to Follow Up','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Negative and Lost to Follow Up\n All TB HIV Negative and Lost to Follow Up\n \n 2023-04-03 20:56:44 UTC\n \n 2023-04-03 21:00:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2134\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:56:44',4,'2023-04-03 23:00:04',4,0,NULL,NULL,NULL,'7b40659a-ca9a-4034-832f-5fddb0421d26'),(2135,'Public Transport - Not Evaluated','Public Transport - Not Evaluated','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Public Transport - Not Evaluated\n Public Transport - Not Evaluated\n \n 2023-04-03 20:56:54 UTC\n \n 2023-04-03 20:59:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2135\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:56:54',4,'2023-04-03 22:59:03',4,0,NULL,NULL,NULL,'0b001306-febd-4630-acb7-03fedc1eca0d'),(2136,'Public Transport - Completed','Public Transport - Completed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Public Transport - Completed\n Public Transport - Completed\n \n 2023-04-03 20:58:25 UTC\n \n 2023-04-03 21:00:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2136\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:58:25',4,'2023-04-03 23:00:42',4,0,NULL,NULL,NULL,'cb8baffc-6e41-4464-91b4-478da43820ad'),(2137,'Public Transport - Lost','Public Transport - Lost','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Public Transport - Lost\n Public Transport - Lost\n \n 2023-04-03 21:00:25 UTC\n \n 2023-04-03 21:04:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2137\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:00:25',4,'2023-04-03 23:04:00',4,0,NULL,NULL,NULL,'68abf753-d909-4d9d-866b-d707b637b5f6'),(2138,'All TB HIV Negative and Not Evaluated','All TB HIV Negative and Not Evaluated','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Negative and Not Evaluated\n All TB HIV Negative and Not Evaluated\n \n 2023-04-03 21:00:53 UTC\n \n 2023-04-03 21:02:35 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2138\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:00:53',4,'2023-04-03 23:02:35',4,0,NULL,NULL,NULL,'56fc35af-e96c-4268-b7b4-0d63610a2d06'),(2139,'All TB HIV Negative and Moved to Secondline Treatment','All TB HIV Negative and Moved to Secondline Treatment','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Negative and Moved to Secondline Treatment\n All TB HIV Negative and Moved to Secondline Treatment\n \n 2023-04-03 21:01:36 UTC\n \n 2023-04-03 21:02:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2139\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:01:36',4,'2023-04-03 23:02:58',4,0,NULL,NULL,NULL,'bdf99672-96f9-4eda-ad34-a82f5b59ffbc'),(2140,'Public Transport - Cured','Public Transport - Cured','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Public Transport - Cured\n Public Transport - Cured\n \n 2023-04-03 21:02:12 UTC\n \n 2023-04-03 21:06:24 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2140\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:02:12',4,'2023-04-03 23:06:24',4,0,NULL,NULL,NULL,'185b4be8-a666-4211-b22d-56dc426cbbcd'),(2141,'All TB Children (0-14 yrs) and Completed','All TB Children (0-14 yrs) and Completed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Children (0-14 yrs) and Completed\n All TB Children (0-14 yrs) and Completed\n \n 2023-04-03 21:03:41 UTC\n \n 2023-04-03 21:05:56 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2141\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:03:41',4,'2023-04-03 23:05:56',4,0,NULL,NULL,NULL,'eb242fe9-dde6-4baa-b92f-7a7084920dd7'),(2142,'All TB Children (0-14 yrs) and Cured','All TB Children (0-14 yrs) and Cured','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Children (0-14 yrs) and Cured\n All TB Children (0-14 yrs) and Cured\n \n 2023-04-03 21:04:01 UTC\n \n 2023-04-03 21:06:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2142\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:04:01',4,'2023-04-03 23:06:20',4,0,NULL,NULL,NULL,'88c4f217-bf94-4e84-9d4b-15f6747276ae'),(2143,'Public Transport - Moved to 2nd line','Public Transport - Moved to 2nd line','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Public Transport - Moved to 2nd line\n Public Transport - Moved to 2nd line\n \n 2023-04-03 21:05:57 UTC\n \n 2023-04-03 21:10:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2143\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:05:57',4,'2023-04-03 23:10:23',4,0,NULL,NULL,NULL,'3d87ffb3-cfb1-4ac5-bf47-dcb3193e133b'),(2144,'All TB Children (0-14 yrs) and Died','All TB Children (0-14 yrs) and Died','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Children (0-14 yrs) and Died\n All TB Children (0-14 yrs) and Died\n \n 2023-04-03 21:06:48 UTC\n \n 2023-04-03 21:08:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2144\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:06:48',4,'2023-04-03 23:08:55',4,0,NULL,NULL,NULL,'30a341a8-2bf8-4e91-a9ee-41b6826e2cef'),(2145,'Public Transport - Failed','Public Transport - Failed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Public Transport - Failed\n Public Transport - Failed\n \n 2023-04-03 21:07:43 UTC\n \n 2023-04-03 21:09:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2145\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:07:43',4,'2023-04-03 23:09:40',4,0,NULL,NULL,NULL,'e9843f95-15c2-4d15-bd2c-bdfc19bc4767'),(2146,'All TB Children (0-14 yrs) and Lost to follow up','All TB Children (0-14 yrs) and Lost to follow up','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Children (0-14 yrs) and Lost to follow up\n All TB Children (0-14 yrs) and Lost to follow up\n \n 2023-04-03 21:08:17 UTC\n \n 2023-04-03 21:16:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2146\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:08:17',4,'2023-04-03 23:16:59',4,0,NULL,NULL,NULL,'33f4111b-438c-4da8-bc56-0c588f408444'),(2147,'All TB Children (0-14 yrs) and failed','All TB Children (0-14 yrs) and failed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Children (0-14 yrs) and failed\n All TB Children (0-14 yrs) and failed\n \n 2023-04-03 21:09:49 UTC\n \n 2023-04-03 21:17:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2147\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:09:49',4,'2023-04-03 23:17:30',4,0,NULL,NULL,NULL,'af568cf8-77aa-4d45-ab4f-ca39418ba77d'),(2148,'HHCM - Completed','HHCM - Completed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM - Completed\n HHCM - Completed\n \n 2023-04-03 21:11:12 UTC\n \n 2023-04-03 21:13:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2148\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:11:12',4,'2023-04-03 23:13:17',4,0,NULL,NULL,NULL,'23d932aa-9c33-4aff-89ec-9028c25a03ef'),(2149,'All TB Children (0-14 yrs) and not evaluated','All TB Children (0-14 yrs) and not evaluated','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Children (0-14 yrs) and not evaluated\n All TB Children (0-14 yrs) and not evaluated\n \n 2023-04-03 21:12:28 UTC\n \n 2023-04-03 21:15:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2149\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:12:28',4,'2023-04-03 23:15:26',4,0,NULL,NULL,NULL,'12a47e2e-735f-4b72-9e0c-f9fc792f3fc8'),(2150,'HHCM - Failed','HHCM - Failed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM - Failed\n HHCM - Failed\n \n 2023-04-03 21:13:03 UTC\n \n 2023-04-03 21:35:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2150\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:13:03',4,'2023-04-03 23:35:08',4,0,NULL,NULL,NULL,'ce1c1a8e-9760-4a56-a885-4bc25de4f892'),(2151,'HHCM - Lost','HHCM - Lost','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM - Lost\n HHCM - Lost\n \n 2023-04-03 21:14:35 UTC\n \n 2023-04-03 21:36:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2151\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:14:35',4,'2023-04-03 23:36:26',4,0,NULL,NULL,NULL,'b9ee3b47-b5d7-42ed-9a47-4f61f77b6eeb'),(2152,'All TB Children (0-14 yrs) and moved to secondline treatment','All TB Children (0-14 yrs) and moved to secondline treatment','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Children (0-14 yrs) and moved to secondline treatment\n All TB Children (0-14 yrs) and moved to secondline treatment\n \n 2023-04-03 21:18:05 UTC\n \n 2023-04-03 21:30:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2152\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:18:05',4,'2023-04-03 23:30:14',4,0,NULL,NULL,NULL,'692b0f3e-9c3e-4a71-bba3-b6ae50963679'),(2153,'All TB Adolescent (10-19 yrs) and Completed','All TB Adolescent (10-19 yrs) and Completed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Adolescent (10-19 yrs) and Completed\n All TB Adolescent (10-19 yrs) and Completed\n \n 2023-04-03 21:27:45 UTC\n \n 2023-04-03 21:29:16 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2153\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:27:45',4,'2023-04-03 23:29:16',4,0,NULL,NULL,NULL,'ad3dbe97-3718-4885-a76d-36982b68f507'),(2154,'All TB Adolescent (10-19 yrs) and Cured','All TB Adolescent (10-19 yrs) and Cured','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Adolescent (10-19 yrs) and Cured\n All TB Adolescent (10-19 yrs) and Cured\n \n 2023-04-03 21:28:37 UTC\n \n 2023-04-03 21:30:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2154\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:28:37',4,'2023-04-03 23:30:39',4,0,NULL,NULL,NULL,'ee2cd03a-51b0-4f81-81cc-40ab687629a8'),(2155,'All TB Adolescent (10-19 yrs) and Died','All TB Adolescent (10-19 yrs) and Died','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Adolescent (10-19 yrs) and Died\n All TB Adolescent (10-19 yrs) and Died\n \n 2023-04-03 21:30:59 UTC\n \n 2023-04-03 21:33:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2155\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:30:59',4,'2023-04-03 23:33:07',4,0,NULL,NULL,NULL,'f27e06d5-38ff-443b-8ce0-3cebb07f2eec'),(2156,'All TB Adolescent (10-19 yrs) and Lost to follow up','All TB Adolescent (10-19 yrs) and Lost to follow up','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Adolescent (10-19 yrs) and Lost to follow up\n All TB Adolescent (10-19 yrs) and Lost to follow up\n \n 2023-04-03 21:31:24 UTC\n \n 2023-04-03 21:33:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2156\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:31:24',4,'2023-04-03 23:33:27',4,0,NULL,NULL,NULL,'b7f7dbd4-f089-4ac4-9bc5-4c750a016a6c'),(2157,'All TB Adolescent (10-19 yrs) and failed','All TB Adolescent (10-19 yrs) and failed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Adolescent (10-19 yrs) and failed\n All TB Adolescent (10-19 yrs) and failed\n \n 2023-04-03 21:31:48 UTC\n \n 2023-04-03 21:38:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2157\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:31:48',4,'2023-04-03 23:38:15',4,0,NULL,NULL,NULL,'6ab5cc07-88e8-4b34-9cb6-8d451336945a'),(2158,'All TB Adolescent (10-19 yrs) and Not Evaluated','All TB Adolescent (10-19 yrs) and Not Evaluated','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Adolescent (10-19 yrs) and Not Evaluated\n All TB Adolescent (10-19 yrs) and Not Evaluated\n \n 2023-04-03 21:34:28 UTC\n \n 2023-04-03 21:36:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2158\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:34:28',4,'2023-04-03 23:36:44',4,0,NULL,NULL,NULL,'4465b2b0-282f-4b7a-8acc-ba9018cf82ca'),(2159,'All TB Adolescent (10-19 yrs) and Moved to Secondline treatment','All TB Adolescent (10-19 yrs) and Moved to Secondline treatment','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Adolescent (10-19 yrs) and Moved to Secondline treatment\n All TB Adolescent (10-19 yrs) and Moved to Secondline treatment\n \n 2023-04-03 21:34:49 UTC\n \n 2023-04-03 21:37:16 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2159\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:34:49',4,'2023-04-03 23:37:16',4,0,NULL,NULL,NULL,'fc47f473-d8f7-4b44-b969-4aee12de4036'),(2160,'HHCM - Not Evaluated','HHCM - Not Evaluated','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM - Not Evaluated\n HHCM - Not Evaluated\n \n 2023-04-03 21:37:03 UTC\n \n 2023-04-03 21:42:22 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2160\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:37:03',4,'2023-04-03 23:42:22',4,0,NULL,NULL,NULL,'f801b15a-b96f-491f-a8b5-1fbee8ba9c83'),(2161,'Female and Completed','Female and Completed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Female and Completed\n Female and Completed\n \n 2023-04-03 21:37:55 UTC\n \n 2023-04-03 21:44:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2161\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:37:55',4,'2023-04-03 23:44:21',4,0,NULL,NULL,NULL,'615ab43e-7d60-462d-bab7-3ea00babd032'),(2162,'Female and Cured','Female and Cured','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Female and Cured\n Female and Cured\n \n 2023-04-03 21:38:38 UTC\n \n 2023-04-03 21:46:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2162\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:38:38',4,'2023-04-03 23:46:42',4,0,NULL,NULL,NULL,'807438e3-b735-4310-9e68-24f15521e66d'),(2163,'HHCM - Cured','HHCM - Cured','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM - Cured\n HHCM - Cured\n \n 2023-04-03 21:38:56 UTC\n \n 2023-04-03 21:42:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2163\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:38:56',4,'2023-04-03 23:42:00',4,0,NULL,NULL,NULL,'352d4e3a-8ea5-4848-a515-ea4a3a091d8f'),(2164,'TB Female and Died','TB Female and Died','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Female and Died\n TB Female and Died\n \n 2023-04-03 21:39:57 UTC\n \n 2023-04-03 21:47:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2164\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:39:57',4,'2023-04-03 23:47:30',4,0,NULL,NULL,NULL,'ab84625a-199b-4a80-99b9-9b89c8c02ba4'),(2165,'HHCM - Died','HHCM - Died','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM - Died\n HHCM - Died\n \n 2023-04-03 21:43:38 UTC\n \n 2023-04-03 21:46:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2165\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:43:38',4,'2023-04-03 23:46:59',4,0,NULL,NULL,NULL,'144c7351-4092-442d-ab8d-91cf1d13698c'),(2166,'HHCM - Moved to 2nd line','HHCM - Moved to 2nd line','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM - Moved to 2nd line\n HHCM - Moved to 2nd line\n \n 2023-04-03 21:44:32 UTC\n \n 2023-04-03 21:48:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2166\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:44:32',4,'2023-04-03 23:48:15',4,0,NULL,NULL,NULL,'a7391f1f-e1b2-415c-bde5-52d06b5616ad'),(2167,'TB Female and Lost to Follow up','TB Female and Lost to Follow up','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Female and Lost to Follow up\n TB Female and Lost to Follow up\n \n 2023-04-03 21:46:14 UTC\n \n 2023-04-03 21:48:16 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2167\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:46:14',4,'2023-04-03 23:48:16',4,0,NULL,NULL,NULL,'6ad8a1fc-9753-4d52-b40a-68c6c9089141'),(2168,'TB Female and Failed','TB Female and Failed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Female and Failed\n TB Female and Failed\n \n 2023-04-03 21:47:53 UTC\n \n 2023-04-03 21:49:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2168\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:47:53',4,'2023-04-03 23:49:44',4,0,NULL,NULL,NULL,'676800f0-5583-436b-b7ab-815f7d884f96'),(2169,'TB Female and Not Evaluated','TB Female and Not Evaluated','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Female and Not Evaluated\n TB Female and Not Evaluated\n \n 2023-04-03 21:48:58 UTC\n \n 2023-04-03 21:53:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2169\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:48:58',4,'2023-04-03 23:53:30',4,0,NULL,NULL,NULL,'67a2aa65-3b21-45f8-bdba-fe284d683360'),(2170,'TB Female and moved to secondline','TB Female and moved to secondline','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Female and moved to secondline\n TB Female and moved to secondline\n \n 2023-04-03 21:49:27 UTC\n \n 2023-04-03 21:51:19 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2170\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:49:27',4,'2023-04-03 23:51:19',4,0,NULL,NULL,NULL,'eac53c81-f295-41ae-989d-26f66888caae'),(2171,'HHXM - Completed','HHXM - Completed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM - Completed\n HHXM - Completed\n \n 2023-04-03 21:51:36 UTC\n \n 2023-04-03 21:56:49 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2171\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:51:36',4,'2023-04-03 23:56:49',4,0,NULL,NULL,NULL,'558ce9d9-35d7-4d49-8b41-f4c8cc979bdf'),(2172,'HHXM - Cured','HHXM - Cured','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM - Cured\n HHXM - Cured\n \n 2023-04-03 21:51:55 UTC\n \n 2023-04-03 21:57:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2172\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:51:55',4,'2023-04-03 23:57:44',4,0,NULL,NULL,NULL,'56f5154b-cb21-456b-8e13-508a0dc032ff'),(2173,'TB Mine Workers and completed','TB Mine Workers and completed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Mine Workers and completed\n TB Mine Workers and completed\n \n 2023-04-03 21:53:08 UTC\n \n 2023-04-03 21:56:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2173\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:53:08',4,'2023-04-03 23:56:07',4,0,NULL,NULL,NULL,'a54130b0-7643-4865-9a0e-6c70215d3046'),(2174,'TB Mine Workers and cured','TB Mine Workers and cured','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Mine Workers and cured\n TB Mine Workers and cured\n \n 2023-04-03 21:53:49 UTC\n \n 2023-04-03 21:57:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2174\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:53:49',4,'2023-04-03 23:57:45',4,0,NULL,NULL,NULL,'f5957799-79ad-4f08-9a68-c359c4b69ce3'),(2175,'TB Mine Workers and died','TB Mine Workers and died','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Mine Workers and died\n TB Mine Workers and died\n \n 2023-04-03 21:55:02 UTC\n \n 2023-04-03 21:57:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2175\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:55:02',4,'2023-04-03 23:57:23',4,0,NULL,NULL,NULL,'fc3c4c67-738d-403a-9584-bd4a17942c24'),(2176,'HHXM - Died','HHXM - Died','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM - Died\n HHXM - Died\n \n 2023-04-03 21:56:35 UTC\n \n 2023-04-03 21:59:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2176\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:56:35',4,'2023-04-03 23:59:44',4,0,NULL,NULL,NULL,'2aaeab53-7906-480f-a51b-ebc9077a28ac'),(2177,'TB Mine Workers and lost to follow up','TB Mine Workers and lost to follow up','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Mine Workers and lost to follow up\n TB Mine Workers and lost to follow up\n \n 2023-04-03 21:58:16 UTC\n \n 2023-04-03 22:05:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2177\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:58:16',4,'2023-04-04 00:05:17',4,0,NULL,NULL,NULL,'2d37e108-26d4-4c69-aa41-dbcb4298d209'),(2178,'HHXM - Not Evaluated','HHXM - Not Evaluated','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM - Not Evaluated\n HHXM - Not Evaluated\n \n 2023-04-03 21:58:28 UTC\n \n 2023-04-03 22:01:46 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2178\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:58:28',4,'2023-04-04 00:01:46',4,0,NULL,NULL,NULL,'ffa409cc-0ce1-4ca0-9971-e339c3d29f8c'),(2179,'TB Mine Workers and failed','TB Mine Workers and failed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Mine Workers and failed\n TB Mine Workers and failed\n \n 2023-04-03 21:58:31 UTC\n \n 2023-04-03 22:00:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2179\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:58:31',4,'2023-04-04 00:00:58',4,0,NULL,NULL,NULL,'f866bee9-323a-4a71-8e35-94cceaa3550d'),(2180,'TB Mine Workers and not evaluated','TB Mine Workers and not evaluated','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Mine Workers and not evaluated\n TB Mine Workers and not evaluated\n \n 2023-04-03 21:58:52 UTC\n \n 2023-04-03 22:04:47 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2180\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:58:52',4,'2023-04-04 00:04:47',4,0,NULL,NULL,NULL,'b2a2038e-f629-45ee-8033-f797caa6ac39'),(2181,'HHXM - Lost','HHXM - Lost','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM - Lost\n HHXM - Lost\n \n 2023-04-03 22:00:45 UTC\n \n 2023-04-03 22:04:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2181\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-04 00:00:45',4,'2023-04-04 00:04:15',4,0,NULL,NULL,NULL,'11bcf608-b1dd-492d-ba8a-cd3c9e19748f'),(2182,'HHXM - Failed','HHXM - Failed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM - Failed\n HHXM - Failed\n \n 2023-04-03 22:01:29 UTC\n \n 2023-04-03 22:11:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2182\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-04 00:01:29',4,'2023-04-04 00:11:06',4,0,NULL,NULL,NULL,'a10dc54c-654e-4f57-9df8-be1b14c50a14'),(2183,'TB Mine Workers and moved to secondline ','TB Mine Workers and moved to secondline ','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Mine Workers and moved to secondline \n TB Mine Workers and moved to secondline \n \n 2023-04-03 22:02:20 UTC\n \n 2023-04-03 22:11:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2183\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${endDate}\n \n \n \n','2023-04-04 00:02:20',4,'2023-04-04 00:11:10',4,0,NULL,NULL,NULL,'e07ad771-1ec2-4d4a-a085-5433cc94b7de'),(2184,'HHXM - Moved to 2nd Line','HHXM - Moved to 2nd Line','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM - Moved to 2nd Line\n HHXM - Moved to 2nd Line\n \n 2023-04-03 22:03:46 UTC\n \n 2023-04-03 22:08:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2184\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-04 00:03:46',4,'2023-04-04 00:08:51',4,0,NULL,NULL,NULL,'b12d1160-3ba1-4b39-92b9-e765d0d9fe55'),(2185,'TB Treatment Outcome - Block 1','TB Treatment Outcome - Block 1','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Treatment Outcome - Block 1\n TB Treatment Outcome - Block 1\n \n 2023-04-03 22:07:23 UTC\n \n 2023-04-03 22:07:54 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2185\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-04-04 00:07:23',4,'2023-04-04 00:07:54',4,0,NULL,NULL,NULL,'a7cfcef1-57f5-4fbc-8a24-77fac2b219bf'),(2186,'TB Treatment Outcome - Block 1 Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Treatment Outcome - Block 1 Data Set\n \n 2023-04-03 22:07:54 UTC\n \n 2023-04-04 12:21:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2186\n \n \n \n Fmale2nd\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n \n \n FmaleComp\n \n \n \n \n \n \n \n \n \n FmaleCured\n \n \n \n \n \n \n \n \n \n FmaleDied\n \n \n \n \n \n \n \n \n \n FmaleFaile\n \n \n \n \n \n \n \n \n \n FmaleLost\n \n \n \n \n \n \n \n \n \n FmaleNtEv\n \n \n \n \n \n \n \n \n \n Miner2nd\n \n \n \n \n \n \n \n \n \n MinerComp\n \n \n \n \n \n \n \n \n \n MinerCured\n \n \n \n \n \n \n \n \n \n MinerDied\n \n \n \n \n \n \n \n \n \n MinerFail\n \n \n \n \n \n \n \n \n \n MinerLost\n \n \n \n \n \n \n \n \n \n MinerNtEv\n \n \n \n \n \n \n \n \n \n NwRlps2nd\n \n \n \n \n \n \n \n \n \n NwRlpsComp\n \n \n \n \n \n \n \n \n \n NwRlpsCure\n \n \n \n \n \n \n \n \n \n NwRlpsDied\n \n \n \n \n \n \n \n \n \n NwRlpsLost\n \n \n \n \n \n \n \n \n \n NwRlpsNtEv\n \n \n \n \n \n \n \n \n \n NwRlpsfail\n \n \n \n \n \n \n \n \n \n RtrtEx2nd\n \n \n \n \n \n \n \n \n \n RtrtExComp\n \n \n \n \n \n \n \n \n \n RtrtExCure\n \n \n \n \n \n \n \n \n \n RtrtExDied\n \n \n \n \n \n \n \n \n \n RtrtExFail\n \n \n \n \n \n \n \n \n \n RtrtExLost\n \n \n \n \n \n \n \n \n \n RtrtExNtEv\n \n \n \n \n \n \n \n \n \n TBAdol2nd\n \n \n \n \n \n \n \n \n \n TBAdolComp\n \n \n \n \n \n \n \n \n \n TBAdolCure\n \n \n \n \n \n \n \n \n \n TBAdolDied\n \n \n \n \n \n \n \n \n \n TBAdolFail\n \n \n \n \n \n \n \n \n \n TBAdolLost\n \n \n \n \n \n \n \n \n \n TBAdolNtEv\n \n \n \n \n \n \n \n \n \n TBChld2nd\n \n \n \n \n \n \n \n \n \n TBChldCure\n \n \n \n \n \n \n \n \n \n TBChldDied\n \n \n \n \n \n \n \n \n \n TBChldFail\n \n \n \n \n \n \n \n \n \n TBChldLost\n \n \n \n \n \n \n \n \n \n TBChldNtEv\n \n \n \n \n \n \n \n \n \n TBNeg2nd\n \n \n \n \n \n \n \n \n \n TBNegCompl\n \n \n \n \n \n \n \n \n \n TBNegCured\n \n \n \n \n \n \n \n \n \n TBNegDied\n \n \n \n \n \n \n \n \n \n TBNegFaile\n \n \n \n \n \n \n \n \n \n TBNegLost\n \n \n \n \n \n \n \n \n \n TBNegNtEv\n \n \n \n \n \n \n \n \n \n TBPos2nd\n \n \n \n \n \n \n \n \n \n TBPosCompl\n \n \n \n \n \n \n \n \n \n TBPosCured\n \n \n \n \n \n \n \n \n \n TBPosDied\n \n \n \n \n \n \n \n \n \n TBPosFaile\n \n \n \n \n \n \n \n \n \n TBPosLost\n \n \n \n \n \n \n \n \n \n TBPosNtEv\n \n \n \n \n \n \n \n \n \n TbChldComp\n \n \n \n \n \n \n \n \n \n exM_comple\n \n \n \n \n \n \n \n \n \n exM_cured\n \n \n \n \n \n \n \n \n \n exM_died\n \n \n \n \n \n \n \n \n \n exM_failed\n \n \n \n \n \n \n \n \n \n exM_lost\n \n \n \n \n \n \n \n \n \n exM_moved\n \n \n \n \n \n \n \n \n \n exM_noteEv\n \n \n \n \n \n \n \n \n \n fact_Died\n \n \n \n \n \n \n \n \n \n fact_compl\n \n \n \n \n \n \n \n \n \n fact_cured\n \n \n \n \n \n \n fact_fail\n \n \n \n \n \n \n \n \n \n fact_lost\n \n \n \n \n \n \n \n \n \n fact_moved\n \n \n \n \n \n \n \n \n \n fact_notEv\n \n \n \n \n \n \n \n \n \n hcw_comple\n \n \n \n \n \n \n \n \n \n hcw_cured\n \n \n \n \n \n \n \n \n \n hcw_died\n \n \n \n \n \n \n \n \n \n hcw_failed\n \n \n \n \n \n \n \n \n \n hcw_lost\n \n \n \n \n \n \n \n \n \n hcw_moved\n \n \n \n \n \n \n \n \n \n hcw_notEva\n \n \n \n \n \n \n \n \n \n hhcm_compl\n \n \n \n \n \n \n \n \n \n hhcm_cured\n \n \n \n \n \n \n \n \n \n hhcm_died\n \n \n \n \n \n \n \n \n \n hhcm_evalu\n \n \n \n \n \n \n \n \n \n hhcm_faile\n \n \n \n \n \n \n \n \n \n hhcm_lost\n \n \n \n \n \n \n \n \n \n hhcm_moved\n \n \n \n \n \n \n \n \n \n hhx_comple\n \n \n \n \n \n \n \n \n \n hhxm_cured\n \n \n \n \n \n \n \n \n \n hhxm_died\n \n \n \n \n \n \n \n \n \n hhxm_faile\n \n \n \n \n \n \n \n \n \n hhxm_lost\n \n \n \n \n \n \n \n \n \n hhxm_moved\n \n \n \n \n \n \n \n \n \n hhxm_notEv\n \n \n \n \n \n \n \n \n \n ptran_comp\n \n \n \n \n \n \n \n \n \n ptran_cure\n \n \n \n \n \n \n \n \n \n ptran_died\n \n \n \n \n \n \n \n \n \n ptran_eval\n \n \n \n \n \n \n \n \n \n ptran_fail\n \n \n \n \n \n \n \n \n \n ptran_lost\n \n \n \n \n \n \n \n \n \n ptran_move\n \n \n \n \n \n \n \n \n \n','2023-04-04 00:07:54',4,'2023-04-04 14:21:10',4,0,NULL,NULL,NULL,'71fbb539-96d9-420c-9b3c-1edeab07e722'),(2187,'Children ARV Regimen_1stLine_4C','Children ARV Regimen_1stLine_Regimen disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4C\n Children ARV Regimen_1stLine_Regimen disaggregated by weight, sex, age\n \n 2023-07-26 13:30:34 UTC\n \n 2023-07-26 13:32:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2187\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-07-26 13:30:34',4,'2023-07-26 13:32:50',4,0,NULL,NULL,NULL,'f97eba59-b593-4225-8140-5bbe62c4a836'),(2188,'Children ARV Regimen_1stLine_4D','Children ARV Regimen_1stLine_4D disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4D\n Children ARV Regimen_1stLine_4D disaggregated by weight, sex, age\n \n 2023-07-26 13:30:39 UTC\n \n 2023-07-27 13:48:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2188\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-07-26 15:30:39',4,'2023-07-27 15:48:06',4,0,NULL,NULL,NULL,'f0f167bb-dc9e-4121-9ceb-a2268861062f'),(2189,'Children ARV Regimen_1stLine_Transition Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_Transition Data Set\n \n 2023-07-26 13:31:12 UTC\n \n 2023-08-14 12:41:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2189\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4>=35\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4y10-13\n \n \n \n \n \n \n \n \n \n F1-4y14-19\n \n \n \n \n \n \n \n \n \n F1-4y20-24\n \n \n \n \n \n \n \n \n \n F1-4y25-34\n \n \n \n \n \n \n \n \n \n F1-4yr0-3\n \n \n \n \n \n \n \n \n \n F1-4yr4-5\n \n \n \n \n \n \n \n \n \n F1-4yr6-9\n \n \n \n \n \n \n \n \n \n F10-14y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14y10-\n \n \n \n \n \n \n F10-14y14-\n \n \n \n \n \n \n F10-14y20-\n \n \n \n \n \n \n F10-14y25-\n \n \n \n \n \n \n F10-14y4-5\n \n \n \n \n \n \n F10-14y6-9\n \n \n \n \n \n \n F10-14y>=3\n \n \n \n \n \n \n F5-9y10-13\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9y14-19\n \n \n \n \n \n \n F5-9y20-24\n \n \n \n \n \n \n F5-9y25-34\n \n \n \n \n \n \n F5-9y>=35\n \n \n \n \n \n \n F5-9yr0-3\n \n \n \n \n \n \n F5-9yr4-5\n \n \n \n \n \n \n F5-9yr6-9\n \n \n \n \n \n \n F<1y10-13\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1y14-19\n \n \n \n \n \n \n F<1y20-24\n \n \n \n \n \n \n F<1y25-34\n \n \n \n \n \n \n F<1y>=35\n \n \n \n \n \n \n F<1yr0-3\n \n \n \n \n \n \n F<1yr4-5\n \n \n \n \n \n \n F<1yr6-9\n \n \n \n \n \n \n M1-4y10-13\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4y14-19\n \n \n \n \n \n \n M1-4y20-24\n \n \n \n \n \n \n M1-4y25-34\n \n \n \n \n \n \n M1-4y>=35\n \n \n \n \n \n \n M1-4yr0-3\n \n \n \n \n \n \n M1-4yr4-5\n \n \n \n \n \n \n M1-4yr6-9\n \n \n \n \n \n \n M10-14y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14y10-\n \n \n \n \n \n \n M10-14y14-\n \n \n \n \n \n \n M10-14y20-\n \n \n \n \n \n \n M10-14y25-\n \n \n \n \n \n \n M10-14y4-5\n \n \n \n \n \n \n M10-14y6-9\n \n \n \n \n \n \n M10-14y>=3\n \n \n \n \n \n \n M5-9y10-13\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9y14-19\n \n \n \n \n \n \n M5-9y20-24\n \n \n \n \n \n \n M5-9y25-34\n \n \n \n \n \n \n M5-9y>=35\n \n \n \n \n \n \n M5-9yr0-3\n \n \n \n \n \n \n M5-9yr4-5\n \n \n \n \n \n \n M5-9yr6-9\n \n \n \n \n \n \n M<1y14-19\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1y20-24\n \n \n \n \n \n \n M<1y25-34\n \n \n \n \n \n \n M<1y>=35\n \n \n \n \n \n \n M<1yr0-3\n \n \n \n \n \n \n M<1yr10-13\n \n \n \n \n \n \n M<1yr4-5\n \n \n \n \n \n \n M<1yr6-9\n \n \n \n \n \n \n','2023-07-26 13:31:12',4,'2023-08-14 12:41:44',4,0,NULL,NULL,NULL,'da04bec0-be82-45a6-9136-716f46837537'),(2190,'Children ARV Regimen_1stLine_Transition Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_Transition Data Set\n \n 2023-07-26 13:31:22 UTC\n \n 2023-08-14 13:10:49 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2190\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4yr0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4yr10-1\n \n \n \n \n \n \n \n \n \n F1-4yr14-1\n \n \n \n \n \n \n \n \n \n F1-4yr20-2\n \n \n \n \n \n \n \n \n \n F1-4yr25-3\n \n \n \n \n \n \n \n \n \n F1-4yr4-5\n \n \n \n \n \n \n \n \n \n F1-4yr6-9\n \n \n \n \n \n \n \n \n \n F1-4yr>=35\n \n \n \n \n \n \n \n \n \n F10-14yr0-\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14yr10\n \n \n \n \n \n \n F10-14yr14\n \n \n \n \n \n \n F10-14yr20\n \n \n \n \n \n \n F10-14yr25\n \n \n \n \n \n \n F10-14yr35\n \n \n \n \n \n \n F10-14yr4-\n \n \n \n \n \n \n F10-14yr6-\n \n \n \n \n \n \n F5-9yr0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9yr10-1\n \n \n \n \n \n \n F5-9yr14-1\n \n \n \n \n \n \n F5-9yr20-2\n \n \n \n \n \n \n F5-9yr25-3\n \n \n \n \n \n \n F5-9yr4-5\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9yr6-9\n \n \n \n \n \n \n F5-9yr>=35\n \n \n \n \n \n \n F<1yr0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1yr10-13\n \n \n \n \n \n \n F<1yr14-19\n \n \n \n \n \n \n F<1yr20-14\n \n \n \n \n \n \n F<1yr25-34\n \n \n \n \n \n \n F<1yr4-5\n \n \n \n \n \n \n F<1yr6-9\n \n \n \n \n \n \n F<1yr>=35\n \n \n \n \n \n \n M1-4yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4yr10-1\n \n \n \n \n \n \n M1-4yr14-1\n \n \n \n \n \n \n M1-4yr20-2\n \n \n \n \n \n \n M1-4yr25-3\n \n \n \n \n \n \n M1-4yr4-5\n \n \n \n \n \n \n M1-4yr6-9\n \n \n \n \n \n \n M1-4yr>=35\n \n \n \n \n \n \n M10-14yr0-\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14yr10\n \n \n \n \n \n \n M10-14yr14\n \n \n \n \n \n \n M10-14yr20\n \n \n \n \n \n \n M10-14yr25\n \n \n \n \n \n \n M10-14yr35\n \n \n \n \n \n \n M10-14yr4-\n \n \n \n \n \n \n M10-14yr6-\n \n \n \n \n \n \n M5-9yr0-3\n \n \n \n \n \n \n M5-9yr10-1\n \n \n \n \n \n \n M5-9yr14-1\n \n \n \n \n \n \n M5-9yr20-2\n \n \n \n \n \n \n M5-9yr25-3\n \n \n \n \n \n \n M5-9yr4-5\n \n \n \n \n \n \n M5-9yr6-9\n \n \n \n \n \n \n M5-9yr>=35\n \n \n \n \n \n \n M<1yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1yr10-13\n \n \n \n \n \n \n M<1yr14-19\n \n \n \n \n \n \n M<1yr20-24\n \n \n \n \n \n \n M<1yr25-34\n \n \n \n \n \n \n M<1yr4-5\n \n \n \n \n \n \n M<1yr6-9\n \n \n \n \n \n \n M<1yr>=35\n \n \n \n \n \n \n','2023-07-26 13:31:22',4,'2023-08-14 13:10:49',4,0,NULL,NULL,NULL,'5de7def7-e11b-404b-b30a-1dd8dab09558'),(2191,'Children ARV Regimen_1stLine_4E','Children ARV Regimen_1stLine_4E','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4E\n Children ARV Regimen_1stLine_4E\n \n 2023-07-28 07:21:30 UTC\n \n 2023-07-28 07:21:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2191\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-07-28 09:21:30',4,'2023-07-28 09:21:51',4,0,NULL,NULL,NULL,'e3824d29-b132-4875-b0a9-b5dea1536b22'),(2192,'Children ARV Regimen_1stLine_4E Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4E Data Set\n \n 2023-07-28 07:21:51 UTC\n \n 2023-08-14 15:40:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2192\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4y0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4y10-13\n \n \n \n \n \n \n \n \n \n F1-4y14-19\n \n \n \n \n \n \n \n \n \n F1-4y20-24\n \n \n \n \n \n \n \n \n \n F1-4y25-34\n \n \n \n \n \n \n \n \n \n F1-4y35>=\n \n \n \n \n \n \n \n \n \n F1-4y4-5\n \n \n \n \n \n \n \n \n \n F1-4y6-9\n \n \n \n \n \n \n \n \n \n F10-14y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14y10-\n \n \n \n \n \n \n F10-14y14-\n \n \n \n \n \n \n F10-14y20-\n \n \n \n \n \n \n F10-14y25-\n \n \n \n \n \n \n F10-14y35>\n \n \n \n \n \n \n F10-14y4-5\n \n \n \n \n \n \n F10-14y6-9\n \n \n \n \n \n \n F5-9y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9y10-13\n \n \n \n \n \n \n F5-9y14-19\n \n \n \n \n \n \n F5-9y20-24\n \n \n \n \n \n \n F5-9y25-34\n \n \n \n \n \n \n F5-9y35>=\n \n \n \n \n \n \n F5-9y4-5\n \n \n \n \n \n \n F5-9y6-9\n \n \n \n \n \n \n F<1y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1y10-13\n \n \n \n \n \n \n F<1y14-19\n \n \n \n \n \n \n F<1y20-24\n \n \n \n \n \n \n F<1y25-34\n \n \n \n \n \n \n F<1y35>=\n \n \n \n \n \n \n F<1y4-5\n \n \n \n \n \n \n F<1y6-9\n \n \n \n \n \n \n M1-4Y25-34\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4y0-3\n \n \n \n \n \n \n M1-4y10-13\n \n \n \n \n \n \n M1-4y14-19\n \n \n \n \n \n \n M1-4y20-24\n \n \n \n \n \n \n M1-4y35>=\n \n \n \n \n \n \n M1-4y4-5\n \n \n \n \n \n \n M1-4y6-9\n \n \n \n \n \n \n M10-14y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14y10-\n \n \n \n \n \n \n M10-14y14-\n \n \n \n \n \n \n M10-14y20-\n \n \n \n \n \n \n M10-14y25-\n \n \n \n \n \n \n M10-14y35>\n \n \n \n \n \n \n M10-14y4-5\n \n \n \n \n \n \n M10-14y6-9\n \n \n \n \n \n \n M5-9y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9y10-13\n \n \n \n \n \n \n M5-9y14-19\n \n \n \n \n \n \n M5-9y20-24\n \n \n \n \n \n \n M5-9y25-34\n \n \n \n \n \n \n M5-9y35>=\n \n \n \n \n \n \n M5-9y4-5\n \n \n \n \n \n \n M5-9y6-9\n \n \n \n \n \n \n M<1y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1y10-13\n \n \n \n \n \n \n M<1y14-19\n \n \n \n \n \n \n M<1y20-24\n \n \n \n \n \n \n M<1y25-34\n \n \n \n \n \n \n M<1y35>=\n \n \n \n \n \n \n M<1y4-5\n \n \n \n \n \n \n M<1y6-9\n \n \n \n \n \n \n','2023-07-28 07:21:51',4,'2023-08-14 15:40:40',4,0,NULL,NULL,NULL,'27162fa8-89a6-405a-b3c2-d79250d1fa72'),(2194,'Children ARV Regimen_1stLine_4E Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4E Data Set\n \n 2023-07-28 07:29:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n \n \n','2023-07-28 09:29:51',4,NULL,NULL,0,NULL,NULL,NULL,'4c11a721-c504-4075-a7aa-68b823c3d7cb'),(2196,'Children ARV Regimen_1stLine_4F','Children ARV Regimen_1stLine_4F disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4F\n Children ARV Regimen_1stLine_4F disaggregated by weight, sex, age\n \n 2023-07-28 07:58:35 UTC\n \n 2023-07-28 07:59:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2196\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-07-28 09:58:35',4,'2023-07-28 09:59:11',4,0,NULL,NULL,NULL,'0ee0e4f3-4bf0-43ee-be59-cb45d9ab0328'),(2197,'Children ARV Regimen_1stLine_4F Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4F Data Set\n \n 2023-07-28 07:59:11 UTC\n \n 2023-08-14 16:08:09 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2197\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4>=35\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4y0-3\n \n \n \n \n \n \n \n \n \n F1-4y10-13\n \n \n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F1-4y14-19\n \n \n \n \n \n \n \n \n \n F1-4y20-24\n \n \n \n \n \n \n \n \n \n F1-4y25-34\n \n \n \n \n \n \n \n \n \n F1-4y4-5\n \n \n \n \n \n \n \n \n \n F1-4y6-9\n \n \n \n \n \n \n \n \n \n F10-14y0-3\n \n \n \n \n \n \n F10-14y10-\n \n \n \n \n \n \n F10-14y14-\n \n \n \n \n \n \n F10-14y20-\n \n \n \n \n \n \n F10-14y25-\n \n \n \n \n \n \n F10-14y4-5\n \n \n \n \n \n \n F10-14y6-9\n \n \n \n \n \n \n F10-14y>=3\n \n \n \n \n \n \n F5-9y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9y10-13\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9y14-19\n \n \n \n \n \n \n F5-9y20-24\n \n \n \n \n \n \n F5-9y25-34\n \n \n \n \n \n \n F5-9y4-5\n \n \n \n \n \n \n F5-9y6-9\n \n \n \n \n \n \n F5-9y>=35\n \n \n \n \n \n \n F<1y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1y10-13\n \n \n \n \n \n \n F<1y14-19\n \n \n \n \n \n \n F<1y20-24\n \n \n \n \n \n \n F<1y25-34\n \n \n \n \n \n \n F<1y4-5\n \n \n \n \n \n \n F<1y6-9\n \n \n \n \n \n \n F<1y>=35\n \n \n \n \n \n \n M1-4y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4y10-13\n \n \n \n \n \n \n M1-4y14-19\n \n \n \n \n \n \n M1-4y20-24\n \n \n \n \n \n \n M1-4y25-34\n \n \n \n \n \n \n M1-4y4-5\n \n \n \n \n \n \n M1-4y6-9\n \n \n \n \n \n \n M1-4y>=35\n \n \n \n \n \n \n M10-14y\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14y0-3\n \n \n \n \n \n \n M10-14y10-\n \n \n \n \n \n \n M10-14y14-\n \n \n \n \n \n \n M10-14y25-\n \n \n \n \n \n \n M10-14y4-5\n \n \n \n \n \n \n M10-14y6-9\n \n \n \n \n \n \n M10-14y>=3\n \n \n \n \n \n \n M5-9y0-3\n \n \n \n \n \n \n M5-9y10-13\n \n \n \n \n \n \n M5-9y14-19\n \n \n \n \n \n \n M5-9y20-24\n \n \n \n \n \n \n M5-9y25-34\n \n \n \n \n \n \n M5-9y4-5\n \n \n \n \n \n \n M5-9y6-9\n \n \n \n \n \n \n M5-9y>=35\n \n \n \n \n \n \n M<1y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1y10-13\n \n \n \n \n \n \n M<1y14-19\n \n \n \n \n \n \n M<1y20-24\n \n \n \n \n \n \n M<1y25-34\n \n \n \n \n \n \n M<1y4-5\n \n \n \n \n \n \n M<1y6-9\n \n \n \n \n \n \n M<1y>=35\n \n \n \n \n \n \n','2023-07-28 07:59:11',4,'2023-08-14 16:08:09',4,0,NULL,NULL,NULL,'88a32f53-ea23-4ad9-9673-98bde635a960'),(2198,'Children ARV Regimen_1stLine_4G','Children ARV Regimen_1stLine_4G','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4G\n Children ARV Regimen_1stLine_4G\n \n 2023-07-28 10:06:07 UTC\n \n 2023-07-28 10:06:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2198\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-07-28 12:06:07',4,'2023-07-28 12:06:18',4,0,NULL,NULL,NULL,'0827caea-7bbc-4d28-b47d-e04cebd43d96'),(2199,'Children ARV Regimen_1stLine_4G Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4G Data Set\n \n 2023-07-28 10:06:18 UTC\n \n 2023-08-14 16:22:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2199\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4y0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4y10-13\n \n \n \n \n \n \n \n \n \n F1-4y14-19\n \n \n \n \n \n \n \n \n \n F1-4y20-24\n \n \n \n \n \n \n \n \n \n F1-4y25-34\n \n \n \n \n \n \n \n \n \n F1-4y35>=\n \n \n \n \n \n \n \n \n \n F1-4y4-5\n \n \n \n \n \n \n \n \n \n F1-4y6-9\n \n \n \n \n \n \n \n \n \n F10-14y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14y10-\n \n \n \n \n \n \n F10-14y14-\n \n \n \n \n \n \n F10-14y20-\n \n \n \n \n \n \n F10-14y25-\n \n \n \n \n \n \n F10-14y35>\n \n \n \n \n \n \n F10-14y4-5\n \n \n \n \n \n \n F10-14y6-9\n \n \n \n \n \n \n F5-9y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9y10-13\n \n \n \n \n \n \n F5-9y14-19\n \n \n \n \n \n \n F5-9y20-24\n \n \n \n \n \n \n F5-9y25-34\n \n \n \n \n \n \n F5-9y35>=\n \n \n \n \n \n \n F5-9y4-5\n \n \n \n \n \n \n F5-9y6-9\n \n \n \n \n \n \n F<1y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1y10-13\n \n \n \n \n \n \n F<1y14-19\n \n \n \n \n \n \n F<1y20-24\n \n \n \n \n \n \n F<1y25-34\n \n \n \n \n \n \n F<1y35>=\n \n \n \n \n \n \n F<1y4-5\n \n \n \n \n \n \n F<1y6-9\n \n \n \n \n \n \n M1-4y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4y10-13\n \n \n \n \n \n \n M1-4y14-19\n \n \n \n \n \n \n M1-4y20-24\n \n \n \n \n \n \n M1-4y25-34\n \n \n \n \n \n \n M1-4y35>=\n \n \n \n \n \n \n M1-4y4-5\n \n \n \n \n \n \n M1-4y6-9\n \n \n \n \n \n \n M10-14y-25\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14y0-3\n \n \n \n \n \n \n M10-14y10-\n \n \n \n \n \n \n M10-14y14-\n \n \n \n \n \n \n M10-14y20-\n \n \n \n \n \n \n M10-14y35>\n \n \n \n \n \n \n M10-14y4-5\n \n \n \n \n \n \n M10-14y6-9\n \n \n \n \n \n \n M5-9y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9y10-13\n \n \n \n \n \n \n M5-9y14-19\n \n \n \n \n \n \n M5-9y20-24\n \n \n \n \n \n \n M5-9y25-34\n \n \n \n \n \n \n M5-9y35>=\n \n \n \n \n \n \n M5-9y4-5\n \n \n \n \n \n \n M5-9y6-9\n \n \n \n \n \n \n M<1y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1y10-13\n \n \n \n \n \n \n M<1y14-19\n \n \n \n \n \n \n M<1y20-24\n \n \n \n \n \n \n M<1y24-34\n \n \n \n \n \n \n M<1y35>=\n \n \n \n \n \n \n M<1y4-5\n \n \n \n \n \n \n M<1y6-9\n \n \n \n \n \n \n','2023-07-28 10:06:18',4,'2023-08-14 16:22:43',4,0,NULL,NULL,NULL,'f61713b8-60c1-48f1-bab8-d0bf3046b3e1'),(2200,'Children ARV Regimen_1stLine_4H','Children ARV Regimen_1stLine_4H','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4H\n Children ARV Regimen_1stLine_4H\n \n 2023-07-28 10:19:42 UTC\n \n 2023-07-28 10:19:49 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2200\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-07-28 12:19:42',4,'2023-07-28 12:19:49',4,0,NULL,NULL,NULL,'f672b96f-7df9-48fa-b49e-a9946b7540e8'),(2201,'Children ARV Regimen_1stLine_4H Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4H Data Set\n \n 2023-07-28 10:19:49 UTC\n \n 2023-08-14 16:43:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2201\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4yr0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4yr10-1\n \n \n \n \n \n \n \n \n \n F1-4yr14-1\n \n \n \n \n \n \n \n \n \n F1-4yr20-2\n \n \n \n \n \n \n \n \n \n F1-4yr25-3\n \n \n \n \n \n \n \n \n \n F1-4yr4-5\n \n \n \n \n \n \n \n \n \n F1-4yr6-9\n \n \n \n \n \n \n \n \n \n F1-4yr>=35\n \n \n \n \n \n \n \n \n \n F10-14yr0-\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14yr10\n \n \n \n \n \n \n F10-14yr14\n \n \n \n \n \n \n F10-14yr20\n \n \n \n \n \n \n F10-14yr25\n \n \n \n \n \n \n F10-14yr35\n \n \n \n \n \n \n F10-14yr4-\n \n \n \n \n \n \n F10-14yr6-\n \n \n \n \n \n \n F5-9yr0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9yr10-1\n \n \n \n \n \n \n F5-9yr14-1\n \n \n \n \n \n \n F5-9yr20-2\n \n \n \n \n \n \n F5-9yr25-3\n \n \n \n \n \n \n F5-9yr4-5\n \n \n \n \n \n \n F5-9yr6-9\n \n \n \n \n \n \n F5-9yr>=35\n \n \n \n \n \n \n F<1yr0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1yr10-13\n \n \n \n \n \n \n F<1yr14-19\n \n \n \n \n \n \n F<1yr20-24\n \n \n \n \n \n \n F<1yr25-34\n \n \n \n \n \n \n F<1yr4-5\n \n \n \n \n \n \n F<1yr6-9\n \n \n \n \n \n \n F<1yr>=35\n \n \n \n \n \n \n M1-4yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4yr10-1\n \n \n \n \n \n \n M1-4yr14-1\n \n \n \n \n \n \n M1-4yr20-2\n \n \n \n \n \n \n M1-4yr25-3\n \n \n \n \n \n \n M1-4yr4-5\n \n \n \n \n \n \n M1-4yr6-9\n \n \n \n \n \n \n M1-4yr>=35\n \n \n \n \n \n \n M10-14yr0-\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14yr10\n \n \n \n \n \n \n M10-14yr14\n \n \n \n \n \n \n M10-14yr20\n \n \n \n \n \n \n M10-14yr25\n \n \n \n \n \n \n M10-14yr35\n \n \n \n \n \n \n M10-14yr4-\n \n \n \n \n \n \n M10-14yr6-\n \n \n \n \n \n \n M5-9yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9yr10-1\n \n \n \n \n \n \n M5-9yr14-1\n \n \n \n \n \n \n M5-9yr20-2\n \n \n \n \n \n \n M5-9yr25-3\n \n \n \n \n \n \n M5-9yr4-5\n \n \n \n \n \n \n M5-9yr6-9\n \n \n \n \n \n \n M5-9yr>=35\n \n \n \n \n \n \n M<1yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1yr10-13\n \n \n \n \n \n \n M<1yr14-19\n \n \n \n \n \n \n M<1yr20-24\n \n \n \n \n \n \n M<1yr25-34\n \n \n \n \n \n \n M<1yr4-5\n \n \n \n \n \n \n M<1yr6-9\n \n \n \n \n \n \n M<1yr>=35\n \n \n \n \n \n \n','2023-07-28 10:19:49',4,'2023-08-14 16:43:42',4,0,NULL,NULL,NULL,'014c9e79-d8d0-4226-8d86-869e879fb6ce'),(2202,'Children ARV Regimen_1stLine_4J',' Children ARV Regimen_1stLine_4J disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4J\n Children ARV Regimen_1stLine_4J disaggregated by weight, sex, age\n \n 2023-07-28 10:40:17 UTC\n \n 2023-07-28 10:40:24 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2202\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-07-28 12:40:17',4,'2023-07-28 12:40:24',4,0,NULL,NULL,NULL,'4390ec11-9cbe-42bd-888e-e681da953912'),(2203,'Children ARV Regimen_1stLine_4J Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4J Data Set\n \n 2023-07-28 10:40:24 UTC\n \n 2023-08-14 17:17:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2203\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4y0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4y10-13\n \n \n \n \n \n \n \n \n \n F1-4y14-19\n \n \n \n \n \n \n \n \n \n F1-4y20-24\n \n \n \n \n \n \n \n \n \n F1-4y25-34\n \n \n \n \n \n \n \n \n \n F1-4y35>=\n \n \n \n \n \n \n \n \n \n F1-4y4-5\n \n \n \n \n \n \n \n \n \n F1-4y6-9\n \n \n \n \n \n \n \n \n \n F10-14y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14y10-\n \n \n \n \n \n \n F10-14y14-\n \n \n \n \n \n \n F10-14y20-\n \n \n \n \n \n \n F10-14y25-\n \n \n \n \n \n \n F10-14y35>\n \n \n \n \n \n \n F10-14y4-5\n \n \n \n \n \n \n F10-14y6-9\n \n \n \n \n \n \n F5-9y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9y10-13\n \n \n \n \n \n \n F5-9y14-19\n \n \n \n \n \n \n F5-9y20-24\n \n \n \n \n \n \n F5-9y25-34\n \n \n \n \n \n \n F5-9y35>=\n \n \n \n \n \n \n F5-9y4-5\n \n \n \n \n \n \n F5-9y6-9\n \n \n \n \n \n \n F<1y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1y10-13\n \n \n \n \n \n \n F<1y14-19\n \n \n \n \n \n \n F<1y20-24\n \n \n \n \n \n \n F<1y25-34\n \n \n \n \n \n \n F<1y35>=\n \n \n \n \n \n \n F<1y6-9\n \n \n \n \n \n \n F<1yr4-5\n \n \n \n \n \n \n M1-4y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4y10-13\n \n \n \n \n \n \n M1-4y14-19\n \n \n \n \n \n \n M1-4y20-24\n \n \n \n \n \n \n M1-4y25-34\n \n \n \n \n \n \n M1-4y35>=\n \n \n \n \n \n \n M1-4y4-5\n \n \n \n \n \n \n M1-4y6-9\n \n \n \n \n \n \n M10-14y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14y10-\n \n \n \n \n \n \n M10-14y14-\n \n \n \n \n \n \n M10-14y20-\n \n \n \n \n \n \n M10-14y25-\n \n \n \n \n \n \n M10-14y35>\n \n \n \n \n \n \n M10-14y4-5\n \n \n \n \n \n \n M10-14y6-9\n \n \n \n \n \n \n M5-9y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9y10-13\n \n \n \n \n \n \n M5-9y14-19\n \n \n \n \n \n \n M5-9y20-24\n \n \n \n \n \n \n M5-9y25-34\n \n \n \n \n \n \n M5-9y35>=\n \n \n \n \n \n \n M5-9y4-5\n \n \n \n \n \n \n M5-9y6-9\n \n \n \n \n \n \n M<1y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1y10-13\n \n \n \n \n \n \n M<1y14-19\n \n \n \n \n \n \n M<1y20-24\n \n \n \n \n \n \n M<1y25-34\n \n \n \n \n \n \n M<1y35>=\n \n \n \n \n \n \n M<1y6-9\n \n \n \n \n \n \n M<1yr4-5\n \n \n \n \n \n \n','2023-07-28 10:40:24',4,'2023-08-14 17:17:03',4,0,NULL,NULL,NULL,'b1b5ff26-4220-44b4-856e-88b7e9d39451'),(2204,'Children ARV Regimen_1stLine_4K','Children ARV Regimen_1stLine_4K disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4K\n Children ARV Regimen_1stLine_4K disaggregated by weight, sex, age\n \n 2023-07-31 11:04:52 UTC\n \n 2023-07-31 11:04:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2204\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-07-31 13:04:52',4,'2023-07-31 13:04:59',4,0,NULL,NULL,NULL,'635157c8-9203-475c-bc08-998a880fa244'),(2205,'Children ARV Regimen_1stLine_4K Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4K Data Set\n \n 2023-07-31 11:04:59 UTC\n \n 2023-08-14 17:30:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2205\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4>=35\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4y0-3\n \n \n \n \n \n \n \n \n \n F1-4y10-13\n \n \n \n \n \n \n \n \n \n F1-4y14-19\n \n \n \n \n \n \n \n \n \n F1-4y20-24\n \n \n \n \n \n \n \n \n \n F1-4y25-34\n \n \n \n \n \n \n \n \n \n F1-4y4-5\n \n \n \n \n \n \n \n \n \n F1-4y6-9\n \n \n \n \n \n \n \n \n \n F10-14y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14y10-\n \n \n \n \n \n \n F10-14y14-\n \n \n \n \n \n \n F10-14y20-\n \n \n \n \n \n \n F10-14y25-\n \n \n \n \n \n \n F10-14y4-5\n \n \n \n \n \n \n F10-14y6-9\n \n \n \n \n \n \n F10-14y>=3\n \n \n \n \n \n \n F5-9y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9y10-13\n \n \n \n \n \n \n F5-9y14-19\n \n \n \n \n \n \n F5-9y20-24\n \n \n \n \n \n \n F5-9y25-34\n \n \n \n \n \n \n F5-9y4-5\n \n \n \n \n \n \n F5-9y6-9\n \n \n \n \n \n \n F5-9y>=35\n \n \n \n \n \n \n F<1y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1y10-13\n \n \n \n \n \n \n F<1y14-19\n \n \n \n \n \n \n F<1y20-24\n \n \n \n \n \n \n F<1y25-34\n \n \n \n \n \n \n F<1y4-5\n \n \n \n \n \n \n F<1y6-9\n \n \n \n \n \n \n F<1y>=35\n \n \n \n \n \n \n M1-4y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4y10-13\n \n \n \n \n \n \n M1-4y14-19\n \n \n \n \n \n \n M1-4y20-24\n \n \n \n \n \n \n M1-4y25-34\n \n \n \n \n \n \n M1-4y4-5\n \n \n \n \n \n \n M1-4y6-9\n \n \n \n \n \n \n M1-4y>=35\n \n \n \n \n \n \n M10-14y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14y10-\n \n \n \n \n \n \n M10-14y14-\n \n \n \n \n \n \n M10-14y20-\n \n \n \n \n \n \n M10-14y25-\n \n \n \n \n \n \n M10-14y4-5\n \n \n \n \n \n \n M10-14y6-9\n \n \n \n \n \n \n M10-14y>=3\n \n \n \n \n \n \n M5-9y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9y10-13\n \n \n \n \n \n \n M5-9y14-19\n \n \n \n \n \n \n M5-9y20-24\n \n \n \n \n \n \n M5-9y25-34\n \n \n \n \n \n \n M5-9y4-5\n \n \n \n \n \n \n M5-9y6-9\n \n \n \n \n \n \n M5-9y>=35\n \n \n \n \n \n \n M<1y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1y10-13\n \n \n \n \n \n \n M<1y14-19\n \n \n \n \n \n \n M<1y20-24\n \n \n \n \n \n \n M<1y25-34\n \n \n \n \n \n \n M<1y4-5\n \n \n \n \n \n \n M<1y6-9\n \n \n \n \n \n \n M<1y>=35\n \n \n \n \n \n \n','2023-07-31 11:04:59',4,'2023-08-14 17:30:12',4,0,NULL,NULL,NULL,'a3a4b9a1-0d71-4c08-9e4e-486f87840b6e'),(2206,'Children ARV Regimen_1stLine_4L','Children ARV Regimen_1stLine_4L','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4L\n Children ARV Regimen_1stLine_4L\n \n 2023-07-31 11:19:07 UTC\n \n 2023-07-31 11:19:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2206\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-07-31 13:19:07',4,'2023-07-31 13:19:14',4,0,NULL,NULL,NULL,'646bc981-856b-4f66-b545-eb5843952af7'),(2207,'Children ARV Regimen_1stLine_4L Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4L Data Set\n \n 2023-07-31 11:19:14 UTC\n \n 2023-08-14 17:43:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2207\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4yr0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4yr10-1\n \n \n \n \n \n \n \n \n \n F1-4yr14-1\n \n \n \n \n \n \n \n \n \n F1-4yr20-2\n \n \n \n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4yr25-3\n \n \n \n \n \n \n \n \n \n F1-4yr4-5\n \n \n \n \n \n \n \n \n \n F1-4yr6-9\n \n \n \n \n \n \n \n \n \n F1-4yr>=35\n \n \n \n \n \n \n \n \n \n F10-14yr0-\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14yr10\n \n \n \n \n \n \n F10-14yr14\n \n \n \n \n \n \n F10-14yr20\n \n \n \n \n \n \n F10-14yr25\n \n \n \n \n \n \n F10-14yr35\n \n \n \n \n \n \n F10-14yr4-\n \n \n \n \n \n \n F10-14yr6-\n \n \n \n \n \n \n F5-9yr0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9yr10-1\n \n \n \n \n \n \n F5-9yr14-1\n \n \n \n \n \n \n F5-9yr20-2\n \n \n \n \n \n \n F5-9yr25-3\n \n \n \n \n \n \n F5-9yr4-5\n \n \n \n \n \n \n F5-9yr6-9\n \n \n \n \n \n \n F5-9yr>=35\n \n \n \n \n \n \n F<1yr0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1yr10-13\n \n \n \n \n \n \n F<1yr14-19\n \n \n \n \n \n \n F<1yr20-24\n \n \n \n \n \n \n F<1yr25-34\n \n \n \n \n \n \n F<1yr4-5\n \n \n \n \n \n \n F<1yr6-9\n \n \n \n \n \n \n F<1yr>=35\n \n \n \n \n \n \n M1-4yr0-3\n \n \n \n \n \n \n M1-4yr10-1\n \n \n \n \n \n \n M1-4yr14-1\n \n \n \n \n \n \n M1-4yr20-2\n \n \n \n \n \n \n M1-4yr25-3\n \n \n \n \n \n \n M1-4yr4-5\n \n \n \n \n \n \n M1-4yr6-9\n \n \n \n \n \n \n M1-4yr>=35\n \n \n \n \n \n \n M10-14yr0-\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14yr10\n \n \n \n \n \n \n M10-14yr14\n \n \n \n \n \n \n M10-14yr20\n \n \n \n \n \n \n M10-14yr25\n \n \n \n \n \n \n M10-14yr35\n \n \n \n \n \n \n M10-14yr4-\n \n \n \n \n \n \n M10-14yr6-\n \n \n \n \n \n \n M5-9yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9yr10-1\n \n \n \n \n \n \n M5-9yr14-1\n \n \n \n \n \n \n M5-9yr20-2\n \n \n \n \n \n \n M5-9yr25-3\n \n \n \n \n \n \n M5-9yr4-5\n \n \n \n \n \n \n M5-9yr6-9\n \n \n \n \n \n \n M5-9yr>=35\n \n \n \n \n \n \n M<1yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1yr10-13\n \n \n \n \n \n \n M<1yr14-19\n \n \n \n \n \n \n M<1yr20-24\n \n \n \n \n \n \n M<1yr25-34\n \n \n \n \n \n \n M<1yr4-5\n \n \n \n \n \n \n M<1yr6-9\n \n \n \n \n \n \n M<1yr>=35\n \n \n \n \n \n \n','2023-07-31 11:19:14',4,'2023-08-14 17:43:21',4,0,NULL,NULL,NULL,'f228bb0b-0af6-48b3-afeb-8b1e4e21feb3'),(2208,'Clients given 4C with >=20 copies viral load','Clients given 4C with >=20 copies viral load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C with >=20 copies viral load\n Clients given 4C with >=20 copies viral load\n \n 2023-08-07 11:49:27 UTC\n \n 2023-08-14 11:19:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2208\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2202)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \n \n \non Active_Patients.Id = greaterThan20.Id \n)) \n \n\n','2023-08-07 11:49:27',4,'2023-08-14 11:19:55',4,0,NULL,NULL,NULL,'5a765ffd-b4ff-4899-ba79-aae76385d5d9'),(2209,'Clients given 4C with >=20 copies viral load','Clients given 4C with >=20 copies viral load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C with >=20 copies viral load\n Clients given 4C with >=20 copies viral load\n \n 2023-08-07 14:15:14 UTC\n \n 2023-08-07 14:18:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2209\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 16:15:14',4,'2023-08-07 16:18:06',4,0,NULL,NULL,NULL,'6942c194-b069-44c3-a161-b77891d7f06c'),(2210,'Children ARV Regimen_1stLine_Viral_Load','Children ARV Regimen_1stLine_Viral_Load','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_Viral_Load\n Children ARV Regimen_1stLine_Viral_Load\n \n 2023-08-07 14:19:54 UTC\n \n 2023-08-08 20:10:19 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2210\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-07 16:19:54',4,'2023-08-08 22:10:19',4,0,NULL,NULL,NULL,'400088e7-a254-4fac-8a59-eac6dc9d177b'),(2211,'Children ARV Regimen_1stLine_4C_>20Copies_Viraload Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4C_>20Copies_Viraload Data Set\n \n 2023-08-07 14:20:07 UTC\n \n 2023-12-20 07:10:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2211\n \n \n \n 4C<20\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n \n \n 4C>=20\n \n \n \n \n \n \n \n \n \n 4CUndetect\n \n \n \n \n \n \n \n \n \n 4D<20\n \n \n \n \n \n \n \n \n \n 4D>=20\n \n \n \n \n \n \n \n \n \n 4DUndetect\n \n \n \n \n \n \n \n \n \n 4E<20\n \n \n \n \n \n \n \n \n \n 4E>=20\n \n \n \n \n \n \n \n \n \n 4EUndetect\n \n \n \n \n \n \n \n \n \n 4F<20\n \n \n \n \n \n \n \n \n \n 4F>=20\n \n \n \n \n \n \n \n \n \n 4FUndetect\n \n \n \n \n \n \n \n \n \n 4G<20\n \n \n \n \n \n \n \n \n \n 4G>=20\n \n \n \n \n \n \n \n \n \n 4GUndetect\n \n \n \n \n \n \n \n \n \n 4H<20\n \n \n \n \n \n \n \n \n \n 4H>=20\n \n \n \n \n \n \n \n \n \n 4HUndetect\n \n \n \n \n \n \n \n \n \n 4J<20\n \n \n \n \n \n \n \n \n \n 4J>=20\n \n \n \n \n \n \n \n \n \n 4JUndetect\n \n \n \n \n \n \n \n \n \n 4K<20\n \n \n \n \n \n \n \n \n \n 4K>=20\n \n \n \n \n \n \n \n \n \n 4KUndetect\n \n \n \n \n \n \n \n \n \n 4L<20\n \n \n \n \n \n \n \n \n \n 4L>=20\n \n \n \n \n \n \n \n \n \n 4LUndetect\n \n \n \n \n \n \n \n \n \n','2023-08-07 16:20:07',4,'2023-12-20 09:10:01',4,0,NULL,NULL,NULL,'96eef8c5-dc41-4f3f-9e62-4004c11fb291'),(2212,'Clients given 4D with >=20 Copies Viral Load','Clients given 4D with >=20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D with >=20 Copies Viral Load\n Clients given 4D with >=20 Copies Viral Load\n \n 2023-08-07 14:40:38 UTC\n \n 2023-08-14 11:22:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2212\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4d \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2204)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n -- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-07 14:40:38',4,'2023-08-14 11:22:44',4,0,NULL,NULL,NULL,'41de8523-3ab9-4284-a0b1-f0298f2da510'),(2213,'Clients given 4E with >=20 Copies Viral Load','Clients given 4E with >=20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E with >=20 Copies Viral Load\n Clients given 4E with >=20 Copies Viral Load\n \n 2023-08-07 14:50:06 UTC\n \n 2023-08-14 11:23:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2213\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3679)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-07 14:50:06',4,'2023-08-14 11:23:53',4,0,NULL,NULL,NULL,'c1f2fd48-a980-4af6-93f0-08598fd57995'),(2214,'Clients given 4F with >=20 copies viral load','Clients given 4F with >=20 copies viral load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F with >=20 copies viral load\n Clients given 4F with >=20 copies viral load\n \n 2023-08-07 15:02:48 UTC\n \n 2023-08-14 11:29:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2214\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3680)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n -- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-07 15:02:48',4,'2023-08-14 11:29:08',4,0,NULL,NULL,NULL,'1605d858-dca2-4c0d-bb6f-967424aed8ad'),(2215,'Clients given 4H with >=20 Copies Viral Load','Clients given 4H with >=20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H with >=20 Copies Viral Load\n Clients given 4H with >=20 Copies Viral Load\n \n 2023-08-07 15:11:34 UTC\n \n 2023-08-14 11:47:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2215\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4685)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n -- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-07 15:11:34',4,'2023-08-14 11:47:45',4,0,NULL,NULL,NULL,'07781cf0-2cc5-497b-b9a3-dafc63842da1'),(2216,'Clients given 4J with >=20 Copies Viral Load','Clients given 4J weighing >=20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J with >=20 Copies Viral Load\n Clients given 4J weighing >=20 Copies Viral Load\n \n 2023-08-07 15:32:07 UTC\n \n 2023-08-14 11:49:33 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2216\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4J \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-07 15:32:07',4,'2023-08-14 11:49:33',4,0,NULL,NULL,NULL,'180f7359-ac4f-4728-ae43-8208ebf052cb'),(2217,'Clients given 4K with >=20 Copies Viral Load','Clients given 4K with >=20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K with >=20 Copies Viral Load\n Clients given 4K with >=20 Copies Viral Load\n \n 2023-08-07 15:41:37 UTC\n \n 2023-08-14 11:51:49 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2217\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4K \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-07 15:41:37',4,'2023-08-14 11:51:49',4,0,NULL,NULL,NULL,'a5a07716-681f-44bd-84ef-391d51ace7c9'),(2218,'Clients given 4L with >=20 Copies Viral Load','Clients given 4L with >=20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L with >=20 Copies Viral Load\n Clients given 4L with >=20 Copies Viral Load\n \n 2023-08-07 15:45:38 UTC\n \n 2023-12-20 07:15:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2218\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4L \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4688)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n -- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-07 17:45:38',4,'2023-12-20 09:15:07',4,0,NULL,NULL,NULL,'606f20bd-cac9-4282-a3c4-56b9f72ded30'),(2219,'Clients given 4C with <20 copies Viral Load','Clients given 4C with <20 copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C with <20 copies Viral Load\n Clients given 4C with <20 copies Viral Load\n \n 2023-08-07 15:55:07 UTC\n \n 2023-08-14 11:20:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2219\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2202)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-07 15:55:07',4,'2023-08-14 11:20:12',4,0,NULL,NULL,NULL,'5571d546-89fc-4cda-bc4d-fab1f629ce7a'),(2220,'Clients given 4C with Undetectable Viral Load','Clients given 4C with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C with Undetectable Viral Load\n Clients given 4C with Undetectable Viral Load\n \n 2023-08-07 15:57:44 UTC\n \n 2023-08-14 11:19:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2220\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2202)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- undetectable, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-07 15:57:44',4,'2023-08-14 11:19:40',4,0,NULL,NULL,NULL,'eaa0d4ac-c56c-4a8a-b2ca-12a462b06874'),(2221,'Clients given 4D with <20 Copies Viral Load','Clients given 4D with <20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D with <20 Copies Viral Load\n Clients given 4D with <20 Copies Viral Load\n \n 2023-08-07 16:09:50 UTC\n \n 2023-08-14 11:23:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2221\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4d \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2204)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n -- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-07 16:09:50',4,'2023-08-14 11:23:00',4,0,NULL,NULL,NULL,'60e4edc3-d202-4e5c-b9d1-a4791c874209'),(2222,'Clients given 4D with Undetectable Viral Load','Clients given 4D with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D with Undetectable Viral Load\n Clients given 4D with Undetectable Viral Load\n \n 2023-08-07 16:11:59 UTC\n \n 2023-08-14 11:22:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2222\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4d \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2204)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n -- Undetectable Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable Copies \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-07 16:11:59',4,'2023-08-14 11:22:23',4,0,NULL,NULL,NULL,'2da8e7c6-793e-42f3-994a-0dc0e72464ae'),(2223,'Clients given 4E with <20 Copies Viral Load','Clients given 4E with <20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E with <20 Copies Viral Load\n Clients given 4E with <20 Copies Viral Load\n \n 2023-08-07 16:18:03 UTC\n \n 2023-08-14 11:26:22 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2223\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3679)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-07 16:18:03',4,'2023-08-14 11:26:22',4,0,NULL,NULL,NULL,'72e755a7-cbbc-4ccd-be81-7bedf125f8c4'),(2224,'Clients given 4E with Undetectable Viral Load','Clients given 4E with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E with Undetectable Viral Load\n Clients given 4E with Undetectable Viral Load\n \n 2023-08-07 16:20:52 UTC\n \n 2023-08-14 12:07:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2224\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3679)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Undetectable, Viral load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-07 16:20:52',4,'2023-08-14 12:07:26',4,0,NULL,NULL,NULL,'1d7a46e2-8d42-4f34-8958-f5cf962db589'),(2225,'Clients given 4F with <20 copies viral load','Clients given 4F with <20 copies viral load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F with <20 copies viral load\n Clients given 4F with <20 copies viral load\n \n 2023-08-07 16:26:02 UTC\n \n 2023-08-14 11:29:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2225\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3680)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-07 16:26:02',4,'2023-08-14 11:29:28',4,0,NULL,NULL,NULL,'3c193bb3-64d6-4b71-9069-0b53083963e2'),(2226,'Clients given 4F with Undetectable viral load','Clients given 4F with Undetectable copies viral load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F with Undetectable viral load\n Clients given 4F with Undetectable copies viral load\n \n 2023-08-07 16:28:54 UTC\n \n 2023-08-14 11:28:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2226\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3680)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-07 16:28:54',4,'2023-08-14 11:28:42',4,0,NULL,NULL,NULL,'978dc8c8-3f02-4e20-9fb5-302be9fbf23c'),(2227,'Clients given 4G with >=20 Copies Viral Load','Clients given 4G with >=20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G with >=20 Copies Viral Load\n Clients given 4G with >=20 Copies Viral Load\n \n 2023-08-07 16:32:35 UTC\n \n 2023-08-14 11:45:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2227\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4684)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-07 16:32:35',4,'2023-08-14 11:45:02',4,0,NULL,NULL,NULL,'41d9cb1b-b376-4e21-aa6c-7dce59197a97'),(2228,'Clients given 4G with <20 copies Viral_Load','Clients given 4G with <20 copies Viral_Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G with <20 copies Viral_Load\n Clients given 4G with <20 copies Viral_Load\n \n 2023-08-07 16:34:54 UTC\n \n 2023-08-14 11:44:33 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2228\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4684)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-07 16:34:54',4,'2023-08-14 11:44:33',4,0,NULL,NULL,NULL,'80ebb214-6a46-4379-9a31-3e3cbbb05566'); INSERT INTO `serialized_object` VALUES (2229,'Clients given 4G with Undetectable Viral Load','Clients given 4G with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G with Undetectable Viral Load\n Clients given 4G with Undetectable Viral Load\n \n 2023-08-07 16:39:28 UTC\n \n 2023-08-14 11:45:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2229\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4684)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- Undetectable Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable Copies \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-07 16:39:28',4,'2023-08-14 11:45:51',4,0,NULL,NULL,NULL,'d480aafa-578b-4865-bdd4-e158af437b06'),(2230,'Clients given 4H with <20 Copies Viral Load','Clients given 4H with <20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H with <20 Copies Viral Load\n Clients given 4H with <20 Copies Viral Load\n \n 2023-08-07 16:45:29 UTC\n \n 2023-08-14 11:47:21 UTC\n \n \n endDate\n \n java.util.Date\n true\n \n \n startDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2230\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4685)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-07 16:45:29',4,'2023-08-14 11:47:21',4,0,NULL,NULL,NULL,'5c8ddadc-a50e-4433-afb8-48e1acfc3ed5'),(2231,'Clients given 4H with Undetectable Viral Load','Clients given 4H with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H with Undetectable Viral Load\n Clients given 4H with Undetectable Viral Load\n \n 2023-08-07 16:47:28 UTC\n \n 2023-08-14 11:48:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2231\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4685)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- undetectable, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-07 16:47:28',4,'2023-08-14 11:48:07',4,0,NULL,NULL,NULL,'6d85bd5f-af27-43f5-a456-e1679230a4aa'),(2232,'Clients given 4J with <20 copies Viral Load','Clients given 4J with <20 copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J with <20 copies Viral Load\n Clients given 4J with <20 copies Viral Load\n \n 2023-08-07 16:53:00 UTC\n \n 2023-08-14 11:49:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2232\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4J \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-07 16:53:00',4,'2023-08-14 11:49:15',4,0,NULL,NULL,NULL,'1cf1f1b1-2f40-4e5c-b55b-893716cf2a04'),(2233,'Clients given 4J with Undetectable Viral Load','Clients given 4J with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J with Undetectable Viral Load\n Clients given 4J with Undetectable Viral Load\n \n 2023-08-07 16:57:27 UTC\n \n 2023-08-14 11:49:52 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2233\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4J \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- Undetectable, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable Copies \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-07 16:57:27',4,'2023-08-14 11:49:52',4,0,NULL,NULL,NULL,'e543fa69-cbc5-46c8-a3de-e77abcaa185a'),(2234,'Clients given 4K with <20 Copies Viral Load','Clients given 4K with <20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K with <20 Copies Viral Load\n Clients given 4K with <20 Copies Viral Load\n \n 2023-08-07 17:02:35 UTC\n \n 2023-08-14 11:51:25 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2234\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4K \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-07 17:02:35',4,'2023-08-14 11:51:25',4,0,NULL,NULL,NULL,'54121116-3d51-4a34-ae5c-5b15f1254f6e'),(2235,'Clients given 4K with Undetectable Viral Load','Clients given 4K with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K with Undetectable Viral Load\n Clients given 4K with Undetectable Viral Load\n \n 2023-08-07 17:08:26 UTC\n \n 2023-08-14 11:52:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2235\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4K \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Undetectable, Viral load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-07 17:08:26',4,'2023-08-14 11:52:08',4,0,NULL,NULL,NULL,'d2e6acfd-540a-4220-b160-b104be742043'),(2236,'Clients given 4L with <20 Copies Viral Load','Clients given 4L with <20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L with <20 Copies Viral Load\n Clients given 4L with <20 Copies Viral Load\n \n 2023-08-07 17:13:48 UTC\n \n 2023-08-14 11:54:16 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2236\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4L \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4688)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-07 17:13:48',4,'2023-08-14 11:54:16',4,0,NULL,NULL,NULL,'d4e9e456-61f2-4e2d-8779-52e1dd59a11a'),(2237,'Clients given 4L with Undetectable Viral Load','Clients given 4L with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L with Undetectable Viral Load\n Clients given 4L with Undetectable Viral Load\n \n 2023-08-07 17:17:22 UTC\n \n 2023-08-14 12:04:57 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2237\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4K \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4688)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Undetectable, Viral load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-07 17:17:22',4,'2023-08-14 12:04:57',4,0,NULL,NULL,NULL,'4792ce19-a4f6-4876-9a81-a7e48f279b1b'),(2238,'Clients given 4C with <20 copies Viral Load','Clients given 4C with <20 copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C with <20 copies Viral Load\n Clients given 4C with <20 copies Viral Load\n \n 2023-08-07 17:40:01 UTC\n \n 2023-08-07 17:41:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2238\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 19:40:01',4,'2023-08-07 19:41:50',4,0,NULL,NULL,NULL,'523777b6-edc7-4346-abbb-1eec797d6e5c'),(2239,'Clients given 4C with Undetectable Viral_Load','Clients given 4C with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C with Undetectable Viral_Load\n Clients given 4C with Undetectable Viral Load\n \n 2023-08-07 17:45:29 UTC\n \n 2023-08-07 17:54:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2239\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 19:45:29',4,'2023-08-07 19:54:18',4,0,NULL,NULL,NULL,'b3e08e0a-35ac-4b1c-86e2-2dffaa8b6ce6'),(2240,'Clients given 4D with >=20 Copies Viral Load','Clients given 4D with >=20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D with >=20 Copies Viral Load\n Clients given 4D with >=20 Copies Viral Load\n \n 2023-08-07 17:57:17 UTC\n \n 2023-08-07 17:59:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2240\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 19:57:17',4,'2023-08-07 19:59:18',4,0,NULL,NULL,NULL,'06a65347-260a-49f6-b227-e152d369db09'),(2241,'Clients given 4D with < 20 Copies Viral Load','Clients given 4D with < 20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D with < 20 Copies Viral Load\n Clients given 4D with < 20 Copies Viral Load\n \n 2023-08-07 18:00:13 UTC\n \n 2023-08-07 18:01:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2241\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:00:13',4,'2023-08-07 20:01:11',4,0,NULL,NULL,NULL,'849b9ad0-e14d-4e64-8d4d-c90f1ea85d2c'),(2242,'Clients given 4D with Undetectable Viral Load','Clients given 4D with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D with Undetectable Viral Load\n Clients given 4D with Undetectable Viral Load\n \n 2023-08-07 18:02:05 UTC\n \n 2023-08-07 18:02:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2242\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:02:05',4,'2023-08-07 20:02:59',4,0,NULL,NULL,NULL,'269d7cd2-40e5-41a3-9da2-be9e310de73d'),(2243,'Clients given 4E with >=20 Copies Viral Load','Clients given 4E with >=20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E with >=20 Copies Viral Load\n Clients given 4E with >=20 Copies Viral Load\n \n 2023-08-07 18:05:06 UTC\n \n 2023-08-07 18:06:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2243\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:05:06',4,'2023-08-07 20:06:12',4,0,NULL,NULL,NULL,'deaade8d-fa75-4774-9422-2379319a59b2'),(2244,'Clients given 4E with <20 Copies Viral Load','Clients given 4E with <20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E with <20 Copies Viral Load\n Clients given 4E with <20 Copies Viral Load\n \n 2023-08-07 18:06:56 UTC\n \n 2023-08-07 18:08:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2244\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:06:56',4,'2023-08-07 20:08:02',4,0,NULL,NULL,NULL,'e0b2f670-7df3-4672-8411-b6d500f5f13d'),(2245,'Clients given 4E with Undetectable Viral Load','Clients given 4E with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E with Undetectable Viral Load\n Clients given 4E with Undetectable Viral Load\n \n 2023-08-07 18:08:42 UTC\n \n 2023-08-07 18:10:35 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2245\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:08:42',4,'2023-08-07 20:10:35',4,0,NULL,NULL,NULL,'ada290e9-0105-4579-843e-a66c38a30845'),(2246,'Clients given 4F with >=20 copies viral load','Clients given 4F with >=20 copies viral load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F with >=20 copies viral load\n Clients given 4F with >=20 copies viral load\n \n 2023-08-07 18:12:14 UTC\n \n 2023-08-07 18:12:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2246\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:12:14',4,'2023-08-07 20:12:59',4,0,NULL,NULL,NULL,'2755008d-c58f-4cf7-b3fb-879cb0055625'),(2247,'Clients given 4F with <20 copies Viral Load','Clients given 4F with <20 copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F with <20 copies Viral Load\n Clients given 4F with <20 copies Viral Load\n \n 2023-08-07 18:13:57 UTC\n \n 2023-08-07 18:15:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2247\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:13:57',4,'2023-08-07 20:15:02',4,0,NULL,NULL,NULL,'5fd4b692-7c21-4e41-80e5-143ee6c04385'),(2248,'Clients given 4F with Undetectable Viral Load','Clients given 4F with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F with Undetectable Viral Load\n Clients given 4F with Undetectable Viral Load\n \n 2023-08-07 18:15:52 UTC\n \n 2023-08-07 18:16:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2248\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:15:52',4,'2023-08-07 20:16:55',4,0,NULL,NULL,NULL,'9aae30ff-90c2-4228-b4a1-0aedf7354802'),(2249,'Clients given 4G with >=20 Copies Viral Load','Clients given 4G with >=20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G with >=20 Copies Viral Load\n Clients given 4G with >=20 Copies Viral Load\n \n 2023-08-07 18:18:32 UTC\n \n 2023-08-07 18:20:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2249\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:18:32',4,'2023-08-07 20:20:58',4,0,NULL,NULL,NULL,'a602c987-a1c2-486d-93e8-2efb6a3d06d6'),(2250,'Clients given 4G with <20 copies Viral Load','Clients given 4G with <20 copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G with <20 copies Viral Load\n Clients given 4G with <20 copies Viral Load\n \n 2023-08-07 18:21:47 UTC\n \n 2023-08-07 18:23:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2250\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:21:47',4,'2023-08-07 20:23:21',4,0,NULL,NULL,NULL,'6cec76ef-5466-4efe-970d-f7b76ed79e1e'),(2251,'Clients given 4G with Undetectable Viral Load','Clients given 4G with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G with Undetectable Viral Load\n Clients given 4G with Undetectable Viral Load\n \n 2023-08-07 18:24:19 UTC\n \n 2023-08-07 18:25:25 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2251\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:24:19',4,'2023-08-07 20:25:25',4,0,NULL,NULL,NULL,'ef8cbe9f-0742-4531-8dbe-1efbfc9c807a'),(2252,'Clients given 4H with >=20 Copies Viral Load','Clients given 4H with >=20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H with >=20 Copies Viral Load\n Clients given 4H with >=20 Copies Viral Load\n \n 2023-08-07 18:26:08 UTC\n \n 2023-08-07 18:27:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2252\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:26:08',4,'2023-08-07 20:27:36',4,0,NULL,NULL,NULL,'f374ad0c-24ca-460e-8ed4-812fcdbb8b30'),(2253,'Clients given 4H weighing <20 Copies Viral Load','Clients given 4H weighing <20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H weighing <20 Copies Viral Load\n Clients given 4H weighing <20 Copies Viral Load\n \n 2023-08-07 18:32:51 UTC\n \n 2023-08-07 18:34:47 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2253\n COUNT\n \n \n \n \n endDate\n ${startDate}\n \n \n location\n ${location}\n \n \n startDate\n ${endDate}\n \n \n \n','2023-08-07 20:32:51',4,'2023-08-07 20:34:47',4,0,NULL,NULL,NULL,'981353f5-77cf-4e9e-b418-96ba27b38c0d'),(2254,'Clients given 4H with Undetectable Viral Load','Clients given 4H with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H with Undetectable Viral Load\n Clients given 4H with Undetectable Viral Load\n \n 2023-08-07 18:35:38 UTC\n \n 2023-08-07 18:36:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2254\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:35:38',4,'2023-08-07 20:36:30',4,0,NULL,NULL,NULL,'3cff4201-9093-4de5-a526-4c714a0e4b75'),(2255,'Clients given 4J weighing >=20 Copies Viral Load','Clients given 4J weighing >=20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J weighing >=20 Copies Viral Load\n Clients given 4J weighing >=20 Copies Viral Load\n \n 2023-08-07 18:37:43 UTC\n \n 2023-08-07 18:38:52 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2255\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:37:43',4,'2023-08-07 20:38:52',4,0,NULL,NULL,NULL,'ccd5a99e-b517-45c0-864c-d3c6f4ef6701'),(2256,'Clients given 4J with <20 copies Viral Load','Clients given 4J with <20 copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J with <20 copies Viral Load\n Clients given 4J with <20 copies Viral Load\n \n 2023-08-07 18:40:26 UTC\n \n 2023-08-07 18:41:37 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2256\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:40:26',4,'2023-08-07 20:41:37',4,0,NULL,NULL,NULL,'99531929-455a-4092-b2e9-48993920a7b3'),(2257,'Clients given 4J with Undetectable Viral Load','Clients given 4J with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J with Undetectable Viral Load\n Clients given 4J with Undetectable Viral Load\n \n 2023-08-07 18:42:19 UTC\n \n 2023-08-07 18:45:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2257\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:42:19',4,'2023-08-07 20:45:10',4,0,NULL,NULL,NULL,'059ea6c5-c8bf-42ba-abbf-50b8bd27f0e1'),(2258,'Clients given 4K with >=20 Copies Viral Load','Clients given 4K with >=20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K with >=20 Copies Viral Load\n Clients given 4K with >=20 Copies Viral Load\n \n 2023-08-07 18:46:10 UTC\n \n 2023-08-07 18:47:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2258\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:46:10',4,'2023-08-07 20:47:00',4,0,NULL,NULL,NULL,'4d992a61-8cc5-4846-afd1-605e939b3f6e'),(2259,'Clients given 4K with <20 Copies Viral Load','Clients given 4K with <20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K with <20 Copies Viral Load\n Clients given 4K with <20 Copies Viral Load\n \n 2023-08-07 18:48:35 UTC\n \n 2023-08-08 10:02:48 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2259\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:48:35',4,'2023-08-08 12:02:48',4,0,NULL,NULL,NULL,'a1388a42-9e0b-4057-9343-515ab7744a3a'),(2260,'Clients given 4K with Undetectable Viral Load','Clients given 4K with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K with Undetectable Viral Load\n Clients given 4K with Undetectable Viral Load\n \n 2023-08-07 18:50:00 UTC\n \n 2023-08-07 18:50:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2260\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:50:00',4,'2023-08-07 20:50:42',4,0,NULL,NULL,NULL,'50081155-8d33-4ece-ad03-825e8f26f54b'),(2261,'Clients given 4L with >=20 Copies Viral Load','Clients given 4L with >=20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L with >=20 Copies Viral Load\n Clients given 4L with >=20 Copies Viral Load\n \n 2023-08-07 18:51:33 UTC\n \n 2023-12-20 07:08:34 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2261\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:51:33',4,'2023-12-20 09:08:34',4,0,NULL,NULL,NULL,'44e7920f-d834-4397-ba46-342d70d2d351'),(2262,'Clients given 4L with <20 Copies Viral Load','Clients given 4L with <20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L with <20 Copies Viral Load\n Clients given 4L with <20 Copies Viral Load\n \n 2023-08-07 18:54:15 UTC\n \n 2023-08-07 18:54:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2262\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:54:15',4,'2023-08-07 20:54:59',4,0,NULL,NULL,NULL,'a46689e8-87db-4b2e-b627-fa3a695e9e49'),(2263,'Clients given 4L with Undetectable Viral Load','Clients given 4L with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L with Undetectable Viral Load\n Clients given 4L with Undetectable Viral Load\n \n 2023-08-07 18:55:39 UTC\n \n 2023-08-07 18:56:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2263\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:55:39',4,'2023-08-07 20:56:21',4,0,NULL,NULL,NULL,'38640382-c5f2-4174-b4b6-e05863aea4b8'),(2264,'Clients given 4C with good adherence','Clients given 4C with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C with good adherence\n Clients given 4C with good adherence\n \n 2023-08-09 09:38:59 UTC\n \n 2023-08-14 10:41:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2264\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2202)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-09 09:38:59',4,'2023-08-14 10:41:15',4,0,NULL,NULL,NULL,'80eda8e4-4432-4308-92bc-9c4a6d5835ba'),(2265,'Clients given 4D with good adherence','Clients given 4D with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D with good adherence\n Clients given 4D with good adherence\n \n 2023-08-09 09:40:40 UTC\n \n 2023-08-14 10:43:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2265\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4D \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2204)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-09 09:40:40',4,'2023-08-14 10:43:07',4,0,NULL,NULL,NULL,'50e6ed7b-8da6-420e-b00d-c5a7a6e8e618'),(2266,'Clients given 4E with good adherence','Clients given 4E with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E with good adherence\n Clients given 4E with good adherence\n \n 2023-08-09 09:40:58 UTC\n \n 2023-08-14 10:45:49 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2266\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3679)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-09 09:40:58',4,'2023-08-14 10:45:49',4,0,NULL,NULL,NULL,'c9adbf40-4d5f-4ca4-b388-4a4ee5c16f3e'),(2267,'Clients given 4F with good adherence','Clients given 4F with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F with good adherence\n Clients given 4F with good adherence\n \n 2023-08-09 09:49:16 UTC\n \n 2023-08-14 10:57:13 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2267\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3680)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-09 09:49:16',4,'2023-08-14 10:57:13',4,0,NULL,NULL,NULL,'691b7d00-855b-4869-8938-9502f8762962'),(2268,'Clients given 4G with good adherence','Clients given 4G with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G with good adherence\n Clients given 4G with good adherence\n \n 2023-08-09 09:49:37 UTC\n \n 2023-08-14 10:58:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2268\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4684)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-09 09:49:37',4,'2023-08-14 10:58:30',4,0,NULL,NULL,NULL,'d0f8da5f-e6aa-44af-9980-cd882429e8ac'),(2269,'Clients given 4H with good adherence','Clients given 4H with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H with good adherence\n Clients given 4H with good adherence\n \n 2023-08-09 09:49:55 UTC\n \n 2023-08-14 11:00:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2269\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4685)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-09 09:49:55',4,'2023-08-14 11:00:32',4,0,NULL,NULL,NULL,'90332338-8e76-4563-a7f1-f3f67ffa8f3b'),(2270,'Clients given 4J with good adherence','Clients given 4J with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J with good adherence\n Clients given 4J with good adherence\n \n 2023-08-09 09:54:49 UTC\n \n 2023-08-14 11:09:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2270\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4J \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-09 09:54:49',4,'2023-08-14 11:09:02',4,0,NULL,NULL,NULL,'888d3fd4-ad2c-4e7e-b07f-8c68a08ed1f4'),(2271,'Clients given 4K with good adherence','Clients given 4K with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K with good adherence\n Clients given 4K with good adherence\n \n 2023-08-09 09:55:07 UTC\n \n 2023-08-14 11:10:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2271\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4K \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-09 09:55:07',4,'2023-08-14 11:10:40',4,0,NULL,NULL,NULL,'def70332-aae8-450d-8e78-2b3f83574bc9'),(2272,'Clients given 4L with good adherence','Clients given 4L with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L with good adherence\n Clients given 4L with good adherence\n \n 2023-08-09 09:55:23 UTC\n \n 2023-08-14 11:14:33 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2272\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4L \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4688)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-09 09:55:23',4,'2023-08-14 11:14:33',4,0,NULL,NULL,NULL,'7d1751a3-47c6-406a-a631-90ed96f37660'),(2273,'clients given 4C with fair adherence','clients given 4C with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n clients given 4C with fair adherence\n clients given 4C with fair adherence\n \n 2023-08-09 10:04:32 UTC\n \n 2023-08-14 10:40:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2273\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2202)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-09 10:04:32',4,'2023-08-14 10:40:15',4,0,NULL,NULL,NULL,'15494d8b-bc16-4865-8561-a0f11bb906f5'),(2274,'clients given 4D with fair adherence','clients given 4D with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n clients given 4D with fair adherence\n clients given 4D with fair adherence\n \n 2023-08-09 10:04:52 UTC\n \n 2023-08-14 10:42:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2274\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4D \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2204)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-09 10:04:52',4,'2023-08-14 10:42:43',4,0,NULL,NULL,NULL,'3076328f-0cf6-496f-bcfc-ec00585bf8f7'),(2275,'clients given 4E with fair adherence','clients given 4E with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n clients given 4E with fair adherence\n clients given 4E with fair adherence\n \n 2023-08-09 10:05:09 UTC\n \n 2023-08-14 10:45:35 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2275\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3679)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-09 10:05:09',4,'2023-08-14 10:45:35',4,0,NULL,NULL,NULL,'8c441fe9-1c2f-4eba-9e14-3c13b7d0e22d'),(2276,'clients given 4F with fair adherence','clients given 4F with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n clients given 4F with fair adherence\n clients given 4F with fair adherence\n \n 2023-08-09 10:08:17 UTC\n \n 2023-08-14 10:56:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2276\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3680)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-09 10:08:17',4,'2023-08-14 10:56:58',4,0,NULL,NULL,NULL,'cb6f6a66-39fa-4584-8ad9-397be4e8acc0'),(2277,'clients given 4G with fair adherence','clients given 4G with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n clients given 4G with fair adherence\n clients given 4G with fair adherence\n \n 2023-08-09 10:09:12 UTC\n \n 2023-08-14 10:58:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2277\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4684)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-09 10:09:12',4,'2023-08-14 10:58:17',4,0,NULL,NULL,NULL,'456a7189-4a16-40fa-9702-abf6b2e8b707'),(2278,'Clients given 4H with fair adherence','Clients given 4H with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H with fair adherence\n Clients given 4H with fair adherence\n \n 2023-08-09 10:10:29 UTC\n \n 2023-08-14 11:00:09 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2278\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4685)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-09 10:10:29',4,'2023-08-14 11:00:09',4,0,NULL,NULL,NULL,'3cb85e60-1a5e-422c-b0af-fc15c8ba62ed'),(2279,'Clients given 4K with fair adherence','Clients given 4K with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K with fair adherence\n Clients given 4K with fair adherence\n \n 2023-08-09 10:17:56 UTC\n \n 2023-08-14 11:10:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2279\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4K \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-09 10:17:56',4,'2023-08-14 11:10:04',4,0,NULL,NULL,NULL,'cbd5b84d-066f-41a6-bd8b-bc81dc23c99d'),(2280,'Clients given 4J with fair adherence','Clients given 4J with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J with fair adherence\n Clients given 4J with fair adherence\n \n 2023-08-09 10:18:17 UTC\n \n 2023-08-14 11:08:38 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2280\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4J \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-09 10:18:17',4,'2023-08-14 11:08:38',4,0,NULL,NULL,NULL,'14b826bd-9709-497b-a02d-8fa8d4146faa'),(2281,'Clients given 4L with fair adherence','Clients given 4L with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L with fair adherence\n Clients given 4L with fair adherence\n \n 2023-08-09 10:21:31 UTC\n \n 2023-08-14 11:14:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2281\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4L \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-09 10:21:31',4,'2023-08-14 11:14:18',4,0,NULL,NULL,NULL,'62b94203-c51d-456f-87a6-dd15791f3d71'),(2282,'Clients given 4C with poor adherence','Clients given 4C with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C with poor adherence\n Clients given 4C with poor adherence\n \n 2023-08-09 10:45:41 UTC\n \n 2023-08-09 10:49:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2282\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 20 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2202)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-09 10:45:41',4,'2023-08-09 10:49:23',4,0,NULL,NULL,NULL,'769d8c15-f519-440d-acaf-e2640e2409bc'),(2283,'Clients given 4D with poor adherence','Clients given 4D with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D with poor adherence\n Clients given 4D with poor adherence\n \n 2023-08-09 10:46:02 UTC\n \n 2023-08-14 10:41:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2283\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4D \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2204)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-09 10:46:02',4,'2023-08-14 10:41:45',4,0,NULL,NULL,NULL,'f77a67fe-ac10-4c92-ab0c-98a5b4dfd5f1'),(2284,'Clients given 4E with poor adherence','Clients given 4E with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E with poor adherence\n Clients given 4E with poor adherence\n \n 2023-08-09 10:46:19 UTC\n \n 2023-08-14 10:45:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2284\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3679)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-09 10:46:19',4,'2023-08-14 10:45:20',4,0,NULL,NULL,NULL,'2eb584f9-1fbe-4c98-adec-b2feb88933b7'),(2285,'Clients given 4F with poor adherence','Clients given 4F with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F with poor adherence\n Clients given 4F with poor adherence\n \n 2023-08-09 10:50:41 UTC\n \n 2023-08-14 10:57:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2285\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3680)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-09 10:50:41',4,'2023-08-14 10:57:32',4,0,NULL,NULL,NULL,'3c5012df-c0bf-411b-a7d1-da092ade8986'),(2286,'Clients given 4G with poor adherence','Clients given 4G with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G with poor adherence\n Clients given 4G with poor adherence\n \n 2023-08-09 10:50:56 UTC\n \n 2023-08-14 10:58:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2286\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4684)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-09 10:50:56',4,'2023-08-14 10:58:45',4,0,NULL,NULL,NULL,'cdee04fe-950f-4b39-88bf-9736744da52f'),(2287,'Clients given 4H with poor adherence','Clients given 4H with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H with poor adherence\n Clients given 4H with poor adherence\n \n 2023-08-09 10:51:12 UTC\n \n 2023-08-14 11:00:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2287\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4685)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-09 10:51:12',4,'2023-08-14 11:00:59',4,0,NULL,NULL,NULL,'9a9175d4-c8ad-439e-b484-edb2345816ad'),(2288,'Clients given 4L with poor adherence','Clients given 4L with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L with poor adherence\n Clients given 4L with poor adherence\n \n 2023-08-09 10:55:46 UTC\n \n 2023-08-14 11:14:48 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2288\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4L \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4688)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-09 10:55:46',4,'2023-08-14 11:14:48',4,0,NULL,NULL,NULL,'5b38ffa0-ea56-4cda-b3cf-03d1b83e7889'),(2289,'Clients given 4K with poor adherence','Clients given 4K with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K with poor adherence\n Clients given 4K with poor adherence\n \n 2023-08-09 10:56:07 UTC\n \n 2023-08-14 11:10:52 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2289\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4K \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-09 10:56:07',4,'2023-08-14 11:10:52',4,0,NULL,NULL,NULL,'1c393c0d-a2e3-4223-9b24-848d235e7a19'),(2290,'Clients given 4J with poor adherence','Clients given 4J with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J with poor adherence\n Clients given 4J with poor adherence\n \n 2023-08-09 10:56:28 UTC\n \n 2023-08-14 11:09:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2290\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4J \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-09 10:56:28',4,'2023-08-14 11:09:18',4,0,NULL,NULL,NULL,'47569cef-3b90-4fbf-9558-b7a4afb195ab'),(2291,'Children ARV Regimen_1stLine_Adherence','Children ARV Regimen_1stLine_Adherence','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_Adherence\n Children ARV Regimen_1stLine_Adherence\n \n 2023-08-09 19:25:53 UTC\n \n 2023-08-09 19:26:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2291\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-09 19:25:53',4,'2023-08-09 19:26:39',4,0,NULL,NULL,NULL,'dcdcb494-6ca6-47a5-aaac-92decc868c82'),(2292,'Children ARV Regimen_1stLine_Adherence Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_Adherence Data Set\n \n 2023-08-09 19:26:39 UTC\n \n 2023-08-10 09:42:22 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2292\n \n \n \n 4C_fair\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n \n \n 4C_good\n \n \n \n \n \n \n \n \n \n 4C_poor\n \n \n \n \n \n \n \n \n \n 4D_fair\n \n \n \n \n \n \n \n \n \n 4D_good\n \n \n \n \n \n \n \n \n \n 4D_poor\n \n \n \n \n \n \n \n \n \n 4E_fair\n \n \n \n \n \n \n \n \n \n 4E_good\n \n \n \n \n \n \n \n \n \n 4E_poor\n \n \n \n \n \n \n \n \n \n 4F_fair\n \n \n \n \n \n \n \n \n \n 4F_good\n \n \n \n \n \n \n \n \n \n 4F_poor\n \n \n \n \n \n \n \n \n \n 4G_fair\n \n \n \n \n \n \n \n \n \n 4G_good\n \n \n \n \n \n \n \n \n \n 4G_poor\n \n \n \n \n \n \n \n \n \n 4H_fair\n \n \n \n \n \n \n \n \n \n 4H_good\n \n \n \n \n \n \n \n \n \n 4H_poor\n \n \n \n \n \n \n \n \n \n 4J_fair\n \n \n \n \n \n \n \n \n \n 4J_good\n \n \n \n \n \n \n \n \n \n 4J_poor\n \n \n \n \n \n \n \n \n \n 4K_fair\n \n \n \n \n \n \n \n \n \n 4K_good\n \n \n \n \n \n \n \n \n \n 4K_poor\n \n \n \n \n \n \n \n \n \n 4L_fair\n \n \n \n \n \n \n \n \n \n 4L_good\n \n \n \n \n \n \n \n \n \n 4L_poor\n \n \n \n \n \n \n \n \n \n','2023-08-09 19:26:39',4,'2023-08-10 09:42:22',4,0,NULL,NULL,NULL,'129f4cce-9154-4509-8649-9b3ed22fe029'),(2293,'Clients given 4C with good adherence','Clients given 4C with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C with good adherence\n Clients given 4C with good adherence\n \n 2023-08-09 19:34:37 UTC\n \n 2023-08-09 19:40:19 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2293\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 19:34:37',4,'2023-08-09 19:40:19',4,0,NULL,NULL,NULL,'9aebf6da-cf9b-45ed-bbdd-861ff4c0fd41'),(2294,'Clients given 4C with fair adherence','Clients given 4C with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C with fair adherence\n Clients given 4C with fair adherence\n \n 2023-08-09 19:34:50 UTC\n \n 2023-08-09 19:39:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2294\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 19:34:50',4,'2023-08-09 19:39:36',4,0,NULL,NULL,NULL,'ae06dd89-8f3d-4448-bab9-212196f1660d'),(2295,'Clients given 4C with poor adherence','Clients given 4C with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C with poor adherence\n Clients given 4C with poor adherence\n \n 2023-08-09 19:35:01 UTC\n \n 2023-08-09 19:39:57 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2295\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 19:35:01',4,'2023-08-09 19:39:57',4,0,NULL,NULL,NULL,'88e3d929-46c6-4698-b83e-81552c4b0078'),(2296,'Clients given 4D with good adherence','Clients given 4D with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D with good adherence\n Clients given 4D with good adherence\n \n 2023-08-09 19:43:04 UTC\n \n 2023-08-09 19:46:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2296\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 19:43:04',4,'2023-08-09 19:46:08',4,0,NULL,NULL,NULL,'7b0d9987-2436-479b-b186-682878585356'),(2297,'Clients given 4D with fair adherence','Clients given 4D with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D with fair adherence\n Clients given 4D with fair adherence\n \n 2023-08-09 19:43:10 UTC\n \n 2023-08-09 19:46:35 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2297\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 19:43:10',4,'2023-08-09 19:46:35',4,0,NULL,NULL,NULL,'6e70eb0d-55a5-4cc0-b79e-4e80bf25978d'),(2298,'Clients given 4D with poor adherence','Clients given 4D with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D with poor adherence\n Clients given 4D with poor adherence\n \n 2023-08-09 19:43:23 UTC\n \n 2023-08-09 19:47:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2298\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 19:43:23',4,'2023-08-09 19:47:01',4,0,NULL,NULL,NULL,'dde54d37-4aab-443f-9b40-2fe211fc296a'),(2299,'Clients given 4E with good adherence','Clients given 4E with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E with good adherence\n Clients given 4E with good adherence\n \n 2023-08-09 19:47:57 UTC\n \n 2023-08-09 19:52:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2299\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 19:47:57',4,'2023-08-09 19:52:12',4,0,NULL,NULL,NULL,'8572efe5-f3ea-463f-8abf-fe4086a2aaf7'),(2300,'clients given 4E with fair adherence','Clients given 4E with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n clients given 4E with fair adherence\n Clients given 4E with fair adherence\n \n 2023-08-09 19:48:21 UTC\n \n 2023-08-09 19:53:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2300\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 19:48:21',4,'2023-08-09 19:53:51',4,0,NULL,NULL,NULL,'9157aa83-9a8f-4598-933d-06a98e849b9c'),(2301,'Clients given 4E with poor adherence','Clients given 4E with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E with poor adherence\n Clients given 4E with poor adherence\n \n 2023-08-09 19:49:01 UTC\n \n 2023-08-09 19:54:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2301\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 19:49:01',4,'2023-08-09 19:54:14',4,0,NULL,NULL,NULL,'134c2069-3e31-41df-8845-18839686bfba'),(2302,'Clients given 4F with good adherence','Clients given 4F with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F with good adherence\n Clients given 4F with good adherence\n \n 2023-08-09 19:55:08 UTC\n \n 2023-08-09 19:57:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2302\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 19:55:08',4,'2023-08-09 19:57:55',4,0,NULL,NULL,NULL,'d6358532-78d0-4095-9fcb-edf9bc09f548'),(2303,'clients given 4F with fair adherence','clients given 4F with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n clients given 4F with fair adherence\n clients given 4F with fair adherence\n \n 2023-08-09 19:55:30 UTC\n \n 2023-08-09 19:59:24 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2303\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 19:55:30',4,'2023-08-09 19:59:24',4,0,NULL,NULL,NULL,'25550508-c457-4534-9385-9c35fe182a5e'),(2304,'Clients given 4F with poor adherence','Clients given 4F with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F with poor adherence\n Clients given 4F with poor adherence\n \n 2023-08-09 19:56:13 UTC\n \n 2023-08-09 19:59:49 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2304\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 19:56:13',4,'2023-08-09 19:59:49',4,0,NULL,NULL,NULL,'de1988bb-4fda-4d70-b77a-569364cb3880'),(2305,'Clients given 4G with good adherence','Clients given 4G with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G with good adherence\n Clients given 4G with good adherence\n \n 2023-08-09 20:00:32 UTC\n \n 2023-08-09 20:04:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2305\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 20:00:32',4,'2023-08-09 20:04:29',4,0,NULL,NULL,NULL,'f15e2c6d-1a13-45c8-b80e-33982967f9ee'),(2306,'Clients given 4G with poor adherence','Clients given 4G with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G with poor adherence\n Clients given 4G with poor adherence\n \n 2023-08-09 20:01:35 UTC\n \n 2023-08-09 20:05:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2306\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 20:01:35',4,'2023-08-09 20:05:36',4,0,NULL,NULL,NULL,'9b6c2db1-dea2-4afa-b20c-391c4985795c'),(2307,'clients given 4G with fair adherence','clients given 4G with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n clients given 4G with fair adherence\n clients given 4G with fair adherence\n \n 2023-08-09 20:01:43 UTC\n \n 2023-08-09 20:04:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2307\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 20:01:43',4,'2023-08-09 20:04:58',4,0,NULL,NULL,NULL,'b7856cf5-f989-45fd-8da6-f0ba354e3e96'),(2308,'Clients given 4H with good adherence','Clients given 4H with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H with good adherence\n Clients given 4H with good adherence\n \n 2023-08-09 20:06:49 UTC\n \n 2023-08-09 20:10:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2308\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 20:06:49',4,'2023-08-09 20:10:41',4,0,NULL,NULL,NULL,'cfb7a7c6-30e8-4f10-a55b-faff56674767'),(2309,'Clients given 4H with fair adherence','Clients given 4H with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H with fair adherence\n Clients given 4H with fair adherence\n \n 2023-08-09 20:07:01 UTC\n \n 2023-08-09 20:10:57 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2309\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 20:07:01',4,'2023-08-09 20:10:57',4,0,NULL,NULL,NULL,'5df6e5f1-3116-49e6-a896-df143af3004e'),(2310,'Clients given 4H with poor adherence','Clients given 4H with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H with poor adherence\n Clients given 4H with poor adherence\n \n 2023-08-09 20:07:57 UTC\n \n 2023-08-09 20:13:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2310\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 20:07:57',4,'2023-08-09 20:13:06',4,0,NULL,NULL,NULL,'65132fb3-cc4a-4859-8cbf-2f26ad87c444'),(2311,'Clients given 4J with fair adherence','Clients given 4J with fair adherence\r\n','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J with fair adherence\n Clients given 4J with fair adherence \n\n \n 2023-08-09 20:13:40 UTC\n \n 2023-08-09 20:17:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2311\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 20:13:40',4,'2023-08-09 20:17:28',4,0,NULL,NULL,NULL,'7396bec4-26e5-46ae-9751-217c77d66d44'),(2312,'Clients given 4J with good adherence','Clients given 4J with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J with good adherence\n Clients given 4J with good adherence\n \n 2023-08-09 20:13:48 UTC\n \n 2023-08-09 20:17:09 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2312\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 20:13:48',4,'2023-08-09 20:17:09',4,0,NULL,NULL,NULL,'b7ecce5a-9011-4c8a-a77b-538d579acf4a'),(2313,'Clients given 4J with poor adherence','Clients given 4J with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J with poor adherence\n Clients given 4J with poor adherence\n \n 2023-08-09 20:14:07 UTC\n \n 2023-08-09 20:17:52 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2313\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 20:14:07',4,'2023-08-09 20:17:52',4,0,NULL,NULL,NULL,'21d68248-3137-4f24-89b3-702c4c86b258'),(2314,'Clients given 4K with good adherence','Clients given 4K with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K with good adherence\n Clients given 4K with good adherence\n \n 2023-08-09 20:19:21 UTC\n \n 2023-08-09 20:22:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2314\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 20:19:21',4,'2023-08-09 20:22:30',4,0,NULL,NULL,NULL,'898b11a3-3876-45bc-a327-207de5a91288'),(2315,'Clients given 4K with fair adherence','Clients given 4K with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K with fair adherence\n Clients given 4K with fair adherence\n \n 2023-08-09 20:19:40 UTC\n \n 2023-08-09 20:23:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2315\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 20:19:40',4,'2023-08-09 20:23:00',4,0,NULL,NULL,NULL,'01cd007c-98e1-4a76-91a3-35dde1c4b25b'),(2316,'Clients given 4K with poor adherence','Clients given 4K with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K with poor adherence\n Clients given 4K with poor adherence\n \n 2023-08-09 20:20:07 UTC\n \n 2023-08-09 20:23:47 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2316\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 20:20:07',4,'2023-08-09 20:23:47',4,0,NULL,NULL,NULL,'4feeb398-2818-460e-8e2c-3df8a27c5c68'),(2317,'Clients given 4L with good adherence','Clients given 4L with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L with good adherence\n Clients given 4L with good adherence\n \n 2023-08-09 20:25:36 UTC\n \n 2023-08-09 20:29:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2317\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 20:25:36',4,'2023-08-09 20:29:06',4,0,NULL,NULL,NULL,'6f28a61d-320a-49a5-8bf5-fc9e9c68cf5e'),(2318,'Clients given 4L with fair adherence','Clients given 4L with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L with fair adherence\n Clients given 4L with fair adherence\n \n 2023-08-09 20:25:55 UTC\n \n 2023-08-09 20:29:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2318\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 20:25:55',4,'2023-08-09 20:29:26',4,0,NULL,NULL,NULL,'58759e6a-e8d0-4eca-9a01-610e7d2f27c6'),(2319,'Clients given 4L with poor adherence','Clients given 4L with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L with poor adherence\n Clients given 4L with poor adherence\n \n 2023-08-09 20:26:12 UTC\n \n 2023-08-09 20:29:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2319\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 20:26:12',4,'2023-08-09 20:29:45',4,0,NULL,NULL,NULL,'3dfc43b9-8bf9-4833-890a-88876f8da47c'),(2321,'Children ARV Regimen_2ndLine_5A','Children ARV Regimen_2ndLine_5A disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5A\n Children ARV Regimen_2ndLine_5A disaggregated by weight, sex, age\n \n 2023-08-15 17:48:13 UTC\n \n 2023-08-15 19:23:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2321\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-15 19:48:13',4,'2023-08-15 21:23:02',4,0,NULL,NULL,NULL,'37b51d3f-838d-4211-aced-12371e6a7493'),(2322,'Children ARV Regimen_1stLine_5A Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_5A Data Set\n \n 2023-08-15 17:48:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n \n \n','2023-08-15 19:48:21',4,NULL,NULL,0,NULL,NULL,NULL,'6b9d88ee-8215-4be6-89f5-2b6dbec7d979'),(2323,'Children ARV Regimen_1stLine_5A Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_5A Data Set\n \n 2023-08-15 17:48:43 UTC\n \n 2023-08-16 10:53:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2323\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4y0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4y10-13\n \n \n \n \n \n \n \n \n \n F1-4y14-19\n \n \n \n \n \n \n \n \n \n F1-4y20-24\n \n \n \n \n \n \n \n \n \n F1-4y25-34\n \n \n \n \n \n \n \n \n \n F1-4y4-5\n \n \n \n \n \n \n \n \n \n F1-4y6-9\n \n \n \n \n \n \n \n \n \n F1-4y>=35\n \n \n \n \n \n \n \n \n \n F10-14y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14y10-\n \n \n \n \n \n \n F10-14y14-\n \n \n \n \n \n \n F10-14y20-\n \n \n \n \n \n \n F10-14y25-\n \n \n \n \n \n \n F10-14y4-5\n \n \n \n \n \n \n F10-14y6-9\n \n \n \n \n \n \n F10-14y>=3\n \n \n \n \n \n \n F5-9y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9y10-13\n \n \n \n \n \n \n F5-9y14-19\n \n \n \n \n \n \n F5-9y20-24\n \n \n \n \n \n \n F5-9y25-34\n \n \n \n \n \n \n F5-9y4-5\n \n \n \n \n \n \n F5-9y6-9\n \n \n \n \n \n \n F5-9y>=35\n \n \n \n \n \n \n F<1y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1y10-13\n \n \n \n \n \n \n F<1y14-19\n \n \n \n \n \n \n F<1y20-24\n \n \n \n \n \n \n F<1y25-34\n \n \n \n \n \n \n F<1y4-5\n \n \n \n \n \n \n F<1y6-9\n \n \n \n \n \n \n F<1y>=35\n \n \n \n \n \n \n M1-4y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4y10-13\n \n \n \n \n \n \n \n \n \n M1-4y14-19\n \n \n \n \n \n \n M1-4y20-24\n \n \n \n \n \n \n M1-4y25-34\n \n \n \n \n \n \n M1-4y4-5\n \n \n \n \n \n \n M1-4y6-9\n \n \n \n \n \n \n M1-4y>=35\n \n \n \n \n \n \n M10-14y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14y10-\n \n \n \n \n \n \n M10-14y14-\n \n \n \n \n \n \n M10-14y20-\n \n \n \n \n \n \n M10-14y25-\n \n \n \n \n \n \n M10-14y4-5\n \n \n \n \n \n \n M10-14y6-9\n \n \n \n \n \n \n M10-14y>=3\n \n \n \n \n \n \n M5-9y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9y10-13\n \n \n \n \n \n \n M5-9y14-19\n \n \n \n \n \n \n M5-9y20-24\n \n \n \n \n \n \n M5-9y25-34\n \n \n \n \n \n \n M5-9y4-5\n \n \n \n \n \n \n M5-9y6-9\n \n \n \n \n \n \n M5-9y>=35\n \n \n \n \n \n \n M<1y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1y10-13\n \n \n \n \n \n \n M<1y14-19\n \n \n \n \n \n \n M<1y20-24\n \n \n \n \n \n \n M<1y25-34\n \n \n \n \n \n \n \n \n \n M<1y4-5\n \n \n \n \n \n \n M<1y6-9\n \n \n \n \n \n \n M<1y>=35\n \n \n \n \n \n \n','2023-08-15 19:48:43',4,'2023-08-16 12:53:15',4,0,NULL,NULL,NULL,'1311fb91-2a90-44c5-876f-0bf0284580f4'),(2324,'Children ARV Regimen_3rdLine_6A','Children ARV Regimen_3rdLine_6A disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_6A\n Children ARV Regimen_3rdLine_6A disaggregated by weight, sex, age\n \n 2023-08-15 19:27:09 UTC\n \n 2023-08-15 19:27:54 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2324\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-15 21:27:09',4,'2023-08-15 21:27:54',4,0,NULL,NULL,NULL,'2478792b-752a-4b20-97f7-5033810e1ba8'),(2325,'Children ARV Regimen_3rdLine_6A Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_6A Data Set\n \n 2023-08-15 19:27:54 UTC\n \n 2023-08-15 21:23:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2325\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4yr0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4yr10-1\n \n \n \n \n \n \n \n \n \n F1-4yr14-1\n \n \n \n \n \n \n \n \n \n F1-4yr20-2\n \n \n \n \n \n \n \n \n \n F1-4yr25-3\n \n \n \n \n \n \n \n \n \n F1-4yr4-5\n \n \n \n \n \n \n \n \n \n F1-4yr6-9\n \n \n \n \n \n \n \n \n \n F1-4yr>=35\n \n \n \n \n \n \n \n \n \n F10-14yr0-\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14yr10\n \n \n \n \n \n \n F10-14yr14\n \n \n \n \n \n \n F10-14yr20\n \n \n \n \n \n \n F10-14yr25\n \n \n \n \n \n \n F10-14yr4-\n \n \n \n \n \n \n F10-14yr6\n \n \n \n \n \n \n F10-14yr>=\n \n \n \n \n \n \n F5-9yr0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9yr10-1\n \n \n \n \n \n \n F5-9yr14-1\n \n \n \n \n \n \n F5-9yr20-2\n \n \n \n \n \n \n F5-9yr25-3\n \n \n \n \n \n \n F5-9yr4-5\n \n \n \n \n \n \n F5-9yr6-9\n \n \n \n \n \n \n F5-9yr>=35\n \n \n \n \n \n \n F<1y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1yr10-13\n \n \n \n \n \n \n F<1yr14-19\n \n \n \n \n \n \n F<1yr20-24\n \n \n \n \n \n \n F<1yr25-34\n \n \n \n \n \n \n F<1yr4-5\n \n \n \n \n \n \n F<1yr6-9\n \n \n \n \n \n \n F<1yr>=35\n \n \n \n \n \n \n M1-4yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4yr10-1\n \n \n \n \n \n \n M1-4yr14-1\n \n \n \n \n \n \n M1-4yr20-2\n \n \n \n \n \n \n M1-4yr25-3\n \n \n \n \n \n \n M1-4yr4-5\n \n \n \n \n \n \n M1-4yr6-9\n \n \n \n \n \n \n M1-4yr>=35\n \n \n \n \n \n \n M10-14yr0-\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14yr10\n \n \n \n \n \n \n M10-14yr14\n \n \n \n \n \n \n M10-14yr20\n \n \n \n \n \n \n M10-14yr25\n \n \n \n \n \n \n M10-14yr4-\n \n \n \n \n \n \n M10-14yr6-\n \n \n \n \n \n \n M10-14yr>=\n \n \n \n \n \n \n M5-9yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9yr10-1\n \n \n \n \n \n \n M5-9yr14-1\n \n \n \n \n \n \n M5-9yr20-2\n \n \n \n \n \n \n M5-9yr25-3\n \n \n \n \n \n \n M5-9yr4-5\n \n \n \n \n \n \n M5-9yr6-9\n \n \n \n \n \n \n M5-9yr>=35\n \n \n \n \n \n \n M<1yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1yr10-13\n \n \n \n \n \n \n M<1yr14-19\n \n \n \n \n \n \n M<1yr20-24\n \n \n \n \n \n \n M<1yr25-34\n \n \n \n \n \n \n M<1yr4-5\n \n \n \n \n \n \n M<1yr6-9\n \n \n \n \n \n \n M<1yr>=35\n \n \n \n \n \n \n','2023-08-15 21:27:54',4,'2023-08-15 23:23:05',4,0,NULL,NULL,NULL,'0e0b0b1e-e085-4f4f-af07-c44587b0d8f2'),(2326,'Children ARV Regimen_2ndLine_5B','Children ARV Regimen_2ndLine_5B disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5B\n Children ARV Regimen_2ndLine_5B disaggregated by weight, sex, age\n \n 2023-08-15 19:42:04 UTC\n \n 2023-08-15 19:42:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2326\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-15 21:42:04',4,'2023-08-15 21:42:28',4,0,NULL,NULL,NULL,'85cddf9e-e519-40f9-9df5-e1d36c7c2b27'),(2327,'Children ARV Regimen_2ndLine_5B Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5B Data Set\n \n 2023-08-15 19:42:28 UTC\n \n 2023-08-16 10:02:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2327\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4y0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4y10-13\n \n \n \n \n \n \n \n \n \n F1-4y14-19\n \n \n \n \n \n \n \n \n \n F1-4y20-24\n \n \n \n \n \n \n \n \n \n F1-4y25-34\n \n \n \n \n \n \n \n \n \n F1-4y4-5\n \n \n \n \n \n \n \n \n \n F1-4y6-9\n \n \n \n \n \n \n \n \n \n F1-4y>=35\n \n \n \n \n \n \n \n \n \n F10-14y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14y10-\n \n \n \n \n \n \n \n \n \n F10-14y14-\n \n \n \n \n \n \n F10-14y20-\n \n \n \n \n \n \n F10-14y25-\n \n \n \n \n \n \n F10-14y4-5\n \n \n \n \n \n \n F10-14y6-9\n \n \n \n \n \n \n F10-14y>=3\n \n \n \n \n \n \n F5-9y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9y10-13\n \n \n \n \n \n \n F5-9y14-19\n \n \n \n \n \n \n F5-9y20-24\n \n \n \n \n \n \n F5-9y25-34\n \n \n \n \n \n \n F5-9y4-5\n \n \n \n \n \n \n F5-9y6-9\n \n \n \n \n \n \n F5-9y>=35\n \n \n \n \n \n \n F<1y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1y10-13\n \n \n \n \n \n \n F<1y14-19\n \n \n \n \n \n \n F<1y20-24\n \n \n \n \n \n \n F<1y25-34\n \n \n \n \n \n \n F<1y4-5\n \n \n \n \n \n \n F<1y6-9\n \n \n \n \n \n \n F<1y>=35\n \n \n \n \n \n \n M1-4y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4y10-14\n \n \n \n \n \n \n M1-4y14-19\n \n \n \n \n \n \n M1-4y20-24\n \n \n \n \n \n \n M1-4y25-34\n \n \n \n \n \n \n M1-4y4-5\n \n \n \n \n \n \n M1-4y6-9\n \n \n \n \n \n \n M1-4y>=35\n \n \n \n \n \n \n M10-14y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14y10-\n \n \n \n \n \n \n M10-14y14-\n \n \n \n \n \n \n M10-14y20-\n \n \n \n \n \n \n M10-14y25-\n \n \n \n \n \n \n M10-14y4-5\n \n \n \n \n \n \n M10-14y6-9\n \n \n \n \n \n \n M10-14y>=3\n \n \n \n \n \n \n M5-9y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9y10-13\n \n \n \n \n \n \n M5-9y14-19\n \n \n \n \n \n \n M5-9y20-24\n \n \n \n \n \n \n M5-9y25-34\n \n \n \n \n \n \n M5-9y4-5\n \n \n \n \n \n \n M5-9y6-9\n \n \n \n \n \n \n M5-9y>=35\n \n \n \n \n \n \n M<1y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1y10-13\n \n \n \n \n \n \n M<1y14-19\n \n \n \n \n \n \n M<1y20-24\n \n \n \n \n \n \n M<1y25-34\n \n \n \n \n \n \n M<1y4-5\n \n \n \n \n \n \n M<1y6-9\n \n \n \n \n \n \n M<1y>=35\n \n \n \n \n \n \n','2023-08-15 21:42:28',4,'2023-08-16 12:02:14',4,0,NULL,NULL,NULL,'b217699a-cf93-4478-8b85-8f59939d020a'),(2328,'Children ARV Regimen_3rdLine_6B ','Children ARV Regimen_3rdLine_6B disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_6B \n Children ARV Regimen_3rdLine_6B disaggregated by weight, sex, age\n \n 2023-08-16 08:51:49 UTC\n \n 2023-08-16 08:53:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2328\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-16 10:51:49',4,'2023-08-16 10:53:21',4,0,NULL,NULL,NULL,'1f0f9f2c-575a-462f-be70-5b8774c58cd6'),(2329,'Children ARV Regimen_3rdLine_6B Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_6B Data Set\n \n 2023-08-16 08:53:21 UTC\n \n 2023-08-16 11:15:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2329\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4yr0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4yr10-1\n \n \n \n \n \n \n \n \n \n F1-4yr14-1\n \n \n \n \n \n \n \n \n \n F1-4yr20-2\n \n \n \n \n \n \n \n \n \n F1-4yr25-3\n \n \n \n \n \n \n \n \n \n F1-4yr4-5\n \n \n \n \n \n \n \n \n \n F1-4yr6-9\n \n \n \n \n \n \n \n \n \n F1-4yr>=35\n \n \n \n \n \n \n \n \n \n F10-14yr0-\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14yr10\n \n \n \n \n \n \n F10-14yr14\n \n \n \n \n \n \n F10-14yr20\n \n \n \n \n \n \n F10-14yr25\n \n \n \n \n \n \n F10-14yr4-\n \n \n \n \n \n \n F10-14yr6-\n \n \n \n \n \n \n F10-14yr>=\n \n \n \n \n \n \n F5-9yr0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9yr10-1\n \n \n \n \n \n \n F5-9yr14-1\n \n \n \n \n \n \n F5-9yr20-2\n \n \n \n \n \n \n F5-9yr25-3\n \n \n \n \n \n \n F5-9yr4-5\n \n \n \n \n \n \n F5-9yr6-9\n \n \n \n \n \n \n F5-9yr>=35\n \n \n \n \n \n \n F<1yr0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1yr10-13\n \n \n \n \n \n \n F<1yr14-19\n \n \n \n \n \n \n F<1yr20-24\n \n \n \n \n \n \n F<1yr25-34\n \n \n \n \n \n \n F<1yr4-5\n \n \n \n \n \n \n F<1yr6-9\n \n \n \n \n \n \n F<1yr>=35\n \n \n \n \n \n \n M1-4yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4yr10-1\n \n \n \n \n \n \n M1-4yr14-1\n \n \n \n \n \n \n M1-4yr20-2\n \n \n \n \n \n \n M1-4yr25-3\n \n \n \n \n \n \n M1-4yr4-5\n \n \n \n \n \n \n M1-4yr6-9\n \n \n \n \n \n \n M1-4yr>=35\n \n \n \n \n \n \n M10-14yr0-\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14yr10\n \n \n \n \n \n \n M10-14yr14\n \n \n \n \n \n \n M10-14yr20\n \n \n \n \n \n \n M10-14yr25\n \n \n \n \n \n \n M10-14yr4-\n \n \n \n \n \n \n M10-14yr6-\n \n \n \n \n \n \n M10-14yr>=\n \n \n \n \n \n \n M5-9yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9yr10-1\n \n \n \n \n \n \n M5-9yr14-1\n \n \n \n \n \n \n M5-9yr20-2\n \n \n \n \n \n \n M5-9yr25-3\n \n \n \n \n \n \n M5-9yr4-5\n \n \n \n \n \n \n M5-9yr6-9\n \n \n \n \n \n \n M5-9yr>=35\n \n \n \n \n \n \n M<1yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1yr10-13\n \n \n \n \n \n \n M<1yr14-19\n \n \n \n \n \n \n M<1yr20-24\n \n \n \n \n \n \n M<1yr25-34\n \n \n \n \n \n \n M<1yr4-5\n \n \n \n \n \n \n M<1yr6-9\n \n \n \n \n \n \n M<1yr>=35\n \n \n \n \n \n \n','2023-08-16 10:53:21',4,'2023-08-16 13:15:59',4,0,NULL,NULL,NULL,'983588a7-5b66-41ef-ad94-a32596694717'),(2330,'HIV Lost To Follow Up','HIV patients who have not been seen for at least 18 months','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HIV Lost To Follow Up\n HIV patients who have not been seen for at least 18 months\n \n 2023-08-16 09:25:57 UTC\n \n \n lastExecutionTime\n \n java.util.Date\n true\n \n \n \n \n /* \n * Name:HIV Lost To Follow Up \n * Query Type: SQL Cohort Query \n * Description: HIV patients who have not been seen for at least 18 months \n * Assumption: Database has only HIV patients \n * HIV Case Reporting Module has already excluded patients previously added to the list. \n */ \n \n SELECT e2.patient_id \n FROM ( \n SELECT e1.patient_id, max(e1.encounter_datetime) as latest_encounter_date \n FROM encounter e1 \n WHERE not e1.voided \n GROUP BY e1.patient_id \n ) as e2 \n WHERE \n date(e2.latest_encounter_date) <= DATE_SUB(now(), INTERVAL 18 MONTH) \n AND \n date(e2.latest_encounter_date) > DATE_SUB(:lastExecutionTime, INTERVAL 18 MONTH); \n\n','2023-08-16 11:25:57',2,NULL,NULL,0,NULL,NULL,NULL,'8916dca2-85b6-4eea-b921-d5cffe1056d4'),(2331,'HIV Patient Died','HIV patients who have died','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HIV Patient Died\n HIV patients who have died\n \n 2023-08-16 09:25:57 UTC\n \n \n lastExecutionTime\n \n java.util.Date\n true\n \n \n \n \n /* \n * Name:HIV Patient Died \n * Query Type: SQL Cohort Query \n * Description: HIV patients who have died \n * Assumption: Database has only HIV patients \n * HIV Case Reporting Module has already excluded patients previously added to the list. \n */ \n \n SELECT person_id \n FROM person \n WHERE dead = 1 \n AND( \n date_created >= date(:lastExecutionTime) \n OR date_changed >= date(:lastExecutionTime) \n ) \n AND not voided; \n\n','2023-08-16 11:25:57',2,NULL,NULL,0,NULL,NULL,NULL,'d8cb3c40-0d86-4448-8f1f-cf4cd91ece26'),(2333,'Children ARV Regimen_2ndLine_5C','Children ARV Regimen_2ndLine_5C disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5C\n Children ARV Regimen_2ndLine_5C disaggregated by weight, sex, age\n \n 2023-08-16 10:14:20 UTC\n \n 2023-08-16 10:14:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2333\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-16 12:14:20',4,'2023-08-16 12:14:36',4,0,NULL,NULL,NULL,'38a458f9-cb42-4eb7-9b3a-22be06efe0e5'),(2334,'Children ARV Regimen_2ndLine_5C Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5C Data Set\n \n 2023-08-16 10:14:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n \n \n','2023-08-16 12:14:27',4,NULL,NULL,0,NULL,NULL,NULL,'2d670708-bd88-4e83-b9fa-9a0b6d137ea1'),(2335,'Children ARV Regimen_2ndLine_5C Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5C Data Set\n \n 2023-08-16 10:14:36 UTC\n \n 2023-08-16 11:42:37 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2335\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4y0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4y10-13\n \n \n \n \n \n \n \n \n \n F1-4y14-19\n \n \n \n \n \n \n \n \n \n F1-4y20-24\n \n \n \n \n \n \n \n \n \n F1-4y25-34\n \n \n \n \n \n \n \n \n \n F1-4y4-5\n \n \n \n \n \n \n \n \n \n F1-4y6-9\n \n \n \n \n \n \n \n \n \n F1-4y>=35\n \n \n \n \n \n \n \n \n \n F10-14y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14y10-\n \n \n \n \n \n \n F10-14y14-\n \n \n \n \n \n \n F10-14y20-\n \n \n \n \n \n \n F10-14y25-\n \n \n \n \n \n \n F10-14y4-5\n \n \n \n \n \n \n F10-14y6-9\n \n \n \n \n \n \n \n \n \n F10-14y>=3\n \n \n \n \n \n \n F5-9y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9y10-13\n \n \n \n \n \n \n F5-9y14-19\n \n \n \n \n \n \n \n \n \n F5-9y20-24\n \n \n \n \n \n \n F5-9y25-34\n \n \n \n \n \n \n F5-9y4-5\n \n \n \n \n \n \n F5-9y6-9\n \n \n \n \n \n \n F5-9y>=35\n \n \n \n \n \n \n F<1y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1y10-13\n \n \n \n \n \n \n F<1y14-19\n \n \n \n \n \n \n F<1y20-24\n \n \n \n \n \n \n F<1y25-34\n \n \n \n \n \n \n F<1y4-9\n \n \n \n \n \n \n F<1y6-9\n \n \n \n \n \n \n F<1y>=35\n \n \n \n \n \n \n M1-4y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4y10-13\n \n \n \n \n \n \n M1-4y14-19\n \n \n \n \n \n \n M1-4y20-24\n \n \n \n \n \n \n \n \n \n M1-4y25-34\n \n \n \n \n \n \n M1-4y4-5\n \n \n \n \n \n \n M1-4y6-9\n \n \n \n \n \n \n M1-4y>=35\n \n \n \n \n \n \n M10-14y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14y10-\n \n \n \n \n \n \n M10-14y14-\n \n \n \n \n \n \n \n \n \n M10-14y20-\n \n \n \n \n \n \n M10-14y25-\n \n \n \n \n \n \n M10-14y4-5\n \n \n \n \n \n \n M10-14y6-9\n \n \n \n \n \n \n M10-14y>=3\n \n \n \n \n \n \n M5-9y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9y10-13\n \n \n \n \n \n \n M5-9y14-19\n \n \n \n \n \n \n M5-9y20-24\n \n \n \n \n \n \n M5-9y25-34\n \n \n \n \n \n \n M5-9y4-5\n \n \n \n \n \n \n M5-9y6-9\n \n \n \n \n \n \n M5-9y>=35\n \n \n \n \n \n \n M<1y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1y10-13\n \n \n \n \n \n \n M<1y14-19\n \n \n \n \n \n \n M<1y20-24\n \n \n \n \n \n \n M<1y24-34\n \n \n \n \n \n \n M<1y5-9\n \n \n \n \n \n \n M<1y6-9\n \n \n \n \n \n \n M<1y>=35\n \n \n \n \n \n \n','2023-08-16 12:14:36',4,'2023-08-16 13:42:37',4,0,NULL,NULL,NULL,'5add0ab6-3850-4623-ad50-8f5d30ba2df9'),(2336,'Children ARV Regimen_2ndLine_5D','Children ARV Regimen_2ndLine_5D disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5D\n Children ARV Regimen_2ndLine_5D disaggregated by weight, sex, age\n \n 2023-08-16 11:00:11 UTC\n \n 2023-08-16 11:00:49 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2336\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-16 13:00:11',4,'2023-08-16 13:00:49',4,0,NULL,NULL,NULL,'3a4943e7-3026-4e28-b345-26acb4012006'),(2337,'Children ARV Regimen_2ndLine_5D Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5D Data Set\n \n 2023-08-16 11:00:49 UTC\n \n 2023-08-16 14:46:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2337\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4y0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4y10-13\n \n \n \n \n \n \n \n \n \n F1-4y14-19\n \n \n \n \n \n \n \n \n \n F1-4y20-24\n \n \n \n \n \n \n \n \n \n F1-4y25-34\n \n \n \n \n \n \n \n \n \n F1-4y4-5\n \n \n \n \n \n \n \n \n \n F1-4y6-9\n \n \n \n \n \n \n \n \n \n F1-4y>=35\n \n \n \n \n \n \n \n \n \n F10-14y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14y10-\n \n \n \n \n \n \n F10-14y14-\n \n \n \n \n \n \n F10-14y20-\n \n \n \n \n \n \n F10-14y25-\n \n \n \n \n \n \n F10-14y4-5\n \n \n \n \n \n \n F10-14y6-9\n \n \n \n \n \n \n F10-14y>=3\n \n \n \n \n \n \n F5-9y0-3\n \n \n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9y10-13\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9y14-19\n \n \n \n \n \n \n F5-9y20-24\n \n \n \n \n \n \n F5-9y25-34\n \n \n \n \n \n \n F5-9y4-5\n \n \n \n \n \n \n F5-9y6-9\n \n \n \n \n \n \n F5-9y>=35\n \n \n \n \n \n \n F<1y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1y10-13\n \n \n \n \n \n \n F<1y14-19\n \n \n \n \n \n \n F<1y20-24\n \n \n \n \n \n \n F<1y25-34\n \n \n \n \n \n \n F<1y4-5\n \n \n \n \n \n \n F<1y6-9\n \n \n \n \n \n \n F<1y>=35\n \n \n \n \n \n \n M1-4y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4y10-13\n \n \n \n \n \n \n M1-4y14-19\n \n \n \n \n \n \n M1-4y20-24\n \n \n \n \n \n \n M1-4y25-34\n \n \n \n \n \n \n M1-4y4-5\n \n \n \n \n \n \n M1-4y6-9\n \n \n \n \n \n \n M1-4y>=35\n \n \n \n \n \n \n M10-14y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14y10-\n \n \n \n \n \n \n \n \n \n M10-14y14-\n \n \n \n \n \n \n \n \n \n M10-14y20-\n \n \n \n \n \n \n M10-14y25-\n \n \n \n \n \n \n M10-14y4-5\n \n \n \n \n \n \n M10-14y6-9\n \n \n \n \n \n \n M10-14y>=3\n \n \n \n \n \n \n M5-9y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9y10-13\n \n \n \n \n \n \n M5-9y14-19\n \n \n \n \n \n \n M5-9y20-24\n \n \n \n \n \n \n M5-9y25-34\n \n \n \n \n \n \n M5-9y4-5\n \n \n \n \n \n \n M5-9y6-9\n \n \n \n \n \n \n M5-9y>=35\n \n \n \n \n \n \n M<1y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1y10-13\n \n \n \n \n \n \n M<1y14-19\n \n \n \n \n \n \n M<1y20-24\n \n \n \n \n \n \n M<1y25-34\n \n \n \n \n \n \n M<1y4-5\n \n \n \n \n \n \n M<1y6-9\n \n \n \n \n \n \n M<1y>=35\n \n \n \n \n \n \n','2023-08-16 13:00:49',4,'2023-08-16 16:46:17',4,0,NULL,NULL,NULL,'51fbe59a-77f3-40b1-9d18-e90e9cd9cacc'),(2338,'Children ARV Regimen_3rdLine_6C','Children ARV Regimen_3rdLine_6C disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_6C\n Children ARV Regimen_3rdLine_6C disaggregated by weight, sex, age\n \n 2023-08-16 11:26:46 UTC\n \n 2023-08-16 11:27:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2338\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-16 13:26:46',4,'2023-08-16 13:27:31',4,0,NULL,NULL,NULL,'61228d0f-b944-4ccc-ba45-d47ecd58c914'),(2339,'Children ARV Regimen_3rdLine_6C Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_6C Data Set\n \n 2023-08-16 11:27:31 UTC\n \n 2023-08-16 12:37:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2339\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4yr0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4yr10-1\n \n \n \n \n \n \n \n \n \n F1-4yr14-1\n \n \n \n \n \n \n \n \n \n F1-4yr20-2\n \n \n \n \n \n \n \n \n \n F1-4yr25-3\n \n \n \n \n \n \n \n \n \n F1-4yr4-5\n \n \n \n \n \n \n \n \n \n F1-4yr6-9\n \n \n \n \n \n \n \n \n \n F1-4yr>=35\n \n \n \n \n \n \n \n \n \n F10-14yr0-\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14yr10\n \n \n \n \n \n \n F10-14yr14\n \n \n \n \n \n \n F10-14yr20\n \n \n \n \n \n \n \n \n \n F10-14yr25\n \n \n \n \n \n \n F10-14yr4-\n \n \n \n \n \n \n F10-14yr6-\n \n \n \n \n \n \n F10-14yr>=\n \n \n \n \n \n \n F5-9yr0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9yr10-1\n \n \n \n \n \n \n F5-9yr14-1\n \n \n \n \n \n \n F5-9yr20-2\n \n \n \n \n \n \n F5-9yr25-3\n \n \n \n \n \n \n F5-9yr4-5\n \n \n \n \n \n \n F5-9yr6-9\n \n \n \n \n \n \n F5-9yr>=35\n \n \n \n \n \n \n F<1yr0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1yr10-13\n \n \n \n \n \n \n F<1yr14-19\n \n \n \n \n \n \n F<1yr20-24\n \n \n \n \n \n \n F<1yr25-34\n \n \n \n \n \n \n F<1yr4-5\n \n \n \n \n \n \n F<1yr6-9\n \n \n \n \n \n \n F<1yr>=35\n \n \n \n \n \n \n M1-4yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4yr10-1\n \n \n \n \n \n \n M1-4yr14-1\n \n \n \n \n \n \n M1-4yr20-2\n \n \n \n \n \n \n M1-4yr25-3\n \n \n \n \n \n \n M1-4yr4-5\n \n \n \n \n \n \n M1-4yr6-9\n \n \n \n \n \n \n M1-4yr>=35\n \n \n \n \n \n \n M10-14yr0-\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14yr10\n \n \n \n \n \n \n M10-14yr14\n \n \n \n \n \n \n M10-14yr20\n \n \n \n \n \n \n M10-14yr25\n \n \n \n \n \n \n M10-14yr4-\n \n \n \n \n \n \n M10-14yr6-\n \n \n \n \n \n \n M10-14yr>=\n \n \n \n \n \n \n M5-9yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9yr10-1\n \n \n \n \n \n \n M5-9yr14-1\n \n \n \n \n \n \n M5-9yr20-2\n \n \n \n \n \n \n M5-9yr25-3\n \n \n \n \n \n \n M5-9yr4-5\n \n \n \n \n \n \n M5-9yr6-9\n \n \n \n \n \n \n M5-9yr>=35\n \n \n \n \n \n \n M<1yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1yr10-13\n \n \n \n \n \n \n M<1yr14-19\n \n \n \n \n \n \n M<1yr20-24\n \n \n \n \n \n \n M<1yr25-34\n \n \n \n \n \n \n M<1yr4-5\n \n \n \n \n \n \n M<1yr6-9\n \n \n \n \n \n \n M<1yr>=35\n \n \n \n \n \n \n','2023-08-16 13:27:31',4,'2023-08-16 14:37:59',4,0,NULL,NULL,NULL,'4a1d329b-6eeb-4ef7-a104-d1c6f9479abc'),(2342,'Children ARV Regimen_2ndLine_5E','Children ARV Regimen_2ndLine_5E disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5E\n Children ARV Regimen_2ndLine_5E disaggregated by weight, sex, age\n \n 2023-08-16 11:51:18 UTC\n \n 2023-08-16 11:52:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2342\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-16 13:51:18',4,'2023-08-16 13:52:18',4,0,NULL,NULL,NULL,'f710c498-9264-4d7e-bdb4-e846dec7972b'),(2343,'Children ARV Regimen_2ndLine_5E Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5E Data Set\n \n 2023-08-16 11:51:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n \n \n','2023-08-16 13:51:29',4,NULL,NULL,0,NULL,NULL,NULL,'8eaa5921-d13d-4bd9-912d-d9d09af7394f'),(2344,'Children ARV Regimen_2ndLine_5E Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5E Data Set\n \n 2023-08-16 11:52:09 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n \n \n','2023-08-16 13:52:09',4,NULL,NULL,0,NULL,NULL,NULL,'0105c46c-76ef-4088-b5b1-b89e42dc49d1'),(2345,'Children ARV Regimen_2ndLine_5E Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5E Data Set\n \n 2023-08-16 11:52:18 UTC\n \n 2023-08-16 15:02:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2345\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4y0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4y10-13\n \n \n \n \n \n \n \n \n \n F1-4y14-19\n \n \n \n \n \n \n \n \n \n F1-4y20-24\n \n \n \n \n \n \n \n \n \n F1-4y25-34\n \n \n \n \n \n \n \n \n \n F1-4y4-5\n \n \n \n \n \n \n \n \n \n F1-4y6-9\n \n \n \n \n \n \n \n \n \n F1-4y>=35\n \n \n \n \n \n \n \n \n \n F10-14y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14y10-\n \n \n \n \n \n \n F10-14y14-\n \n \n \n \n \n \n F10-14y20-\n \n \n \n \n \n \n F10-14y25-\n \n \n \n \n \n \n F10-14y4-5\n \n \n \n \n \n \n \n \n \n F10-14y6-9\n \n \n \n \n \n \n F10-14y>=3\n \n \n \n \n \n \n F5-9y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9y10-13\n \n \n \n \n \n \n F5-9y14-19\n \n \n \n \n \n \n F5-9y20-24\n \n \n \n \n \n \n F5-9y25-34\n \n \n \n \n \n \n F5-9y4-5\n \n \n \n \n \n \n F5-9y6-9\n \n \n \n \n \n \n F5-9y>=35\n \n \n \n \n \n \n F6-9y4-5\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1y0-3\n \n \n \n \n \n \n F<1y10-13\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Adults\n \n \n \n \n \n F<1y14-19\n \n \n \n \n \n \n F<1y20-24\n \n \n \n \n \n \n F<1y25-34\n \n \n \n \n \n \n F<1y4-5\n \n \n \n \n \n \n F<1y6-9\n \n \n \n \n \n \n F<1y>=35\n \n \n \n \n \n \n M1-4y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4y10-13\n \n \n \n \n \n \n M1-4y14-19\n \n \n \n \n \n \n M1-4y20-24\n \n \n \n \n \n \n \n \n \n M1-4y25-34\n \n \n \n \n \n \n M1-4y4-5\n \n \n \n \n \n \n M1-4y6-9\n \n \n \n \n \n \n M1-4y>=35\n \n \n \n \n \n \n M10-14y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14y10-\n \n \n \n \n \n \n M10-14y14-\n \n \n \n \n \n \n M10-14y20-\n \n \n \n \n \n \n M10-14y25-\n \n \n \n \n \n \n M10-14y4-5\n \n \n \n \n \n \n M10-14y6-9\n \n \n \n \n \n \n M10-14y>=3\n \n \n \n \n \n \n M5-9y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9y10-13\n \n \n \n \n \n \n M5-9y14-19\n \n \n \n \n \n \n M5-9y20-24\n \n \n \n \n \n \n M5-9y25-34\n \n \n \n \n \n \n M5-9y4-5\n \n \n \n \n \n \n M5-9y6-9\n \n \n \n \n \n \n M5-9y>=35\n \n \n \n \n \n \n M<1y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1y10-13\n \n \n \n \n \n \n M<1y14-19\n \n \n \n \n \n \n M<1y20-24\n \n \n \n \n \n \n M<1y25-34\n \n \n \n \n \n \n M<1y4-5\n \n \n \n \n \n \n M<1y6-9\n \n \n \n \n \n \n M<1y>=35\n \n \n \n \n \n \n','2023-08-16 13:52:18',4,'2023-08-16 17:02:44',4,0,NULL,NULL,NULL,'3b422368-2868-4d7f-a24f-936289c1b8a2'),(2346,'Children ARV Regimen_3rdLine_6D','Children ARV Regimen_3rdLine_6D disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_6D\n Children ARV Regimen_3rdLine_6D disaggregated by weight, sex, age\n \n 2023-08-16 14:30:52 UTC\n \n 2023-08-16 14:31:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2346\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-16 16:30:52',4,'2023-08-16 16:31:03',4,0,NULL,NULL,NULL,'7f66540d-c280-4dd8-a771-71057ff7ce42'),(2347,'Children ARV Regimen_3rdLine_6D Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_6D Data Set\n \n 2023-08-16 14:31:03 UTC\n \n 2023-08-16 15:52:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2347\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4yr0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4yr10-1\n \n \n \n \n \n \n \n \n \n F1-4yr14-1\n \n \n \n \n \n \n \n \n \n F1-4yr20-2\n \n \n \n \n \n \n \n \n \n F1-4yr25-3\n \n \n \n \n \n \n \n \n \n F1-4yr4-5\n \n \n \n \n \n \n \n \n \n F1-4yr6-9\n \n \n \n \n \n \n \n \n \n F1-4yr>=35\n \n \n \n \n \n \n \n \n \n F10-14yr0-\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14yr10\n \n \n \n \n \n \n F10-14yr14\n \n \n \n \n \n \n F10-14yr20\n \n \n \n \n \n \n \n \n \n F10-14yr25\n \n \n \n \n \n \n \n \n \n F10-14yr4-\n \n \n \n \n \n \n F10-14yr6-\n \n \n \n \n \n \n F10-14yr>=\n \n \n \n \n \n \n F5-9yr0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9yr10-1\n \n \n \n \n \n \n F5-9yr14-1\n \n \n \n \n \n \n F5-9yr20-2\n \n \n \n \n \n \n F5-9yr25-3\n \n \n \n \n \n \n F5-9yr4-5\n \n \n \n \n \n \n F5-9yr6-9\n \n \n \n \n \n \n F5-9yr>=35\n \n \n \n \n \n \n F<1yr0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1yr10-13\n \n \n \n \n \n \n \n \n \n F<1yr14-19\n \n \n \n \n \n \n F<1yr20-24\n \n \n \n \n \n \n F<1yr25-34\n \n \n \n \n \n \n F<1yr4-5\n \n \n \n \n \n \n F<1yr6-9\n \n \n \n \n \n \n F<1yr>=35\n \n \n \n \n \n \n M1-4yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4yr10-1\n \n \n \n \n \n \n M1-4yr14-1\n \n \n \n \n \n \n M1-4yr20-2\n \n \n \n \n \n \n M1-4yr25-3\n \n \n \n \n \n \n M1-4yr4-5\n \n \n \n \n \n \n M1-4yr6-9\n \n \n \n \n \n \n M1-4yr>=35\n \n \n \n \n \n \n M10-14yr0-\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14yr10\n \n \n \n \n \n \n M10-14yr14\n \n \n \n \n \n \n M10-14yr20\n \n \n \n \n \n \n M10-14yr25\n \n \n \n \n \n \n M10-14yr4-\n \n \n \n \n \n \n M10-14yr6-\n \n \n \n \n \n \n M10-14yr>=\n \n \n \n \n \n \n M5-9yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9yr10-1\n \n \n \n \n \n \n M5-9yr14-1\n \n \n \n \n \n \n M5-9yr20-2\n \n \n \n \n \n \n M5-9yr25-3\n \n \n \n \n \n \n M5-9yr4-5\n \n \n \n \n \n \n M5-9yr6-9\n \n \n \n \n \n \n M5-9yr>=35\n \n \n \n \n \n \n M<1yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1yr10-13\n \n \n \n \n \n \n M<1yr14-19\n \n \n \n \n \n \n M<1yr20-24\n \n \n \n \n \n \n M<1yr25-34\n \n \n \n \n \n \n M<1yr4-5\n \n \n \n \n \n \n M<1yr6-9\n \n \n \n \n \n \n M<1yr>=35\n \n \n \n \n \n \n','2023-08-16 16:31:03',4,'2023-08-16 17:52:50',4,0,NULL,NULL,NULL,'27ae096d-4997-4d00-a00a-390c70159a12'),(2348,'Children ARV Regimen_2ndLine_5F','Children ARV Regimen_2ndLine_5F disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5F\n Children ARV Regimen_2ndLine_5F disaggregated by weight, sex, age\n \n 2023-08-16 14:55:10 UTC\n \n 2023-08-16 14:55:33 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2348\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-16 16:55:10',4,'2023-08-16 16:55:33',4,0,NULL,NULL,NULL,'9d77bcc5-cf55-4f71-8e9b-77d19d82e10d'),(2349,'Children ARV Regimen_2ndLine_5F Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5F Data Set\n \n 2023-08-16 14:55:33 UTC\n \n 2023-08-16 15:48:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2349\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4y0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4y10-13\n \n \n \n \n \n \n \n \n \n F1-4y14-19\n \n \n \n \n \n \n \n \n \n F1-4y20-24\n \n \n \n \n \n \n \n \n \n F1-4y25-34\n \n \n \n \n \n \n \n \n \n F1-4y4-5\n \n \n \n \n \n \n \n \n \n F1-4y6-9\n \n \n \n \n \n \n \n \n \n F1-4y>=35\n \n \n \n \n \n \n \n \n \n F10-14y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14y10-\n \n \n \n \n \n \n \n \n \n F10-14y14-\n \n \n \n \n \n \n F10-14y20-\n \n \n \n \n \n \n F10-14y25-\n \n \n \n \n \n \n F10-14y4-5\n \n \n \n \n \n \n F10-14y6-9\n \n \n \n \n \n \n F10-14y>=3\n \n \n \n \n \n \n F5-9y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9y10-13\n \n \n \n \n \n \n F5-9y14-19\n \n \n \n \n \n \n F5-9y20-24\n \n \n \n \n \n \n F5-9y25-34\n \n \n \n \n \n \n F5-9y4-5\n \n \n \n \n \n \n F5-9y6-9\n \n \n \n \n \n \n F5-9y>=35\n \n \n \n \n \n \n F<1y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1y10-13\n \n \n \n \n \n \n F<1y14-19\n \n \n \n \n \n \n F<1y20-24\n \n \n \n \n \n \n F<1y25-34\n \n \n \n \n \n \n F<1y4-5\n \n \n \n \n \n \n F<1y6-9\n \n \n \n \n \n \n \n \n \n F<1y>=35\n \n \n \n \n \n \n M1-4y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4y10-13\n \n \n \n \n \n \n M1-4y14-19\n \n \n \n \n \n \n M1-4y20-24\n \n \n \n \n \n \n M1-4y25-34\n \n \n \n \n \n \n M1-4y4-5\n \n \n \n \n \n \n M1-4y6-9\n \n \n \n \n \n \n M1-4y>=35\n \n \n \n \n \n \n M10-14y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14y10-\n \n \n \n \n \n \n M10-14y14-\n \n \n \n \n \n \n M10-14y20-\n \n \n \n \n \n \n M10-14y25-\n \n \n \n \n \n \n M10-14y4-5\n \n \n \n \n \n \n M10-14y6-9\n \n \n \n \n \n \n M10-14y>=3\n \n \n \n \n \n \n M5-9y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9y10-13\n \n \n \n \n \n \n M5-9y14-19\n \n \n \n \n \n \n M5-9y20-24\n \n \n \n \n \n \n M5-9y25-34\n \n \n \n \n \n \n M5-9y4-5\n \n \n \n \n \n \n M5-9y6-9\n \n \n \n \n \n \n M5-9y>=35\n \n \n \n \n \n \n M<1y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1y10-13\n \n \n \n \n \n \n M<1y14-19\n \n \n \n \n \n \n M<1y20-24\n \n \n \n \n \n \n M<1y25-34\n \n \n \n \n \n \n M<1y4-5\n \n \n \n \n \n \n M<1y6-9\n \n \n \n \n \n \n M<1y>=35\n \n \n \n \n \n \n','2023-08-16 16:55:33',4,'2023-08-16 17:48:02',4,0,NULL,NULL,NULL,'dc690b7d-b448-4f9f-b159-00d2671710e6'),(2350,'Children ARV Regimen_2ndLine_5G','Children ARV Regimen_2ndLine_5G','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5G\n Children ARV Regimen_2ndLine_5G\n \n 2023-08-16 15:09:07 UTC\n \n 2023-08-16 15:10:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2350\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-16 17:09:07',4,'2023-08-16 17:10:08',4,0,NULL,NULL,NULL,'f2f7b2a9-f96e-4f72-8edf-5e0a4195ec85'),(2351,'Children ARV Regimen_2ndLine_5G Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5G Data Set\n \n 2023-08-16 15:10:08 UTC\n \n 2023-08-16 18:01:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2351\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4y0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4y10-13\n \n \n \n \n \n \n \n \n \n F1-4y14-19\n \n \n \n \n \n \n \n \n \n F1-4y20-24\n \n \n \n \n \n \n \n \n \n F1-4y25-34\n \n \n \n \n \n \n \n \n \n F1-4y4-5\n \n \n \n \n \n \n \n \n \n F1-4y6-9\n \n \n \n \n \n \n \n \n \n F1-4y>=35\n \n \n \n \n \n \n \n \n \n F10-14y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14y10-\n \n \n \n \n \n \n \n \n \n F10-14y14-\n \n \n \n \n \n \n \n \n \n F10-14y20-\n \n \n \n \n \n \n \n \n \n F10-14y25-\n \n \n \n \n \n \n F10-14y4-5\n \n \n \n \n \n \n \n \n \n F10-14y6-9\n \n \n \n \n \n \n \n \n \n F10-14y>=3\n \n \n \n \n \n \n F5-9y0-3\n \n \n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9y10-13\n \n \n \n \n \n \n F5-9y14-19\n \n \n \n \n \n \n F5-9y20-24\n \n \n \n \n \n \n F5-9y25-34\n \n \n \n \n \n \n F5-9y4-5\n \n \n \n \n \n \n F5-9y6-9\n \n \n \n \n \n \n F5-9y>=35\n \n \n \n \n \n \n F<1y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1y10-13\n \n \n \n \n \n \n F<1y14-19\n \n \n \n \n \n \n F<1y25-34\n \n \n \n \n \n \n F<1y4-5\n \n \n \n \n \n \n F<1y6-9\n \n \n \n \n \n \n F<1y>=35\n \n \n \n \n \n \n M1-4y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4y10-13\n \n \n \n \n \n \n M1-4y14-19\n \n \n \n \n \n \n M1-4y20-24\n \n \n \n \n \n \n \n \n \n M1-4y25-34\n \n \n \n \n \n \n M1-4y4-5\n \n \n \n \n \n \n M1-4y6-9\n \n \n \n \n \n \n M1-4y>=35\n \n \n \n \n \n \n \n \n \n M10-14>=35\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14y0-3\n \n \n \n \n \n \n M10-14y10-\n \n \n \n \n \n \n M10-14y14-\n \n \n \n \n \n \n M10-14y20-\n \n \n \n \n \n \n M10-14y25-\n \n \n \n \n \n \n M10-14y4-5\n \n \n \n \n \n \n M10-14y6-9\n \n \n \n \n \n \n M5-9y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9y10-13\n \n \n \n \n \n \n M5-9y14-19\n \n \n \n \n \n \n M5-9y20-24\n \n \n \n \n \n \n M5-9y25-34\n \n \n \n \n \n \n M5-9y4-5\n \n \n \n \n \n \n M5-9y6-9\n \n \n \n \n \n \n M5-9y>=35\n \n \n \n \n \n \n M<1y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1y10-13\n \n \n \n \n \n \n M<1y14-19\n \n \n \n \n \n \n M<1y20-24\n \n \n \n \n \n \n M<1y25-34\n \n \n \n \n \n \n M<1y4-5\n \n \n \n \n \n \n M<1y6-9\n \n \n \n \n \n \n M<1y>=35\n \n \n \n \n \n \n','2023-08-16 17:10:08',4,'2023-08-16 20:01:10',4,0,NULL,NULL,NULL,'1041fe73-c2e7-47db-8d84-eb79176e25fe'),(2352,'Children ARV Regimen_2ndLine_5H','Children ARV Regimen_2ndLine_5H disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5H\n Children ARV Regimen_2ndLine_5H disaggregated by weight, sex, age\n \n 2023-08-16 15:50:48 UTC\n \n 2023-08-16 15:50:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2352\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-16 17:50:48',4,'2023-08-16 17:50:59',4,0,NULL,NULL,NULL,'71b6899d-048d-4c2a-a10f-84422454ece6'),(2353,'Children ARV Regimen_2ndLine_5H Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5H Data Set\n \n 2023-08-16 15:50:59 UTC\n \n 2023-08-16 17:19:35 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2353\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4y0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4y10-13\n \n \n \n \n \n \n \n \n \n F1-4y14-19\n \n \n \n \n \n \n \n \n \n F1-4y20-24\n \n \n \n \n \n \n \n \n \n F1-4y25-34\n \n \n \n \n \n \n \n \n \n F1-4y4-5\n \n \n \n \n \n \n \n \n \n F1-4y6-9\n \n \n \n \n \n \n \n \n \n F1-4y>=35\n \n \n \n \n \n \n \n \n \n F10-14y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14y10-\n \n \n \n \n \n \n F10-14y14-\n \n \n \n \n \n \n F10-14y20-\n \n \n \n \n \n \n F10-14y25-\n \n \n \n \n \n \n F10-14y4-5\n \n \n \n \n \n \n F10-14y6-9\n \n \n \n \n \n \n F10-14y>=3\n \n \n \n \n \n \n \n \n \n F5-9y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9y10-13\n \n \n \n \n \n \n F5-9y14-19\n \n \n \n \n \n \n F5-9y20-24\n \n \n \n \n \n \n F5-9y25-34\n \n \n \n \n \n \n F5-9y4-5\n \n \n \n \n \n \n F5-9y6-9\n \n \n \n \n \n \n F5-9y>=35\n \n \n \n \n \n \n F<1y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1y10-13\n \n \n \n \n \n \n \n \n \n F<1y14-19\n \n \n \n \n \n \n F<1y20-24\n \n \n \n \n \n \n F<1y25-34\n \n \n \n \n \n \n F<1y4-5\n \n \n \n \n \n \n F<1y6-9\n \n \n \n \n \n \n F<1y>=35\n \n \n \n \n \n \n M1-4y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4y10-13\n \n \n \n \n \n \n M1-4y14-19\n \n \n \n \n \n \n M1-4y20-24\n \n \n \n \n \n \n M1-4y25-34\n \n \n \n \n \n \n M1-4y4-5\n \n \n \n \n \n \n M1-4y6-9\n \n \n \n \n \n \n M1-4y>=35\n \n \n \n \n \n \n M10-14y0-3\n \n \n \n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14y10-\n \n \n \n \n \n \n M10-14y14-\n \n \n \n \n \n \n \n \n \n M10-14y20-\n \n \n \n \n \n \n M10-14y25-\n \n \n \n \n \n \n M10-14y4-5\n \n \n \n \n \n \n M10-14y6-9\n \n \n \n \n \n \n M10-14y>=3\n \n \n \n \n \n \n M5-9y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9y10-13\n \n \n \n \n \n \n M5-9y14-19\n \n \n \n \n \n \n M5-9y20-24\n \n \n \n \n \n \n M5-9y25-34\n \n \n \n \n \n \n M5-9y4-5\n \n \n \n \n \n \n \n \n \n M5-9y6-9\n \n \n \n \n \n \n M5-9y>=35\n \n \n \n \n \n \n M<1y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1y10-13\n \n \n \n \n \n \n M<1y14-19\n \n \n \n \n \n \n M<1y20-24\n \n \n \n \n \n \n M<1y25-34\n \n \n \n \n \n \n M<1y4-5\n \n \n \n \n \n \n M<1y6-9\n \n \n \n \n \n \n M<1y>=35\n \n \n \n \n \n \n','2023-08-16 17:50:59',4,'2023-08-16 19:19:35',4,0,NULL,NULL,NULL,'fa79bb1e-c2a3-435f-8074-de92d79ed741'),(2354,'Children ARV Regimen_3rdLine_6E','Children ARV Regimen_3rdLine_6E disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_6E\n Children ARV Regimen_3rdLine_6E disaggregated by weight, sex, age\n \n 2023-08-16 15:57:11 UTC\n \n 2023-08-16 15:58:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2354\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-16 17:57:11',4,'2023-08-16 17:58:30',4,0,NULL,NULL,NULL,'ace827f2-1783-4eac-819e-12793a2c4e9f'); INSERT INTO `serialized_object` VALUES (2355,'Children ARV Regimen_3rdLine_6E Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_6E Data Set\n \n 2023-08-16 15:58:30 UTC\n \n 2023-08-16 17:28:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2355\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4yr0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4yr10-1\n \n \n \n \n \n \n \n \n \n F1-4yr14-1\n \n \n \n \n \n \n \n \n \n F1-4yr20-2\n \n \n \n \n \n \n \n \n \n F1-4yr25-3\n \n \n \n \n \n \n \n \n \n F1-4yr4-5\n \n \n \n \n \n \n \n \n \n F1-4yr6-9\n \n \n \n \n \n \n \n \n \n F1-4yr>=35\n \n \n \n \n \n \n \n \n \n F10-14yr0-\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14yr10\n \n \n \n \n \n \n F10-14yr14\n \n \n \n \n \n \n F10-14yr20\n \n \n \n \n \n \n F10-14yr25\n \n \n \n \n \n \n F10-14yr4-\n \n \n \n \n \n \n F10-14yr6-\n \n \n \n \n \n \n F10-14yr>=\n \n \n \n \n \n \n F5-9yr0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9yr10-1\n \n \n \n \n \n \n F5-9yr14-1\n \n \n \n \n \n \n F5-9yr20-2\n \n \n \n \n \n \n F5-9yr25-3\n \n \n \n \n \n \n F5-9yr4-5\n \n \n \n \n \n \n F5-9yr6-9\n \n \n \n \n \n \n F5-9yr>=35\n \n \n \n \n \n \n F<1yr0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1yr10-13\n \n \n \n \n \n \n F<1yr14-19\n \n \n \n \n \n \n F<1yr20-24\n \n \n \n \n \n \n F<1yr25-34\n \n \n \n \n \n \n F<1yr4-5\n \n \n \n \n \n \n F<1yr6-9\n \n \n \n \n \n \n F<1yr>=35\n \n \n \n \n \n \n M1-4yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4yr10-1\n \n \n \n \n \n \n M1-4yr14-1\n \n \n \n \n \n \n M1-4yr20-2\n \n \n \n \n \n \n M1-4yr25-3\n \n \n \n \n \n \n M1-4yr4-5\n \n \n \n \n \n \n M1-4yr6-9\n \n \n \n \n \n \n M1-4yr>=35\n \n \n \n \n \n \n M10-14yr0-\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14yr10\n \n \n \n \n \n \n M10-14yr14\n \n \n \n \n \n \n M10-14yr20\n \n \n \n \n \n \n M10-14yr25\n \n \n \n \n \n \n M10-14yr4-\n \n \n \n \n \n \n M10-14yr6-\n \n \n \n \n \n \n M10-14yr>=\n \n \n \n \n \n \n M5-9yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9yr10-1\n \n \n \n \n \n \n M5-9yr14-1\n \n \n \n \n \n \n M5-9yr20-2\n \n \n \n \n \n \n M5-9yr25-3\n \n \n \n \n \n \n M5-9yr4-5\n \n \n \n \n \n \n M5-9yr6-9\n \n \n \n \n \n \n M5-9yr>=35\n \n \n \n \n \n \n M<1yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1yr10-13\n \n \n \n \n \n \n M<1yr14-19\n \n \n \n \n \n \n M<1yr20-24\n \n \n \n \n \n \n M<1yr25-34\n \n \n \n \n \n \n M<1yr4-5\n \n \n \n \n \n \n M<1yr6-9\n \n \n \n \n \n \n M<1yr>=35\n \n \n \n \n \n \n','2023-08-16 17:58:30',4,'2023-08-16 19:28:59',4,0,NULL,NULL,NULL,'91b72368-e321-4a7b-968d-1271493fa958'),(2356,'Children ARV Regimen_3rdLine_6F','Children ARV Regimen_3rdLine_6F disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_6F\n Children ARV Regimen_3rdLine_6F disaggregated by weight, sex, age\n \n 2023-08-16 17:30:28 UTC\n \n 2023-08-16 17:30:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2356\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-16 19:30:28',4,'2023-08-16 19:30:40',4,0,NULL,NULL,NULL,'cba2a95d-5060-47fd-9401-a826e1c0858a'),(2357,'Children ARV Regimen_3rdLine_6F Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_6F Data Set\n \n 2023-08-16 17:30:39 UTC\n \n 2023-08-16 18:09:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2357\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4yr0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4yr10-1\n \n \n \n \n \n \n \n \n \n F1-4yr14-1\n \n \n \n \n \n \n \n \n \n F1-4yr20-2\n \n \n \n \n \n \n \n \n \n F1-4yr25-3\n \n \n \n \n \n \n \n \n \n F1-4yr4-5\n \n \n \n \n \n \n \n \n \n F1-4yr6-9\n \n \n \n \n \n \n \n \n \n F1-4yr>=35\n \n \n \n \n \n \n \n \n \n F10-14yr0-\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14yr10\n \n \n \n \n \n \n F10-14yr14\n \n \n \n \n \n \n F10-14yr20\n \n \n \n \n \n \n F10-14yr25\n \n \n \n \n \n \n F10-14yr4-\n \n \n \n \n \n \n F10-14yr6-\n \n \n \n \n \n \n F10-14yr>=\n \n \n \n \n \n \n F5-9yr0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9yr10-1\n \n \n \n \n \n \n F5-9yr14-1\n \n \n \n \n \n \n F5-9yr20-2\n \n \n \n \n \n \n F5-9yr25-3\n \n \n \n \n \n \n F5-9yr4-5\n \n \n \n \n \n \n F5-9yr6-9\n \n \n \n \n \n \n F5-9yr>=35\n \n \n \n \n \n \n F<1yr0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1yr10-13\n \n \n \n \n \n \n F<1yr14-19\n \n \n \n \n \n \n F<1yr20-24\n \n \n \n \n \n \n F<1yr25-34\n \n \n \n \n \n \n F<1yr4-5\n \n \n \n \n \n \n F<1yr6-9\n \n \n \n \n \n \n F<1yr>=35\n \n \n \n \n \n \n M1-4yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4yr10-1\n \n \n \n \n \n \n M1-4yr14-1\n \n \n \n \n \n \n M1-4yr20-2\n \n \n \n \n \n \n M1-4yr25-3\n \n \n \n \n \n \n M1-4yr4-5\n \n \n \n \n \n \n M1-4yr6-9\n \n \n \n \n \n \n M1-4yr>=35\n \n \n \n \n \n \n M10-14yr0-\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14yr10\n \n \n \n \n \n \n M10-14yr14\n \n \n \n \n \n \n M10-14yr20\n \n \n \n \n \n \n M10-14yr25\n \n \n \n \n \n \n M10-14yr4-\n \n \n \n \n \n \n M10-14yr6-\n \n \n \n \n \n \n M10-14yr>=\n \n \n \n \n \n \n M5-9yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9yr10-1\n \n \n \n \n \n \n M5-9yr14-1\n \n \n \n \n \n \n M5-9yr20-2\n \n \n \n \n \n \n M5-9yr25-3\n \n \n \n \n \n \n M5-9yr4-5\n \n \n \n \n \n \n M5-9yr6-9\n \n \n \n \n \n \n M5-9yr>=35\n \n \n \n \n \n \n M<1yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1yr10-13\n \n \n \n \n \n \n M<1yr14-19\n \n \n \n \n \n \n M<1yr20-24\n \n \n \n \n \n \n M<1yr25-34\n \n \n \n \n \n \n M<1yr4-5\n \n \n \n \n \n \n M<1yr6-9\n \n \n \n \n \n \n M<1yr>=35\n \n \n \n \n \n \n','2023-08-16 19:30:39',4,'2023-08-16 20:09:14',4,0,NULL,NULL,NULL,'739d18c0-8b69-47f2-b49c-f203e776d528'),(2358,'Clients given 5A with >=20Copies_Viral_Load','Clients given 5A with >=20Copies_Viral_Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5A with >=20Copies_Viral_Load\n Clients given 5A with >=20Copies_Viral_Load\n \n 2023-08-17 08:33:38 UTC\n \n 2023-08-17 08:34:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2358\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5A \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND MONTH(os.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3681)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and oss.obs_datetime <= cast('2023-06-30'as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \n \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-17 10:33:38',4,'2023-08-17 10:34:00',4,0,NULL,NULL,NULL,'f9c21dfa-e2bc-4174-858c-5290ee412c83'),(2359,'Clients given 5A with <20Copies_Viral_Load','Clients given 5A with <20Copies_Viral_Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5A with <20Copies_Viral_Load\n Clients given 5A with <20Copies_Viral_Load\n \n 2023-08-17 08:35:33 UTC\n \n 2023-08-17 08:36:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2359\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5A \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND MONTH(os.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3681)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-17 10:35:33',4,'2023-08-17 10:36:23',4,0,NULL,NULL,NULL,'f803bb84-0a18-4319-91e7-4ea289d8a295'),(2360,'Clients given 5A with Undetectable_Viral_Load','Clients given 5A with Undetectable_Viral_Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5A with Undetectable_Viral_Load\n Clients given 5A with Undetectable_Viral_Load\n \n 2023-08-17 08:37:56 UTC\n \n 2023-08-17 08:39:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2360\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5A \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND MONTH(os.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3681)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- undetectable, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-17 10:37:56',4,'2023-08-17 10:39:04',4,0,NULL,NULL,NULL,'2386a884-ae79-46a7-8adf-d5044b06e9c4'),(2361,'Clients given 5B with >=20Copies_Viral_Load','Clients given 5B with >=20Copies_Viral_Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5B with >=20Copies_Viral_Load\n Clients given 5B with >=20Copies_Viral_Load\n \n 2023-08-17 08:44:15 UTC\n \n 2023-08-17 09:02:37 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2361\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5B \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3682)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and oss.obs_datetime <= cast('2023-06-30'as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \n \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-17 10:44:15',4,'2023-08-17 11:02:37',4,0,NULL,NULL,NULL,'5939e332-e3fc-4a42-a736-b647f31a87a3'),(2362,'Clients given 5B with <20Copies_Viral_Load','Clients given 5B with <20Copies_Viral_Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5B with <20Copies_Viral_Load\n Clients given 5B with <20Copies_Viral_Load\n \n 2023-08-17 08:59:37 UTC\n \n 2023-08-17 09:05:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2362\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5B \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3682)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-17 10:59:37',4,'2023-08-17 11:05:50',4,0,NULL,NULL,NULL,'8b4f6f3d-4444-4429-ac84-94ecc1e14ba2'),(2363,'Clients given 5B with Undetectable_Viral_Load','Clients given 5B with Undetectable_Viral_Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5B with Undetectable_Viral_Load\n Clients given 5B with Undetectable_Viral_Load\n \n 2023-08-17 09:06:53 UTC\n \n 2023-08-17 09:07:37 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2363\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5B \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3682)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- undetectable, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n)) \n \n\n','2023-08-17 11:06:53',4,'2023-08-17 11:07:37',4,0,NULL,NULL,NULL,'d7418afd-aca2-46e9-9c72-e920d447db27'),(2364,'Clients given 5C with >=20Copies_Viral_Load','Clients given 5C with >=20Copies_Viral_Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5C with >=20Copies_Viral_Load\n Clients given 5C with >=20Copies_Viral_Load\n \n 2023-08-17 09:13:04 UTC\n \n 2023-08-17 09:15:46 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2364\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4696)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and oss.obs_datetime <= cast('2023-06-30'as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-17 11:13:04',4,'2023-08-17 11:15:46',4,0,NULL,NULL,NULL,'ee32f98e-445e-4a15-8a1e-c594ad7729b3'),(2365,'Clients given 5C with <20Copies_Viral_Load','Clients given 5C with <20Copies_Viral_Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5C with <20Copies_Viral_Load\n Clients given 5C with <20Copies_Viral_Load\n \n 2023-08-17 09:18:17 UTC\n \n 2023-08-17 09:19:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2365\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4696)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-17 11:18:17',4,'2023-08-17 11:19:06',4,0,NULL,NULL,NULL,'5fc6059b-5dca-4e92-abe4-e44c4e5f9f09'),(2366,'Clients given 5C with Undetectable Viral Load','Clients given 5C with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5C with Undetectable Viral Load\n Clients given 5C with Undetectable Viral Load\n \n 2023-08-17 09:20:42 UTC\n \n 2023-08-17 09:21:13 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2366\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4696)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- undetectable, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-17 11:20:42',4,'2023-08-17 11:21:13',4,0,NULL,NULL,NULL,'f3e6450c-1bda-42b4-87d3-352e65c53612'),(2367,'Clients given 5D with >=20Copies_Viral_Load','Clients given 5D with >=20Copies_Viral_Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5D with >=20Copies_Viral_Load\n Clients given 5D with >=20Copies_Viral_Load\n \n 2023-08-17 09:31:21 UTC\n \n 2023-08-17 09:32:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2367\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5D \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4697)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and oss.obs_datetime <= cast('2023-06-30'as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-17 11:31:21',4,'2023-08-17 11:32:04',4,0,NULL,NULL,NULL,'25589972-ceb9-4c56-bb7c-2911f712e272'),(2368,'Clients given 5D with <20Copies_Viral_Load','Clients given 5D with <20Copies_Viral_Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5D with <20Copies_Viral_Load\n Clients given 5D with <20Copies_Viral_Load\n \n 2023-08-17 09:34:28 UTC\n \n 2023-08-17 09:36:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2368\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5D \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4697)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-17 11:34:28',4,'2023-08-17 11:36:20',4,0,NULL,NULL,NULL,'a9a60d85-6eba-4872-9b0c-02c941d7ff94'),(2369,'Clients given 4D with poor adherence','Clients given 4D with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D with poor adherence\n Clients given 4D with poor adherence\n \n 2023-08-17 09:51:32 UTC\n \n','2023-08-17 11:51:32',4,NULL,NULL,0,NULL,NULL,NULL,'76e21882-219e-4852-aca2-a0d774c1c79b'),(2370,'Clients given 5a with poor adherence','Clients given 5a with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5a with poor adherence\n Clients given 5a with poor adherence\n \n 2023-08-17 09:51:59 UTC\n \n 2023-08-17 09:53:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2370\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5a \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3681)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-17 11:51:59',4,'2023-08-17 11:53:44',4,0,NULL,NULL,NULL,'67dd544b-2e27-408f-824b-0312d06e9785'),(2371,'Clients given 5a with fair adherence','Clients given 5a with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5a with fair adherence\n Clients given 5a with fair adherence\n \n 2023-08-17 09:56:02 UTC\n \n 2023-08-17 09:56:33 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2371\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5a \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3681)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-17 11:56:02',4,'2023-08-17 11:56:33',4,0,NULL,NULL,NULL,'93e07039-5627-49fd-9fb4-9f3cf8ddaafd'),(2372,'Clients given 5a with good adherence','Clients given 5a with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5a with good adherence\n Clients given 5a with good adherence\n \n 2023-08-17 09:57:50 UTC\n \n 2023-08-17 09:58:24 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2372\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5a \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3681)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-17 11:57:50',4,'2023-08-17 11:58:24',4,0,NULL,NULL,NULL,'94df16c2-5336-419b-be14-fe6c390dc41b'),(2373,'Clients given 5D with Undetectable Viral Load','Clients given 5D with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5D with Undetectable Viral Load\n Clients given 5D with Undetectable Viral Load\n \n 2023-08-17 09:58:03 UTC\n \n 2023-08-17 09:58:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2373\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5D \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4697)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- undetectable, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-17 11:58:03',4,'2023-08-17 11:58:42',4,0,NULL,NULL,NULL,'95abcfbb-daac-4a02-a38c-455f5f0aca2d'),(2374,'Clients given 5E with >=20Copies_Viral_Load','Clients given 5E with >=20Copies_Viral_Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5E with >=20Copies_Viral_Load\n Clients given 5E with >=20Copies_Viral_Load\n \n 2023-08-17 10:05:15 UTC\n \n 2023-08-17 10:05:33 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2374\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4698)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and oss.obs_datetime <= cast('2023-06-30'as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-17 12:05:15',4,'2023-08-17 12:05:33',4,0,NULL,NULL,NULL,'7ec09187-6a9d-403e-97c3-f7d85f2a16a2'),(2375,'Clients given 5E with <20 Copies Viral Load','Clients given 5E with <20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5E with <20 Copies Viral Load\n Clients given 5E with <20 Copies Viral Load\n \n 2023-08-17 10:06:47 UTC\n \n 2023-08-17 10:09:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2375\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4698)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-17 12:06:47',4,'2023-08-17 12:09:36',4,0,NULL,NULL,NULL,'fc0384af-2aba-4967-94cf-351c49ff4c06'),(2376,'Clients given 5b with fair adherence','Clients given 5b with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5b with fair adherence\n Clients given 5b with fair adherence\n \n 2023-08-17 10:10:23 UTC\n \n 2023-08-17 10:12:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2376\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5b \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3682)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-17 12:10:23',4,'2023-08-17 12:12:23',4,0,NULL,NULL,NULL,'efbcc56c-18cd-4533-980c-6d8cf1c02e23'),(2377,'Clients given 5E with Undetectable Viral Load','Clients given 5E with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5E with Undetectable Viral Load\n Clients given 5E with Undetectable Viral Load\n \n 2023-08-17 10:10:47 UTC\n \n 2023-08-17 10:11:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2377\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4698)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- undetectable, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-17 12:10:47',4,'2023-08-17 12:11:44',4,0,NULL,NULL,NULL,'c1b14868-35fc-4ced-b9d6-d7434dbe4b96'),(2378,'Clients given 5b with good adherence','Clients given 5b with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5b with good adherence\n Clients given 5b with good adherence\n \n 2023-08-17 10:14:15 UTC\n \n 2023-08-17 10:15:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2378\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5b \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3682)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-17 12:14:15',4,'2023-08-17 12:15:01',4,0,NULL,NULL,NULL,'602e0915-bb58-4b03-a63e-ed3a6f83cc33'),(2379,'Clients given 5b with poor adherence','Clients given 5b with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5b with poor adherence\n Clients given 5b with poor adherence\n \n 2023-08-17 10:20:28 UTC\n \n 2023-08-17 10:24:24 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2379\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5b \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3682)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-17 12:20:28',4,'2023-08-17 12:24:24',4,0,NULL,NULL,NULL,'02a6a90c-a410-4c5e-a32f-a56f6dad4a49'),(2380,'Clients given 5F with >=20Copies Viral Load','Clients given 5F with >=20Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5F with >=20Copies Viral Load\n Clients given 5F with >=20Copies Viral Load\n \n 2023-08-17 10:20:38 UTC\n \n 2023-08-17 10:22:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2380\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4699)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 20 and _weight <= 24.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2023-08-17 12:20:38',4,'2023-08-17 12:22:29',4,0,NULL,NULL,NULL,'ed92d4db-077e-4eae-9c2c-963d455b9df3'),(2381,'Clients given 5F with <20 Copies Viral Load','Clients given 5F with <20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5F with <20 Copies Viral Load\n Clients given 5F with <20 Copies Viral Load\n \n 2023-08-17 10:27:57 UTC\n \n 2023-08-17 10:34:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2381\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4699)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-17 12:27:57',4,'2023-08-17 12:34:06',4,0,NULL,NULL,NULL,'9ca8ee52-584e-4164-85a0-73c3afffa236'),(2382,'Clients given 5F with Undetectable Viral Load','Clients given 5F with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5F with Undetectable Viral Load\n Clients given 5F with Undetectable Viral Load\n \n 2023-08-17 10:36:35 UTC\n \n 2023-08-17 10:37:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2382\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4699)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- undetectable, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-17 12:36:35',4,'2023-08-17 12:37:44',4,0,NULL,NULL,NULL,'fddbb793-03b3-432b-aa85-1afddec431d9'),(2383,'Clients given 5c with poor adherence','Clients given 5c with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5c with poor adherence\n Clients given 5c with poor adherence\n \n 2023-08-17 10:39:09 UTC\n \n 2023-08-17 10:40:19 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2383\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5c \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4696)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-17 12:39:09',4,'2023-08-17 12:40:19',4,0,NULL,NULL,NULL,'15d7e4f8-1626-4a98-ae7d-494e2cb6f49b'),(2384,'Clients given 5G with >=20Copies Viral Load','Clients given 5G with >=20Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G with >=20Copies Viral Load\n Clients given 5G with >=20Copies Viral Load\n \n 2023-08-17 10:42:06 UTC\n \n 2023-08-17 10:42:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2384\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4700)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and oss.obs_datetime <= cast('2023-06-30'as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-17 12:42:06',4,'2023-08-17 12:42:29',4,0,NULL,NULL,NULL,'2a249734-89d9-4f4c-bcab-dff2815d3b58'),(2385,'Clients given 5c with fair adherence','Clients given 5c with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5c with fair adherence\n Clients given 5c with fair adherence\n \n 2023-08-17 10:42:21 UTC\n \n 2023-08-17 10:43:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2385\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5c \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4696)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-17 12:42:21',4,'2023-08-17 12:43:23',4,0,NULL,NULL,NULL,'4d26e5f3-76e3-49fc-8a3c-f5de81a7724d'),(2386,'Clients given 5G with <20 Copies Viral Load','Clients given 5G with <20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G with <20 Copies Viral Load\n Clients given 5G with <20 Copies Viral Load\n \n 2023-08-17 10:45:37 UTC\n \n 2023-08-17 10:48:38 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2386\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4700)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-17 12:45:37',4,'2023-08-17 12:48:38',4,0,NULL,NULL,NULL,'353bb356-a392-4c21-8641-40fd092426ce'),(2387,'Clients given 5c with good adherence','Clients given 5c with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5c with good adherence\n Clients given 5c with good adherence\n \n 2023-08-17 10:56:34 UTC\n \n 2023-08-17 10:57:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2387\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5c \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4696)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-17 12:56:34',4,'2023-08-17 12:57:29',4,0,NULL,NULL,NULL,'3f30f547-9fa6-4336-b034-e79a64906b6c'),(2388,'Clients given 5G with Undetectable Viral Load','Clients given 5G with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G with Undetectable Viral Load\n Clients given 5G with Undetectable Viral Load\n \n 2023-08-17 10:58:06 UTC\n \n 2023-08-17 10:58:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2388\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4700)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- undetectable, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-17 12:58:06',4,'2023-08-17 12:58:41',4,0,NULL,NULL,NULL,'7cb7f18e-986e-4854-be48-ca51e1d753dc'),(2389,'Clients given 5d with poor adherence','Clients given 5d with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5d with poor adherence\n Clients given 5d with poor adherence\n \n 2023-08-17 11:03:17 UTC\n \n 2023-08-17 11:03:56 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2389\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5d \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4697)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-17 13:03:17',4,'2023-08-17 13:03:56',4,0,NULL,NULL,NULL,'77c59203-be56-4041-abaf-eb409f199aab'),(2390,'Clients given 5d with fair adherence','Clients given 5d with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5d with fair adherence\n Clients given 5d with fair adherence\n \n 2023-08-17 11:06:27 UTC\n \n 2023-08-17 11:07:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2390\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5d \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4697)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-17 13:06:27',4,'2023-08-17 13:07:15',4,0,NULL,NULL,NULL,'33ef5391-29b2-426b-bb43-75f88df81f18'),(2391,'Clients given 5H with >=20Copies Viral Load','Clients given 5H with >=20Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5H with >=20Copies Viral Load\n Clients given 5H with >=20Copies Viral Load\n \n 2023-08-17 11:06:39 UTC\n \n 2023-08-17 11:07:19 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2391\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND MONTH(os.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4701)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and oss.obs_datetime <= cast('2023-06-30'as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-17 13:06:39',4,'2023-08-17 13:07:19',4,0,NULL,NULL,NULL,'a6c02fb1-c931-4405-9dcd-1fa775e9d262'),(2392,':Clients given 5d with good adherence',':Clients given 5d with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n :Clients given 5d with good adherence\n :Clients given 5d with good adherence\n \n 2023-08-17 11:08:05 UTC\n \n 2023-08-17 11:08:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2392\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5d \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4697)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-17 13:08:05',4,'2023-08-17 13:08:51',4,0,NULL,NULL,NULL,'478a65e7-cbfc-4d04-bcbf-e97ad2119117'),(2393,'Clients given 5H with <20 Copies Viral Load','Clients given 5H with <20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5H with <20 Copies Viral Load\n Clients given 5H with <20 Copies Viral Load\n \n 2023-08-17 11:08:35 UTC\n \n 2023-08-17 11:09:13 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2393\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND MONTH(os.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4701)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-17 13:08:35',4,'2023-08-17 13:09:13',4,0,NULL,NULL,NULL,'92d662a9-7c9c-4d7f-8105-7892cc50f8df'),(2394,'Clients given 5H with Undetectable Viral Load','Clients given 5H with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5H with Undetectable Viral Load\n Clients given 5H with Undetectable Viral Load\n \n 2023-08-17 11:10:21 UTC\n \n 2023-08-17 11:12:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2394\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND MONTH(os.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4701)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- undetectable, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-17 13:10:21',4,'2023-08-17 13:12:04',4,0,NULL,NULL,NULL,'67ad52ec-1ca8-4bd4-977e-cb0930173888'),(2395,'Clients given 5e with poor adherence','Clients given 5e with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5e with poor adherence\n Clients given 5e with poor adherence\n \n 2023-08-17 11:11:53 UTC\n \n 2023-08-17 11:12:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2395\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5e \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4698)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-17 13:11:53',4,'2023-08-17 13:12:26',4,0,NULL,NULL,NULL,'13802910-1107-47fe-82b8-60340f77abef'),(2396,'Clients given 5e with fair adherence','Clients given 5e with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5e with fair adherence\n Clients given 5e with fair adherence\n \n 2023-08-17 11:13:19 UTC\n \n 2023-08-17 11:13:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2396\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5e \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4698)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-17 13:13:19',4,'2023-08-17 13:13:43',4,0,NULL,NULL,NULL,'6585614b-c405-4fe5-bcb0-8edae5825b41'),(2397,'Clients given 5e with good adherence','Clients given 5e with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5e with good adherence\n Clients given 5e with good adherence\n \n 2023-08-17 11:17:29 UTC\n \n 2023-08-17 11:18:09 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2397\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5e \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4698)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-17 13:17:29',4,'2023-08-17 13:18:09',4,0,NULL,NULL,NULL,'dc9c0189-b91f-4b80-a484-67e2f5b4005c'),(2398,'Clients given 6A with >=20Copies Viral Load','Clients given 6A with >=20Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6A with >=20Copies Viral Load\n Clients given 6A with >=20Copies Viral Load\n \n 2023-08-17 11:19:05 UTC\n \n 2023-08-17 11:19:35 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2398\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6A \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and oss.obs_datetime <= cast('2023-06-30'as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-17 13:19:05',4,'2023-08-17 13:19:35',4,0,NULL,NULL,NULL,'b0f47001-fdc3-4ea5-be0c-00112fab3bc8'),(2399,'Clients given 6A with <20 Copies Viral Load','Clients given 6A with <20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6A with <20 Copies Viral Load\n Clients given 6A with <20 Copies Viral Load\n \n 2023-08-17 11:21:31 UTC\n \n 2023-08-17 11:22:34 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2399\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6A \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n \n)) \n \n\n','2023-08-17 13:21:31',4,'2023-08-17 13:22:34',4,0,NULL,NULL,NULL,'b912ab78-0fb9-4639-a1f4-56f1e6b2e44e'),(2400,'Clients given 6A with Undetectable Viral Load','Clients given 6A with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6A with Undetectable Viral Load\n Clients given 6A with Undetectable Viral Load\n \n 2023-08-17 11:23:42 UTC\n \n 2023-08-17 11:24:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2400\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6A \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- undetectable, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n \n)) \n \n\n','2023-08-17 13:23:42',4,'2023-08-17 13:24:21',4,0,NULL,NULL,NULL,'2801df34-8bcf-4a7b-bc89-1210ad3d727d'),(2401,'Clients given 5f with poor adherence','Clients given 5f with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5f with poor adherence\n Clients given 5f with poor adherence\n \n 2023-08-17 11:26:41 UTC\n \n 2023-08-17 11:27:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2401\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5f \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4699)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-17 13:26:41',4,'2023-08-17 13:27:36',4,0,NULL,NULL,NULL,'c0c6a92f-87ed-4149-85af-4ed2e31328ac'),(2402,'Clients given 6B with >=20Copies Viral Load','Clients given 6B with >=20Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6B with >=20Copies Viral Load\n Clients given 6B with >=20Copies Viral Load\n \n 2023-08-17 11:27:26 UTC\n \n 2023-08-17 11:31:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2402\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6B \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and oss.obs_datetime <= cast('2023-06-30'as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-17 13:27:26',4,'2023-08-17 13:31:50',4,0,NULL,NULL,NULL,'c01f687e-baef-4589-b4fd-63abfc132991'),(2403,'Clients given 6B with <20 Copies Viral Load','Clients given 6B with <20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6B with <20 Copies Viral Load\n Clients given 6B with <20 Copies Viral Load\n \n 2023-08-17 11:29:39 UTC\n \n 2023-08-17 11:30:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2403\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6B \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-17 13:29:39',4,'2023-08-17 13:30:18',4,0,NULL,NULL,NULL,'f6a13155-22a3-4ecc-80bf-dfef935ebf86'),(2404,'Clients given 5f with fair adherence','Clients given 5f with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5f with fair adherence\n Clients given 5f with fair adherence\n \n 2023-08-17 11:31:51 UTC\n \n 2023-08-17 11:32:47 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2404\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5f \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4699)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-17 13:31:51',4,'2023-08-17 13:32:47',4,0,NULL,NULL,NULL,'250972a3-6fab-4d66-a028-7c43751cf95d'),(2405,'Clients given 6B with Undetectable Viral Load','Clients given 6B with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6B with Undetectable Viral Load\n Clients given 6B with Undetectable Viral Load\n \n 2023-08-17 11:32:32 UTC\n \n 2023-08-17 11:33:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2405\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6B \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- undetectable, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-17 13:32:32',4,'2023-08-17 13:33:32',4,0,NULL,NULL,NULL,'8a1f9b0e-f55d-40ed-b59f-92971f598921'),(2406,'Clients given 5f with good adherence','Clients given 5f with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5f with good adherence\n Clients given 5f with good adherence\n \n 2023-08-17 11:36:40 UTC\n \n 2023-08-17 11:37:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2406\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5f \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4699)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-17 13:36:40',4,'2023-08-17 13:37:11',4,0,NULL,NULL,NULL,'8839041b-b3d1-48b1-a0b2-bc09f91cad73'),(2407,'Clients given 6C with >=20 Copies Viral Load','Clients given 6C with >=20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C with >=20 Copies Viral Load\n Clients given 6C with >=20 Copies Viral Load\n \n 2023-08-17 11:39:53 UTC\n \n 2023-08-17 11:40:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2407\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4702)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and oss.obs_datetime <= cast('2023-06-30'as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-17 13:39:53',4,'2023-08-17 13:40:55',4,0,NULL,NULL,NULL,'c44258e3-391b-4e79-87f6-c647692cb3a1'),(2408,'Clients given 5g with poor adherence','Clients given 5g with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5g with poor adherence\n Clients given 5g with poor adherence\n \n 2023-08-17 11:41:26 UTC\n \n 2023-08-17 11:41:56 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2408\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5g \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4700)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-17 13:41:26',4,'2023-08-17 13:41:56',4,0,NULL,NULL,NULL,'a21e3c23-e513-4a3f-b229-b0baad328af6'),(2409,'Clients given 6C with <20 Copies Viral Load','Clients given 6C with <20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C with <20 Copies Viral Load\n Clients given 6C with <20 Copies Viral Load\n \n 2023-08-17 11:42:38 UTC\n \n 2023-08-17 11:43:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2409\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4702)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-17 13:42:38',4,'2023-08-17 13:43:20',4,0,NULL,NULL,NULL,'307392db-30aa-4e4c-a692-ab8350cb3f42'),(2410,'Clients given 5g with fair adherence','Clients given 5g with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5g with fair adherence\n Clients given 5g with fair adherence\n \n 2023-08-17 11:43:06 UTC\n \n 2023-08-17 11:43:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2410\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5g \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4700)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-17 13:43:06',4,'2023-08-17 13:43:28',4,0,NULL,NULL,NULL,'0875bc5c-9df9-43d6-8e7a-5363f19adc4f'),(2411,'Clients given 6C with Undetectable Viral Load','Clients given 6C with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C with Undetectable Viral Load\n Clients given 6C with Undetectable Viral Load\n \n 2023-08-17 11:45:31 UTC\n \n 2023-08-17 11:46:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2411\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4702)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- undetectable, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-17 13:45:31',4,'2023-08-17 13:46:32',4,0,NULL,NULL,NULL,'eb4392cf-c7f5-43c2-8f45-b56f46771ea3'),(2412,'Clients given 5g with good adherence','Clients given 5g with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5g with good adherence\n Clients given 5g with good adherence\n \n 2023-08-17 11:46:09 UTC\n \n 2023-08-17 11:46:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2412\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5g \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4700)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-17 13:46:09',4,'2023-08-17 13:46:30',4,0,NULL,NULL,NULL,'9878645d-2648-4c62-8679-1449355eaf0a'),(2413,'Clients given 5h with poor adherence','Clients given 5h with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5h with poor adherence\n Clients given 5h with poor adherence\n \n 2023-08-17 11:49:55 UTC\n \n 2023-08-17 11:51:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2413\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5h \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4701)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-17 13:49:55',4,'2023-08-17 13:51:43',4,0,NULL,NULL,NULL,'ad1e42cb-ff60-47fd-b8b1-0649da1899a1'),(2414,'Clients given 6D with >=20Copies Viral Load','Clients given 6D with >=20Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D with >=20Copies Viral Load\n Clients given 6D with >=20Copies Viral Load\n \n 2023-08-17 11:50:35 UTC\n \n 2023-08-17 11:51:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2414\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6D \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4703)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and oss.obs_datetime <= cast('2023-06-30'as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-17 13:50:35',4,'2023-08-17 13:51:45',4,0,NULL,NULL,NULL,'dbcd7d71-ba25-4619-8d23-dd2592aaf59a'),(2415,'Clients given 6D with <20 Copies Viral Load','Clients given 6D with <20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D with <20 Copies Viral Load\n Clients given 6D with <20 Copies Viral Load\n \n 2023-08-17 11:53:15 UTC\n \n 2023-08-17 11:54:09 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2415\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6D \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4703)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-17 13:53:15',4,'2023-08-17 13:54:09',4,0,NULL,NULL,NULL,'0199fd5f-2426-4c4e-b266-818a815ba80a'),(2416,'Clients given 5h with fair adherence','Clients given 5h with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5h with fair adherence\n Clients given 5h with fair adherence\n \n 2023-08-17 11:54:17 UTC\n \n 2023-08-17 11:54:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2416\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5h \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4701)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-17 13:54:17',4,'2023-08-17 13:54:39',4,0,NULL,NULL,NULL,'5478dbb5-4f3d-4a39-b263-625158d98129'),(2417,'Clients given 6D with Undetectable Viral Load','Clients given 6D with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D with Undetectable Viral Load\n Clients given 6D with Undetectable Viral Load\n \n 2023-08-17 11:55:34 UTC\n \n 2023-08-17 11:56:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2417\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6D \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4703)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- undetectable, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-17 13:55:34',4,'2023-08-17 13:56:31',4,0,NULL,NULL,NULL,'10a317c1-829c-4739-b7c0-f0b4ba18a69f'),(2418,'Clients given 5h with good adherence','Clients given 5h with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5h with good adherence\n Clients given 5h with good adherence\n \n 2023-08-17 11:57:56 UTC\n \n 2023-08-17 11:58:25 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2418\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5h \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4701)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-17 13:57:56',4,'2023-08-17 13:58:25',4,0,NULL,NULL,NULL,'00df085c-fd67-466a-94fa-2807a5cce6f7'),(2419,'Clients given 6E with >=20Copies Viral Load','Clients given 6E with >=20Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E with >=20Copies Viral Load\n Clients given 6E with >=20Copies Viral Load\n \n 2023-08-17 12:02:11 UTC\n \n 2023-08-17 12:04:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2419\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4704)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and oss.obs_datetime <= cast('2023-06-30'as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-17 14:02:11',4,'2023-08-17 14:04:41',4,0,NULL,NULL,NULL,'7c9d1608-dd16-4a6f-a811-aa9c285da131'),(2420,'Clients given 6a with poor adherence','Clients given 6a with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6a with poor adherence\n Clients given 6a with poor adherence\n \n 2023-08-17 12:07:35 UTC\n \n 2023-08-17 12:07:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2420\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6a \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-17 14:07:35',4,'2023-08-17 14:07:53',4,0,NULL,NULL,NULL,'b1f7d697-7125-4ad4-b73d-8538c0d0bf37'),(2421,'Clients given 6E with <20 Copies Viral Load','Clients given 6E with <20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E with <20 Copies Viral Load\n Clients given 6E with <20 Copies Viral Load\n \n 2023-08-17 12:07:43 UTC\n \n 2023-08-17 12:08:22 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2421\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4704)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-17 14:07:43',4,'2023-08-17 14:08:22',4,0,NULL,NULL,NULL,'76cdd1d3-9bb0-462b-a63d-5babfae535ae'),(2422,'Clients given 6a with fair adherence','Clients given 6a with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6a with fair adherence\n Clients given 6a with fair adherence\n \n 2023-08-17 12:09:05 UTC\n \n 2023-08-17 12:09:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2422\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6a \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-17 14:09:05',4,'2023-08-17 14:09:40',4,0,NULL,NULL,NULL,'7caf8270-2015-4b33-9cc4-2d23dcbbdd40'),(2423,'Clients given 6E with Undetectable Viral Load','Clients given 6E with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E with Undetectable Viral Load\n Clients given 6E with Undetectable Viral Load\n \n 2023-08-17 12:09:16 UTC\n \n 2023-08-17 12:10:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2423\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4704)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- undetectable, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-17 14:09:16',4,'2023-08-17 14:10:12',4,0,NULL,NULL,NULL,'42483bdd-5217-4e57-acfb-9dd6c405fc4e'),(2424,'Clients given 6a with good adherence','Clients given 6a with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6a with good adherence\n Clients given 6a with good adherence\n \n 2023-08-17 12:11:25 UTC\n \n 2023-08-17 12:11:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2424\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6a \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-17 14:11:25',4,'2023-08-17 14:11:53',4,0,NULL,NULL,NULL,'495d25ab-dea0-49b3-89de-2f64548597eb'),(2425,'Clients given 6F with >=20Copies Viral Load','Clients given 6F with >=20Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F with >=20Copies Viral Load\n Clients given 6F with >=20Copies Viral Load\n \n 2023-08-17 12:12:26 UTC\n \n 2023-08-17 12:13:56 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2425\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4705)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and oss.obs_datetime <= cast('2023-06-30'as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-17 14:12:26',4,'2023-08-17 14:13:56',4,0,NULL,NULL,NULL,'72be7653-8e41-42f4-9a8d-caa979c15ef6'),(2426,'Clients given 6F with <20 Copies Viral Load','Clients given 6F with <20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F with <20 Copies Viral Load\n Clients given 6F with <20 Copies Viral Load\n \n 2023-08-17 12:14:54 UTC\n \n 2023-08-17 12:15:37 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2426\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4705)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-17 14:14:54',4,'2023-08-17 14:15:37',4,0,NULL,NULL,NULL,'d11f84f3-e524-4688-9ad5-450362112a3d'),(2427,'Clients given 6b with poor adherence','Clients given 6b with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6b with poor adherence\n Clients given 6b with poor adherence\n \n 2023-08-17 12:15:12 UTC\n \n 2023-08-17 12:16:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2427\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6b \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-17 14:15:12',4,'2023-08-17 14:16:00',4,0,NULL,NULL,NULL,'c16525a3-70e2-41e5-948b-171525dbc0aa'),(2428,'Clients given 6F with Undetectable Viral Load','Clients given 6F with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F with Undetectable Viral Load\n Clients given 6F with Undetectable Viral Load\n \n 2023-08-17 12:16:55 UTC\n \n 2023-08-17 12:17:37 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2428\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4705)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- undetectable, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-17 14:16:55',4,'2023-08-17 14:17:37',4,0,NULL,NULL,NULL,'e278c929-0e08-4577-92f9-e1a972fcf688'),(2429,'Clients given 5a with >=20Copies Viral Load','Clients given 5a with >=20Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5a with >=20Copies Viral Load\n Clients given 5a with >=20Copies Viral Load\n \n 2023-08-17 12:19:02 UTC\n \n 2023-08-17 12:21:57 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2429\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 14:19:02',4,'2023-08-17 14:21:57',4,0,NULL,NULL,NULL,'ac679df3-e5a4-4548-ba63-4fd778196ea4'),(2430,'Clients given 6b with fair adherence','Clients given 6b with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6b with fair adherence\n Clients given 6b with fair adherence\n \n 2023-08-17 12:19:38 UTC\n \n 2023-08-17 12:19:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2430\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6b \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-17 14:19:38',4,'2023-08-17 14:19:59',4,0,NULL,NULL,NULL,'c4aaf23a-6f87-424e-b8d6-b1519273b376'),(2431,'Clients given 6b with good adherence','Clients given 6b with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6b with good adherence\n Clients given 6b with good adherence\n \n 2023-08-17 12:21:00 UTC\n \n 2023-08-17 12:21:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2431\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6b \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-17 14:21:00',4,'2023-08-17 14:21:45',4,0,NULL,NULL,NULL,'96917926-b178-4bf4-8113-7300329ee951'),(2432,'Clients given 5A with <20Copies Viral Load','Clients given 5A with <20Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5A with <20Copies Viral Load\n Clients given 5A with <20Copies Viral Load\n \n 2023-08-17 12:23:16 UTC\n \n 2023-08-17 12:25:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2432\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 14:23:16',4,'2023-08-17 14:25:32',4,0,NULL,NULL,NULL,'9a1038ff-dcfd-4b2c-93a9-d7c68030d1ef'),(2433,'Clients given 5A with Undetectable Viral Load','Clients given 5A with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5A with Undetectable Viral Load\n Clients given 5A with Undetectable Viral Load\n \n 2023-08-17 12:27:23 UTC\n \n 2023-08-17 12:28:22 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2433\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 14:27:23',4,'2023-08-17 14:28:22',4,0,NULL,NULL,NULL,'f401ae7b-f27f-4b25-926f-65e3b8c81863'),(2434,'Clients given 5B with >=20Copies Viral Load','Clients given 5B with >=20Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5B with >=20Copies Viral Load\n Clients given 5B with >=20Copies Viral Load\n \n 2023-08-17 12:29:26 UTC\n \n 2023-08-17 12:33:25 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2434\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 14:29:26',4,'2023-08-17 14:33:25',4,0,NULL,NULL,NULL,'938a8cf8-cfb9-422e-be17-3a1e59e3c135'),(2435,'Clients given 6c with poor adherence','Clients given 6c with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6c with poor adherence\n Clients given 6c with poor adherence\n \n 2023-08-17 12:34:23 UTC\n \n 2023-08-17 12:35:25 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2435\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6c \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4702)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-17 14:34:23',4,'2023-08-17 14:35:25',4,0,NULL,NULL,NULL,'a854add1-66a5-4624-94b8-ee9cc9f6b618'),(2436,'Clients given 5B with <20 Copies Viral Load','','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5B with <20 Copies Viral Load\n \n \n 2023-08-17 12:34:37 UTC\n \n 2023-08-17 12:35:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2436\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 14:34:37',4,'2023-08-17 14:35:36',4,0,NULL,NULL,NULL,'160dcddc-c186-4d31-a0c8-47edca4fc581'),(2437,'Clients given 5B with Undetectable Viral Load','Clients given 5B with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5B with Undetectable Viral Load\n Clients given 5B with Undetectable Viral Load\n \n 2023-08-17 12:36:46 UTC\n \n 2023-08-17 12:38:09 UTC\n \n \n endDate\n \n java.util.Date\n true\n \n \n startDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2437\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 14:36:46',4,'2023-08-17 14:38:09',4,0,NULL,NULL,NULL,'5f976c00-44ef-4b36-bed0-b976bb7f2b55'),(2438,'Clients given 6c with fair adherence','Clients given 6c with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6c with fair adherence\n Clients given 6c with fair adherence\n \n 2023-08-17 12:36:48 UTC\n \n 2023-08-17 12:37:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2438\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6c \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4702)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-17 14:36:48',4,'2023-08-17 14:37:12',4,0,NULL,NULL,NULL,'65b4eb44-cc9f-494e-b621-ee1bdedbc549'),(2439,'Clients given 6c with good adherence','Clients given 6c with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6c with good adherence\n Clients given 6c with good adherence\n \n 2023-08-17 12:38:40 UTC\n \n 2023-08-17 12:38:57 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2439\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6c \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4702)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-17 14:38:40',4,'2023-08-17 14:38:57',4,0,NULL,NULL,NULL,'17b46231-8af2-49d6-ab43-17a6d13d30d4'),(2440,'Clients given 5C with >=20 Copies Viral Load','Clients given 5C with >=20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5C with >=20 Copies Viral Load\n Clients given 5C with >=20 Copies Viral Load\n \n 2023-08-17 12:38:53 UTC\n \n 2023-08-17 12:39:46 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2440\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 14:38:53',4,'2023-08-17 14:39:46',4,0,NULL,NULL,NULL,'ddd536bc-c879-4847-9c50-cc79a002813e'),(2441,'Clients given 6d with poor adherence','Clients given 6d with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6d with poor adherence\n Clients given 6d with poor adherence\n \n 2023-08-17 12:40:45 UTC\n \n 2023-08-17 12:41:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2441\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6d \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4703)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-17 14:40:45',4,'2023-08-17 14:41:01',4,0,NULL,NULL,NULL,'fa914aa2-ce96-4063-a749-7718cf76a361'),(2442,'Clients given 5C with <20 Copies Viral Load','Clients given 5C with <20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5C with <20 Copies Viral Load\n Clients given 5C with <20 Copies Viral Load\n \n 2023-08-17 12:41:03 UTC\n \n 2023-08-17 12:43:01 UTC\n \n \n endDate\n \n java.util.Date\n true\n \n \n startDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2442\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 14:41:03',4,'2023-08-17 14:43:01',4,0,NULL,NULL,NULL,'394324e6-b5b5-406f-9fb0-83194dc1b533'),(2443,'Clients given 6d with fair adherence','Clients given 6d with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6d with fair adherence\n Clients given 6d with fair adherence\n \n 2023-08-17 12:41:48 UTC\n \n 2023-08-17 12:42:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2443\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6d \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4703)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-17 14:41:48',4,'2023-08-17 14:42:15',4,0,NULL,NULL,NULL,'6a150299-a792-4070-953d-c475224522f9'),(2444,' Clients given 6d with good adherence',' Clients given 6d with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6d with good adherence\n Clients given 6d with good adherence\n \n 2023-08-17 12:43:47 UTC\n \n 2023-08-17 12:44:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2444\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6d \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4703)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-17 14:43:47',4,'2023-08-17 14:44:08',4,0,NULL,NULL,NULL,'66ddc4ec-de69-43a5-8cda-3e7f9f8d28af'),(2445,'Clients given 5C with Undetectable Viral Load','Clients given 5C with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5C with Undetectable Viral Load\n Clients given 5C with Undetectable Viral Load\n \n 2023-08-17 12:44:54 UTC\n \n 2023-08-17 12:50:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2445\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 14:44:54',4,'2023-08-17 14:50:20',4,0,NULL,NULL,NULL,'c75e1385-b87e-49d1-a8ba-418f96c68379'),(2446,'Clients given 6e with poor adherence','Clients given 6e with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6e with poor adherence\n Clients given 6e with poor adherence\n \n 2023-08-17 12:49:27 UTC\n \n 2023-08-17 12:49:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2446\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6e \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4704)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-17 14:49:27',4,'2023-08-17 14:49:43',4,0,NULL,NULL,NULL,'0a65b09f-f0a6-45a6-a240-46f0a48dda2a'),(2447,'Clients given 6e with fair adherence','Clients given 6e with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6e with fair adherence\n Clients given 6e with fair adherence\n \n 2023-08-17 12:50:30 UTC\n \n 2023-08-17 12:50:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2447\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6e \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4704)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-17 14:50:30',4,'2023-08-17 14:50:58',4,0,NULL,NULL,NULL,'3e2fec32-323e-453b-b4e1-23e746f37f1a'),(2448,'Clients given 6e with good adherence','Clients given 6e with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6e with good adherence\n Clients given 6e with good adherence\n \n 2023-08-17 12:52:12 UTC\n \n 2023-08-17 12:53:46 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2448\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6e \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4704)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-17 14:52:12',4,'2023-08-17 14:53:46',4,0,NULL,NULL,NULL,'ca2d72c9-cfb8-44bd-8859-2813817d6a80'),(2449,'Clients given 6f with poor adherence','Clients given 6f with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6f with poor adherence\n Clients given 6f with poor adherence\n \n 2023-08-17 12:55:45 UTC\n \n 2023-08-17 12:56:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2449\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6f \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4705)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-17 14:55:45',4,'2023-08-17 14:56:07',4,0,NULL,NULL,NULL,'68e19030-f17c-4489-8e26-e854ac11fcde'),(2450,'Clients given 6f with fair adherence','Clients given 6f with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6f with fair adherence\n Clients given 6f with fair adherence\n \n 2023-08-17 12:56:59 UTC\n \n 2023-08-17 12:57:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2450\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6f \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4705)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-17 14:56:59',4,'2023-08-17 14:57:27',4,0,NULL,NULL,NULL,'9680051f-31ff-417c-9560-8bfce8b63699'),(2451,'Clients given 6f with good adherence','Clients given 6f with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6f with good adherence\n Clients given 6f with good adherence\n \n 2023-08-17 12:57:57 UTC\n \n 2023-08-17 12:58:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2451\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6f \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4705)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-17 14:57:57',4,'2023-08-17 14:58:15',4,0,NULL,NULL,NULL,'44fef653-ab93-4af5-a5b4-84c2dc981aee'),(2452,'Clients given 5D with >=20Copies_Viral_Load','Clients given 5D with >=20Copies_Viral_Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5D with >=20Copies_Viral_Load\n Clients given 5D with >=20Copies_Viral_Load\n \n 2023-08-17 13:57:36 UTC\n \n 2023-08-17 14:00:01 UTC\n \n \n endDate\n \n java.util.Date\n true\n \n \n startDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2452\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 15:57:36',4,'2023-08-17 16:00:01',4,0,NULL,NULL,NULL,'bcaf7abb-e0b1-4b0d-8bce-72a0bcd6aa19'),(2453,'Clients given 5a with poor adherence','Clients given 5a with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5a with poor adherence\n Clients given 5a with poor adherence\n \n 2023-08-17 13:57:52 UTC\n \n 2023-08-17 13:59:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2453\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 15:57:52',4,'2023-08-17 15:59:50',4,0,NULL,NULL,NULL,'a744dde1-e30e-4a5c-877e-a5ad781ff393'),(2454,'Clients given 5a with fair adherence','Clients given 5a with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5a with fair adherence\n Clients given 5a with fair adherence\n \n 2023-08-17 14:01:28 UTC\n \n 2023-08-17 14:02:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2454\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:01:28',4,'2023-08-17 16:02:53',4,0,NULL,NULL,NULL,'63a61c4d-d9b0-4d4b-91a9-9aeba57141aa'),(2455,'Clients given 5D with <20Copies_Viral_Load','Clients given 5D with <20Copies_Viral_Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5D with <20Copies_Viral_Load\n Clients given 5D with <20Copies_Viral_Load\n \n 2023-08-17 14:01:35 UTC\n \n 2023-08-17 14:02:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2455\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:01:35',4,'2023-08-17 16:02:39',4,0,NULL,NULL,NULL,'ec730cde-9848-44d6-93c0-081b9faf2710'),(2456,'Clients given 5D with Undetectable Viral Load','Clients given 5D with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5D with Undetectable Viral Load\n Clients given 5D with Undetectable Viral Load\n \n 2023-08-17 14:03:49 UTC\n \n 2023-08-17 14:05:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2456\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:03:49',4,'2023-08-17 16:05:14',4,0,NULL,NULL,NULL,'f254459b-e8e8-4930-837c-a1c156604ebf'),(2457,'Clients given 5E with >=20Copies_Viral_Load','Clients given 5E with >=20Copies_Viral_Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5E with >=20Copies_Viral_Load\n Clients given 5E with >=20Copies_Viral_Load\n \n 2023-08-17 14:05:53 UTC\n \n 2023-08-17 14:06:48 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2457\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:05:53',4,'2023-08-17 16:06:48',4,0,NULL,NULL,NULL,'4bea5c18-e6c1-4c17-b1d2-df2a72d826b4'),(2458,'Clients given 5a with good adherence','Clients given 5a with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5a with good adherence\n Clients given 5a with good adherence\n \n 2023-08-17 14:06:18 UTC\n \n 2023-08-17 14:07:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2458\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:06:18',4,'2023-08-17 16:07:21',4,0,NULL,NULL,NULL,'6b4360ec-6413-487c-b5ce-6306a93d594d'),(2459,'Clients given 5E with <20 Copies Viral Load','Clients given 5E with <20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5E with <20 Copies Viral Load\n Clients given 5E with <20 Copies Viral Load\n \n 2023-08-17 14:07:29 UTC\n \n 2023-08-17 14:08:34 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2459\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:07:29',4,'2023-08-17 16:08:34',4,0,NULL,NULL,NULL,'2941db2b-ab51-4716-85b7-d433faab7089'),(2460,'Clients given 5b with poor adherence','Clients given 5b with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5b with poor adherence\n Clients given 5b with poor adherence\n \n 2023-08-17 14:08:02 UTC\n \n 2023-08-17 14:08:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2460\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:08:02',4,'2023-08-17 16:08:58',4,0,NULL,NULL,NULL,'40f47ac2-87c8-4b1c-a673-ce43a9e640ae'),(2461,'Clients given 5E with Undetectable Viral Load','Clients given 5E with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5E with Undetectable Viral Load\n Clients given 5E with Undetectable Viral Load\n \n 2023-08-17 14:09:17 UTC\n \n 2023-08-17 14:10:49 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2461\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:09:17',4,'2023-08-17 16:10:49',4,0,NULL,NULL,NULL,'4bff5bff-95d4-4b93-b4e0-bb6a0c0e70b9'),(2462,'Clients given 5b with fair adherence','Clients given 5b with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5b with fair adherence\n Clients given 5b with fair adherence\n \n 2023-08-17 14:09:25 UTC\n \n 2023-08-17 14:10:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2462\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:09:25',4,'2023-08-17 16:10:18',4,0,NULL,NULL,NULL,'6fc3a2a5-a532-4394-8c1f-a824d12535b1'),(2463,'Clients given 5b with good adherence','Clients given 5b with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5b with good adherence\n Clients given 5b with good adherence\n \n 2023-08-17 14:11:16 UTC\n \n 2023-08-17 14:15:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2463\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:11:16',4,'2023-08-17 16:15:00',4,0,NULL,NULL,NULL,'0370fb97-e838-423b-a27f-84b8bfccbdf7'),(2464,'Clients given 5F with >=20Copies Viral Load','Clients given 5F with >=20Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5F with >=20Copies Viral Load\n Clients given 5F with >=20Copies Viral Load\n \n 2023-08-17 14:11:27 UTC\n \n 2023-08-17 14:12:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2464\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:11:27',4,'2023-08-17 16:12:29',4,0,NULL,NULL,NULL,'57bdd154-b1fd-445e-9c4f-4c86d9574dca'),(2465,'Clients given 5c with poor adherence','Clients given 5c with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5c with poor adherence\n Clients given 5c with poor adherence\n \n 2023-08-17 14:11:45 UTC\n \n 2023-08-17 14:15:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2465\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:11:45',4,'2023-08-17 16:15:44',4,0,NULL,NULL,NULL,'55fe3a12-7f92-4c13-a9e4-130999a508ab'),(2466,'Clients given 5F with <20 Copies Viral Load','Clients given 5F with <20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5F with <20 Copies Viral Load\n Clients given 5F with <20 Copies Viral Load\n \n 2023-08-17 14:13:17 UTC\n \n 2023-08-17 14:14:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2466\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:13:17',4,'2023-08-17 16:14:26',4,0,NULL,NULL,NULL,'99587c4e-7a32-4f0a-8875-db1f5ded867f'),(2467,'Clients given 5F with Undetectable Viral Load','Clients given 5F with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5F with Undetectable Viral Load\n Clients given 5F with Undetectable Viral Load\n \n 2023-08-17 14:15:33 UTC\n \n 2023-08-17 14:16:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2467\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:15:33',4,'2023-08-17 16:16:40',4,0,NULL,NULL,NULL,'ab5801be-bc9d-4d49-b637-c40c1442e859'),(2468,'Clients given 5c with fair adherence','Clients given 5c with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5c with fair adherence\n Clients given 5c with fair adherence\n \n 2023-08-17 14:16:13 UTC\n \n 2023-08-17 14:17:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2468\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:16:13',4,'2023-08-17 16:17:42',4,0,NULL,NULL,NULL,'c3f8c51c-b012-4725-93b5-3806093e90a2'),(2469,'Clients given 5G with >=20Copies Viral Load','Clients given 5G with >=20Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G with >=20Copies Viral Load\n Clients given 5G with >=20Copies Viral Load\n \n 2023-08-17 14:17:34 UTC\n \n 2023-08-17 14:19:13 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2469\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:17:34',4,'2023-08-17 16:19:13',4,0,NULL,NULL,NULL,'ac5ef4a7-17ea-4550-bd66-73b5d95c9c04'),(2470,'Clients given 5c with good adherence','Clients given 5c with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5c with good adherence\n Clients given 5c with good adherence\n \n 2023-08-17 14:18:32 UTC\n \n 2023-08-17 14:22:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2470\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:18:32',4,'2023-08-17 16:22:06',4,0,NULL,NULL,NULL,'c667f290-2936-42fb-859e-4d8978b03814'),(2471,'Clients given 5d with poor adherence','Clients given 5d with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5d with poor adherence\n Clients given 5d with poor adherence\n \n 2023-08-17 14:19:32 UTC\n \n 2023-08-17 14:24:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2471\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:19:32',4,'2023-08-17 16:24:53',4,0,NULL,NULL,NULL,'4f154124-3ed5-4605-afb8-ab6d47c97cfa'),(2472,'Clients given 5G with <20 Copies Viral Load','Clients given 5G with <20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G with <20 Copies Viral Load\n Clients given 5G with <20 Copies Viral Load\n \n 2023-08-17 14:20:08 UTC\n \n 2023-08-17 14:23:09 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2472\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:20:08',4,'2023-08-17 16:23:09',4,0,NULL,NULL,NULL,'1b6b36fd-ab78-457d-9af4-ecd3ec235533'),(2473,'Clients given 5G with Undetectable Viral Load','Clients given 5G with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G with Undetectable Viral Load\n Clients given 5G with Undetectable Viral Load\n \n 2023-08-17 14:24:11 UTC\n \n 2023-08-17 14:25:46 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2473\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:24:11',4,'2023-08-17 16:25:46',4,0,NULL,NULL,NULL,'8e1a22eb-ac03-450c-9550-43957fc8e8af'),(2474,'Clients given 5d with fair adherence','Clients given 5d with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5d with fair adherence\n Clients given 5d with fair adherence\n \n 2023-08-17 14:26:28 UTC\n \n 2023-08-17 14:27:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2474\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:26:28',4,'2023-08-17 16:27:32',4,0,NULL,NULL,NULL,'64f11aa4-8642-4293-8a6d-ed4436c8b783'),(2475,'Clients given 5H with >=20Copies Viral Load','Clients given 5H with >=20Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5H with >=20Copies Viral Load\n Clients given 5H with >=20Copies Viral Load\n \n 2023-08-17 14:26:40 UTC\n \n 2023-08-17 14:27:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2475\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:26:40',4,'2023-08-17 16:27:31',4,0,NULL,NULL,NULL,'3184b05c-dbf5-4c1a-abed-d310e409fb09'),(2476,'Clients given 5d with good adherence','Clients given 5d with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5d with good adherence\n Clients given 5d with good adherence\n \n 2023-08-17 14:27:55 UTC\n \n 2023-08-17 14:35:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2476\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:27:55',4,'2023-08-17 16:35:53',4,0,NULL,NULL,NULL,'d60ecbe6-5a56-449d-814e-d669d864ed86'),(2477,'Clients given 5H with <20 Copies Viral Load','Clients given 5H with <20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5H with <20 Copies Viral Load\n Clients given 5H with <20 Copies Viral Load\n \n 2023-08-17 14:28:41 UTC\n \n 2023-08-17 14:30:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2477\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:28:41',4,'2023-08-17 16:30:28',4,0,NULL,NULL,NULL,'54488b0e-09b6-4801-8d42-510fefdfa04c'),(2478,'Clients given 5H with Undetectable Viral Load','Clients given 5H with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5H with Undetectable Viral Load\n Clients given 5H with Undetectable Viral Load\n \n 2023-08-17 14:31:09 UTC\n \n 2023-08-17 14:34:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2478\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:31:09',4,'2023-08-17 16:34:51',4,0,NULL,NULL,NULL,'7a4e4111-651c-407d-b445-041fd397599c'),(2479,'Clients given 5d with good adherence','Clients given 5d with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5d with good adherence\n Clients given 5d with good adherence\n \n 2023-08-17 14:33:34 UTC\n \n 2023-08-17 14:33:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2479\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5d \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4697)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-17 16:33:34',4,'2023-08-17 16:33:55',4,0,NULL,NULL,NULL,'3300f25b-40f1-4c24-8223-41cfada5c62a'); -INSERT INTO `serialized_object` VALUES (2480,'Clients given 6A with >=20Copies Viral Load','Clients given 6A with >=20Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6A with >=20Copies Viral Load\n Clients given 6A with >=20Copies Viral Load\n \n 2023-08-17 14:35:48 UTC\n \n 2023-08-17 14:36:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2480\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:35:48',4,'2023-08-17 16:36:40',4,0,NULL,NULL,NULL,'aaaf1254-b937-4fdd-abdf-7f99bc97c9e4'),(2481,'Clients given 5e with poor adherence','Clients given 5e with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5e with poor adherence\n Clients given 5e with poor adherence\n \n 2023-08-17 14:36:47 UTC\n \n 2023-08-17 14:37:52 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2481\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:36:47',4,'2023-08-17 16:37:52',4,0,NULL,NULL,NULL,'b6365db8-5402-488e-bf43-1b4b3869592c'),(2482,'Clients given 6A with <20 Copies Viral Load','Clients given 6A with <20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6A with <20 Copies Viral Load\n Clients given 6A with <20 Copies Viral Load\n \n 2023-08-17 14:37:57 UTC\n \n 2023-08-17 14:40:25 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2482\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:37:57',4,'2023-08-17 16:40:25',4,0,NULL,NULL,NULL,'6dc49bb6-9be8-4b6b-9db7-7cd1e9e9832b'),(2483,'Clients given 5e with fair adherence','Clients given 5e with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5e with fair adherence\n Clients given 5e with fair adherence\n \n 2023-08-17 14:38:45 UTC\n \n 2023-08-17 14:40:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2483\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:38:45',4,'2023-08-17 16:40:42',4,0,NULL,NULL,NULL,'c9761b31-3a7f-4cdb-bce2-e422d0f0a1d9'),(2484,'Clients given 6A with Undetectable Viral Load','Clients given 6A with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6A with Undetectable Viral Load\n Clients given 6A with Undetectable Viral Load\n \n 2023-08-17 14:41:52 UTC\n \n 2023-08-17 14:43:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2484\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:41:52',4,'2023-08-17 16:43:11',4,0,NULL,NULL,NULL,'88ff8b16-c2f3-4f73-accf-0b799dbd4357'),(2485,'Clients given 6B with >=20Copies Viral Load','Clients given 6B with >=20Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6B with >=20Copies Viral Load\n Clients given 6B with >=20Copies Viral Load\n \n 2023-08-17 14:43:49 UTC\n \n 2023-08-17 15:26:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2485\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:43:49',4,'2023-08-17 17:26:07',4,0,NULL,NULL,NULL,'3e4ca350-0d23-4326-b54b-1da860205aa2'),(2486,'Clients given 5e with good adherence','Clients given 5e with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5e with good adherence\n Clients given 5e with good adherence\n \n 2023-08-17 14:44:26 UTC\n \n 2023-08-17 14:46:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2486\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:44:26',4,'2023-08-17 16:46:50',4,0,NULL,NULL,NULL,'bf269091-cd68-4987-adc0-88a0d53b0799'),(2487,'Clients given 5f with poor adherence','Clients given 5f with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5f with poor adherence\n Clients given 5f with poor adherence\n \n 2023-08-17 14:45:30 UTC\n \n 2023-08-17 14:47:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2487\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:45:30',4,'2023-08-17 16:47:18',4,0,NULL,NULL,NULL,'8628ac34-e4de-44ad-bf49-0cd48799c0e0'),(2488,'Clients given 5f with fair adherence','Clients given 5f with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5f with fair adherence\n Clients given 5f with fair adherence\n \n 2023-08-17 14:47:44 UTC\n \n 2023-08-17 14:48:56 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2488\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:47:44',4,'2023-08-17 16:48:56',4,0,NULL,NULL,NULL,'05773449-f7c2-428e-b2d7-13d526846f6d'),(2489,'Clients given 5f with good adherence','Clients given 5f with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5f with good adherence\n Clients given 5f with good adherence\n \n 2023-08-17 14:48:23 UTC\n \n 2023-08-17 14:51:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2489\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:48:23',4,'2023-08-17 16:51:06',4,0,NULL,NULL,NULL,'0a2c5054-fcf0-46e8-94bd-150cc697fad7'),(2490,'Clients given 5g with poor adherence','Clients given 5g with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5g with poor adherence\n Clients given 5g with poor adherence\n \n 2023-08-17 14:51:41 UTC\n \n 2023-08-17 14:52:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2490\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:51:41',4,'2023-08-17 16:52:53',4,0,NULL,NULL,NULL,'92f0cb76-2f6b-4be0-b525-90c4d4665b90'),(2491,'Clients given 5g with fair adherence','Clients given 5g with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5g with fair adherence\n Clients given 5g with fair adherence\n \n 2023-08-17 14:54:10 UTC\n \n 2023-08-17 14:55:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2491\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:54:10',4,'2023-08-17 16:55:17',4,0,NULL,NULL,NULL,'d159ee3c-798c-4b94-ae55-f17634b6bd38'),(2492,'Clients given 5g with good adherence','Clients given 5g with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5g with good adherence\n Clients given 5g with good adherence\n \n 2023-08-17 14:55:50 UTC\n \n 2023-08-17 14:56:54 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2492\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:55:50',4,'2023-08-17 16:56:54',4,0,NULL,NULL,NULL,'2c0bc567-51cc-4892-a4ce-5266c8e9cf58'),(2493,'Clients given 5h with poor adherence','Clients given 5h with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5h with poor adherence\n Clients given 5h with poor adherence\n \n 2023-08-17 14:56:39 UTC\n \n 2023-08-17 14:58:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2493\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:56:39',4,'2023-08-17 16:58:17',4,0,NULL,NULL,NULL,'18332615-0cd2-4f3c-a2dd-537056310823'),(2494,'Clients given 5h with fair adherence','Clients given 5h with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5h with fair adherence\n Clients given 5h with fair adherence\n \n 2023-08-17 14:57:51 UTC\n \n 2023-08-17 14:59:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2494\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:57:51',4,'2023-08-17 16:59:12',4,0,NULL,NULL,NULL,'9bee8b12-d34c-4ec0-a136-cdc38d312f76'),(2495,'Clients given 5h with good adherence','Clients given 5h with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5h with good adherence\n Clients given 5h with good adherence\n \n 2023-08-17 14:59:01 UTC\n \n 2023-08-17 15:00:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2495\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:59:01',4,'2023-08-17 17:00:11',4,0,NULL,NULL,NULL,'8d2837ca-19e0-461e-8bde-fdee3e9f117c'),(2496,'Clients given 6a with poor adherence','Clients given 6a with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6a with poor adherence\n Clients given 6a with poor adherence\n \n 2023-08-17 15:00:41 UTC\n \n 2023-08-17 15:01:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2496\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:00:41',4,'2023-08-17 17:01:40',4,0,NULL,NULL,NULL,'25323965-1cc3-4c63-b997-5c6ff173ad1b'),(2497,'Clients given 6a with fair adherence','Clients given 6a with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6a with fair adherence\n Clients given 6a with fair adherence\n \n 2023-08-17 15:01:29 UTC\n \n 2023-08-17 15:03:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2497\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:01:29',4,'2023-08-17 17:03:14',4,0,NULL,NULL,NULL,'38990f18-eb9c-43ff-8323-96c3a6eb90c2'),(2498,'Clients given 6a with good adherence','Clients given 6a with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6a with good adherence\n Clients given 6a with good adherence\n \n 2023-08-17 15:02:51 UTC\n \n 2023-08-17 15:04:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2498\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:02:51',4,'2023-08-17 17:04:00',4,0,NULL,NULL,NULL,'2e00abe1-aed1-485e-858f-2a0baf0eaf3c'),(2499,'Clients given 6b with poor adherence','Clients given 6b with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6b with poor adherence\n Clients given 6b with poor adherence\n \n 2023-08-17 15:04:48 UTC\n \n 2023-08-17 15:06:13 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2499\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:04:48',4,'2023-08-17 17:06:13',4,0,NULL,NULL,NULL,'2452d808-0319-435c-8a68-0f849c38d53e'),(2500,'Clients given 6b with fair adherence','Clients given 6b with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6b with fair adherence\n Clients given 6b with fair adherence\n \n 2023-08-17 15:06:01 UTC\n \n 2023-08-17 15:08:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2500\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:06:01',4,'2023-08-17 17:08:42',4,0,NULL,NULL,NULL,'6a9e9b7e-3e06-4f47-9abb-ad685a5d86ca'),(2501,'Clients given 6b with good adherence','Clients given 6b with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6b with good adherence\n Clients given 6b with good adherence\n \n 2023-08-17 15:06:55 UTC\n \n 2023-08-17 15:09:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2501\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:06:55',4,'2023-08-17 17:09:06',4,0,NULL,NULL,NULL,'8340a9bc-f2fc-4a2d-ab84-74569dfe8a86'),(2502,'Clients given 6c with poor adherence','Clients given 6c with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6c with poor adherence\n Clients given 6c with poor adherence\n \n 2023-08-17 15:09:40 UTC\n \n 2023-08-17 15:11:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2502\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:09:40',4,'2023-08-17 17:11:01',4,0,NULL,NULL,NULL,'052f51db-d6e4-4078-9f3f-bed7d17b48bd'),(2503,'Clients given 6c with fair adherence','Clients given 6c with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6c with fair adherence\n Clients given 6c with fair adherence\n \n 2023-08-17 15:10:40 UTC\n \n 2023-08-17 15:12:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2503\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:10:40',4,'2023-08-17 17:12:06',4,0,NULL,NULL,NULL,'f8e62785-7303-493a-9c20-6c9f4280faf0'),(2504,'Clients given 6c with good adherence','Clients given 6c with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6c with good adherence\n Clients given 6c with good adherence\n \n 2023-08-17 15:11:54 UTC\n \n 2023-08-17 15:13:48 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2504\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:11:54',4,'2023-08-17 17:13:48',4,0,NULL,NULL,NULL,'9b361e36-e897-4212-8c7f-26121e595425'),(2505,'Clients given 6d with poor adherence','Clients given 6d with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6d with poor adherence\n Clients given 6d with poor adherence\n \n 2023-08-17 15:13:21 UTC\n \n 2023-08-17 15:15:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2505\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:13:21',4,'2023-08-17 17:15:04',4,0,NULL,NULL,NULL,'56b2509b-811c-4452-8432-5807792f207a'),(2506,'Clients given 6d with fair adherence','Clients given 6d with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6d with fair adherence\n Clients given 6d with fair adherence\n \n 2023-08-17 15:14:20 UTC\n \n 2023-08-17 15:16:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2506\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:14:20',4,'2023-08-17 17:16:21',4,0,NULL,NULL,NULL,'2808446d-305f-4bf7-b83b-3a5aad7cc119'),(2507,'Clients given 6d with good adherence','Clients given 6d with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6d with good adherence\n Clients given 6d with good adherence\n \n 2023-08-17 15:17:32 UTC\n \n 2023-08-17 15:17:52 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2507\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6d \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4703)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-17 17:17:32',4,'2023-08-17 17:17:52',4,0,NULL,NULL,NULL,'a10f7cfb-6012-4c2a-8f4f-f9ef7cdd8310'),(2508,'Clients given 6d with good adherence','Clients given 6d with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6d with good adherence\n Clients given 6d with good adherence\n \n 2023-08-17 15:18:32 UTC\n \n 2023-08-17 15:19:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2508\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:18:32',4,'2023-08-17 17:19:41',4,0,NULL,NULL,NULL,'e271c92e-f3e8-4218-a758-f2d91fd4173e'),(2509,'Clients given 6e with poor adherence','Clients given 6e with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6e with poor adherence\n Clients given 6e with poor adherence\n \n 2023-08-17 15:19:01 UTC\n \n 2023-08-17 15:20:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2509\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:19:01',4,'2023-08-17 17:20:53',4,0,NULL,NULL,NULL,'8c2c0191-d6e6-4f9c-a84d-976f24a47e5a'),(2510,'Clients given 6e with fair adherence','Clients given 6e with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6e with fair adherence\n Clients given 6e with fair adherence\n \n 2023-08-17 15:20:17 UTC\n \n 2023-08-17 15:22:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2510\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:20:17',4,'2023-08-17 17:22:00',4,0,NULL,NULL,NULL,'16552ea9-b4bb-4ae3-ae13-c04d366a5a72'),(2511,'Clients given 6e with good adherence','Clients given 6e with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6e with good adherence\n Clients given 6e with good adherence\n \n 2023-08-17 15:21:28 UTC\n \n 2023-08-17 15:23:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2511\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:21:28',4,'2023-08-17 17:23:08',4,0,NULL,NULL,NULL,'ca215c1b-6a15-42a3-b752-9ce21c651e13'),(2512,'Clients given 6f with poor adherence','Clients given 6f with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6f with poor adherence\n Clients given 6f with poor adherence\n \n 2023-08-17 15:22:56 UTC\n \n 2023-08-17 15:24:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2512\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:22:56',4,'2023-08-17 17:24:10',4,0,NULL,NULL,NULL,'ba0a85d0-9c18-49b9-8c42-417c8d96221c'),(2513,'Clients given 6f with fair adherence','Clients given 6f with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6f with fair adherence\n Clients given 6f with fair adherence\n \n 2023-08-17 15:23:41 UTC\n \n 2023-08-17 15:25:35 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2513\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:23:41',4,'2023-08-17 17:25:35',4,0,NULL,NULL,NULL,'7abe4ec4-ba33-4f66-97c3-33ffd356c478'),(2514,'Clients given 6f with good adherence','Clients given 6f with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6f with good adherence\n Clients given 6f with good adherence\n \n 2023-08-17 15:25:08 UTC\n \n 2023-08-17 15:27:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2514\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:25:08',4,'2023-08-17 17:27:07',4,0,NULL,NULL,NULL,'605e06e0-b274-46a5-8404-e45f6bdbf36d'),(2515,'Clients given 6B with <20 Copies Viral Load','Clients given 6B with <20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6B with <20 Copies Viral Load\n Clients given 6B with <20 Copies Viral Load\n \n 2023-08-17 16:05:27 UTC\n \n 2023-08-17 16:06:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2515\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 18:05:27',4,'2023-08-17 18:06:26',4,0,NULL,NULL,NULL,'57a592d4-f5a1-4ac8-afd9-dbabd8335120'),(2516,'Clients given 6B with Undetectable Viral Load','Clients given 6B with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6B with Undetectable Viral Load\n Clients given 6B with Undetectable Viral Load\n \n 2023-08-17 16:07:16 UTC\n \n 2023-08-17 17:13:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2516\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 18:07:16',4,'2023-08-17 19:13:12',4,0,NULL,NULL,NULL,'9a6c692c-675e-490a-827d-788308c41aa2'),(2517,'Clients given 6C with >=20 Copies Viral Load','Clients given 6C with >=20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C with >=20 Copies Viral Load\n Clients given 6C with >=20 Copies Viral Load\n \n 2023-08-17 16:09:20 UTC\n \n 2023-08-17 16:10:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2517\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 18:09:20',4,'2023-08-17 18:10:11',4,0,NULL,NULL,NULL,'2b0f18d1-d6bc-48db-81e9-139e7127a014'),(2518,'Clients given 6C with <20 Copies Viral Load','Clients given 6C with <20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C with <20 Copies Viral Load\n Clients given 6C with <20 Copies Viral Load\n \n 2023-08-17 16:11:36 UTC\n \n 2023-08-17 16:12:54 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2518\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 18:11:36',4,'2023-08-17 18:12:54',4,0,NULL,NULL,NULL,'b95e0670-059d-4690-986c-e7b162edc56a'),(2519,'Clients given 6C with Undetectable Viral Load','Clients given 6C with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C with Undetectable Viral Load\n Clients given 6C with Undetectable Viral Load\n \n 2023-08-17 16:13:36 UTC\n \n 2023-08-17 16:14:33 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2519\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 18:13:36',4,'2023-08-17 18:14:33',4,0,NULL,NULL,NULL,'ef772750-6723-46e8-b1cd-2c843e8dd384'),(2520,'Clients given 6D with >=20Copies Viral Load','Clients given 6D with >=20Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D with >=20Copies Viral Load\n Clients given 6D with >=20Copies Viral Load\n \n 2023-08-17 16:15:12 UTC\n \n 2023-08-17 16:16:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2520\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 18:15:12',4,'2023-08-17 18:16:15',4,0,NULL,NULL,NULL,'7067eaf1-d98c-4806-a595-c20526eb9695'),(2521,'Clients given 6D with <20 Copies Viral Load','Clients given 6D with <20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D with <20 Copies Viral Load\n Clients given 6D with <20 Copies Viral Load\n \n 2023-08-17 16:17:05 UTC\n \n 2023-08-17 16:18:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2521\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 18:17:05',4,'2023-08-17 18:18:05',4,0,NULL,NULL,NULL,'cc8e5238-6071-4a37-b946-f6e9bf94dd26'),(2522,'Clients given 6D with Undetectable Viral Load','Clients given 6D with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D with Undetectable Viral Load\n Clients given 6D with Undetectable Viral Load\n \n 2023-08-17 16:18:46 UTC\n \n 2023-08-17 16:19:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2522\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 18:18:46',4,'2023-08-17 18:19:45',4,0,NULL,NULL,NULL,'1df8beb0-cc67-496d-ba90-fa0dbc121691'),(2523,'Clients given 6E with >=20Copies Viral Load','Clients given 6E with >=20Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E with >=20Copies Viral Load\n Clients given 6E with >=20Copies Viral Load\n \n 2023-08-17 16:20:29 UTC\n \n 2023-08-17 16:21:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2523\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 18:20:29',4,'2023-08-17 18:21:30',4,0,NULL,NULL,NULL,'6462e250-cf41-469a-83d7-e8b085ae587d'),(2524,'Clients given 6E with <20 Copies Viral Load','Clients given 6E with <20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E with <20 Copies Viral Load\n Clients given 6E with <20 Copies Viral Load\n \n 2023-08-17 16:22:10 UTC\n \n 2023-08-17 16:24:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2524\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 18:22:10',4,'2023-08-17 18:24:14',4,0,NULL,NULL,NULL,'3492f4eb-af9b-448f-b4f1-fe314ce449f1'),(2525,'Children ARV Regimen_3rdLine_Adherence','Children ARV Regimen_3rdLine_Adherence','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_Adherence\n Children ARV Regimen_3rdLine_Adherence\n \n 2023-08-17 16:26:16 UTC\n \n 2023-08-17 16:26:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2525\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-17 18:26:16',4,'2023-08-17 18:26:28',4,0,NULL,NULL,NULL,'3262e4c0-f728-4cc8-ac30-b7413a14a644'),(2526,'Children ARV Regimen_3rdLine_Adherence Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_Adherence Data Set\n \n 2023-08-17 16:26:28 UTC\n \n 2023-08-17 16:38:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2526\n \n \n \n 6A_fair\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n \n \n 6A_good\n \n \n \n \n \n \n \n \n \n 6A_poor\n \n \n \n \n \n \n \n \n \n 6B_fair\n \n \n \n \n \n \n \n \n \n 6B_good\n \n \n \n \n \n \n \n \n \n 6B_poor\n \n \n \n \n \n \n \n \n \n 6C_fair\n \n \n \n \n \n \n \n \n \n 6C_good\n \n \n \n \n \n \n \n \n \n 6C_poor\n \n \n \n \n \n \n \n \n \n 6D_fair\n \n \n \n \n \n \n \n \n \n 6D_good\n \n \n \n \n \n \n \n \n \n 6D_poor\n \n \n \n \n \n \n \n \n \n 6E_fair\n \n \n \n \n \n \n \n \n \n 6E_good\n \n \n \n \n \n \n \n \n \n 6E_poor\n \n \n \n \n \n \n \n \n \n 6F_fair\n \n \n \n \n \n \n \n \n \n 6F_good\n \n \n \n \n \n \n \n \n \n 6F_poor\n \n \n \n \n \n \n \n \n \n','2023-08-17 18:26:28',4,'2023-08-17 18:38:11',4,0,NULL,NULL,NULL,'9011d1b7-91da-465d-a4c7-38ea98126d13'),(2527,'Children ARV Regimen_2ndLine_Adherence','Children ARV Regimen_2ndLine_Adherence','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_Adherence\n Children ARV Regimen_2ndLine_Adherence\n \n 2023-08-17 16:40:24 UTC\n \n 2023-08-17 16:40:35 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2527\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-17 18:40:24',4,'2023-08-17 18:40:35',4,0,NULL,NULL,NULL,'ab24cc2a-a3ac-43a7-91c6-65bc90b27ae4'),(2528,'Children ARV Regimen_2ndLine_Adherence Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_Adherence Data Set\n \n 2023-08-17 16:40:35 UTC\n \n 2023-08-17 16:59:47 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2528\n \n \n \n 5A_fair\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n \n \n 5A_good\n \n \n \n \n \n \n \n \n \n 5A_poor\n \n \n \n \n \n \n \n \n \n 5B_fair\n \n \n \n \n \n \n \n \n \n 5B_good\n \n \n \n \n \n \n \n \n \n 5B_poor\n \n \n \n \n \n \n \n \n \n 5C_fair\n \n \n \n \n \n \n \n \n \n 5C_good\n \n \n \n \n \n \n \n \n \n 5C_poor\n \n \n \n \n \n \n \n \n \n 5D_fair\n \n \n \n \n \n \n \n \n \n 5D_good\n \n \n \n \n \n \n \n \n \n 5D_poor\n \n \n \n \n \n \n \n \n \n 5E_fair\n \n \n \n \n \n \n \n \n \n 5E_good\n \n \n \n \n \n \n \n \n \n 5E_poor\n \n \n \n \n \n \n \n \n \n 5F_fair\n \n \n \n \n \n \n \n \n \n 5F_good\n \n \n \n \n \n \n \n \n \n 5F_poor\n \n \n \n \n \n \n \n \n \n 5G_fair\n \n \n \n \n \n \n \n \n \n 5G_good\n \n \n \n \n \n \n \n \n \n 5G_poor\n \n \n \n \n \n \n \n \n \n 5H_fair\n \n \n \n \n \n \n \n \n \n 5H_good\n \n \n \n \n \n \n \n \n \n 5H_poor\n \n \n \n \n \n \n \n \n \n','2023-08-17 18:40:35',4,'2023-08-17 18:59:47',4,0,NULL,NULL,NULL,'63956153-c9e8-480d-b057-96de951cf024'),(2529,'Clients given 6E with Undetectable Viral Load','Clients given 6E with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E with Undetectable Viral Load\n Clients given 6E with Undetectable Viral Load\n \n 2023-08-17 16:48:58 UTC\n \n 2023-08-17 16:50:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2529\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 18:48:58',4,'2023-08-17 18:50:03',4,0,NULL,NULL,NULL,'836381fd-7adf-42ba-8ab4-01e9259a41f5'),(2530,'Clients given 6F with >=20Copies Viral Load','Clients given 6F with >=20Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F with >=20Copies Viral Load\n Clients given 6F with >=20Copies Viral Load\n \n 2023-08-17 16:51:45 UTC\n \n 2023-08-17 16:53:52 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2530\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 18:51:45',4,'2023-08-17 18:53:52',4,0,NULL,NULL,NULL,'b8f0e53a-22a7-40e9-a9e6-e7ce266d4a19'),(2531,'Clients given 6F with <20 Copies Viral Load','Clients given 6F with <20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F with <20 Copies Viral Load\n Clients given 6F with <20 Copies Viral Load\n \n 2023-08-17 16:55:01 UTC\n \n 2023-08-17 16:58:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2531\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 18:55:01',4,'2023-08-17 18:58:01',4,0,NULL,NULL,NULL,'b820ee3d-d805-468d-b7b4-2d1c5ce10a92'),(2532,'Children ARV Regimen_3rdLine_Viral_Load','Children ARV Regimen_3rdLine_Viral_Load','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_Viral_Load\n Children ARV Regimen_3rdLine_Viral_Load\n \n 2023-08-17 16:58:13 UTC\n \n 2023-08-17 16:58:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2532\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-17 18:58:13',4,'2023-08-17 18:58:43',4,0,NULL,NULL,NULL,'72eeaaa5-8c87-4939-a657-99b15cc3ab35'),(2533,'Children ARV Regimen_3rdLine_Viral_Load Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_Viral_Load Data Set\n \n 2023-08-17 16:58:43 UTC\n \n 2023-08-17 17:29:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2533\n \n \n \n 6A<20\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n \n \n 6A>=20\n \n \n \n \n \n \n \n \n \n 6AUndetect\n \n \n \n \n \n \n \n \n \n 6B<20\n \n \n \n \n \n \n \n \n \n 6B>=20\n \n \n \n \n \n \n \n \n \n 6BUndetect\n \n \n \n \n \n \n \n \n \n 6C<20\n \n \n \n \n \n \n \n \n \n 6C>=20\n \n \n \n \n \n \n \n \n \n 6CUndetect\n \n \n \n \n \n \n \n \n \n 6D<20\n \n \n \n \n \n \n \n \n \n 6D>=20\n \n \n \n \n \n \n \n \n \n 6DUndetect\n \n \n \n \n \n \n \n \n \n 6E<20\n \n \n \n \n \n \n \n \n \n 6E>=20\n \n \n \n \n \n \n \n \n \n 6EUndetect\n \n \n \n \n \n \n \n \n \n 6F<20\n \n \n \n \n \n \n \n \n \n 6F>=20\n \n \n \n \n \n \n \n \n \n 6FUndetect\n \n \n \n \n \n \n \n \n \n','2023-08-17 18:58:43',4,'2023-08-17 19:29:02',4,0,NULL,NULL,NULL,'0a51f76b-0306-47fa-947d-55305024054a'),(2534,'Clients given 6F with Undetectable Viral Load','Clients given 6F with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F with Undetectable Viral Load\n Clients given 6F with Undetectable Viral Load\n \n 2023-08-17 16:59:07 UTC\n \n 2023-08-17 17:02:35 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2534\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 18:59:07',4,'2023-08-17 19:02:35',4,0,NULL,NULL,NULL,'b1f06b90-64db-4554-8e81-989e206ed34a'),(2535,'Children ARV Regimen_2ndLine_Viral_Load','Children ARV Regimen_2ndLine_Viral_Load','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_Viral_Load\n Children ARV Regimen_2ndLine_Viral_Load\n \n 2023-08-17 17:06:27 UTC\n \n 2023-08-17 17:06:48 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2535\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-17 19:06:27',4,'2023-08-17 19:06:48',4,0,NULL,NULL,NULL,'701df245-5766-4e37-9d54-89e6ecedb217'),(2536,'Children ARV Regimen_2ndLine_Viral_Load Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_Viral_Load Data Set\n \n 2023-08-17 17:06:48 UTC\n \n 2023-08-17 17:26:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2536\n \n \n \n 5A_Undetec\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n \n \n 5A<20\n \n \n \n \n \n \n \n \n \n 5A>=20\n \n \n \n \n \n \n \n \n \n 5B_Undetec\n \n \n \n \n \n \n \n \n \n 5B<20\n \n \n \n \n \n \n \n \n \n 5B>=20\n \n \n \n \n \n \n \n \n \n 5C_Undetec\n \n \n \n \n \n \n \n \n \n 5C<20\n \n \n \n \n \n \n \n \n \n 5C>=20\n \n \n \n \n \n \n \n \n \n 5E_Undetec\n \n \n \n \n \n \n \n \n \n 5E<20\n \n \n \n \n \n \n \n \n \n 5E>=20\n \n \n \n \n \n \n \n \n \n 5F_Undetec\n \n \n \n \n \n \n \n \n \n 5F<20\n \n \n \n \n \n \n \n \n \n 5F>=20\n \n \n \n \n \n \n \n \n \n 5G_Undetec\n \n \n \n \n \n \n \n \n \n 5G<20\n \n \n \n \n \n \n \n \n \n 5G>=20\n \n \n \n \n \n \n \n \n \n 5H_Undetec\n \n \n \n \n \n \n \n \n \n 5H<20\n \n \n \n \n \n \n \n \n \n 5H>=20\n \n \n \n \n \n \n \n \n \n','2023-08-17 19:06:48',4,'2023-08-17 19:26:20',4,0,NULL,NULL,NULL,'2790255e-587f-411d-9f8a-dbca36aa7e0d'),(2537,'ART clients with visits started','ART clients with visits started','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n ART clients with visits started\n ART clients with visits started\n \n 2023-09-21 12:40:58 UTC\n \n 2024-02-06 12:32:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2537\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1, 2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id and vt.visit_type_id in (10,19) \n JOIN obs o on o.encounter_id=en.encounter_id \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 18:10:58',4,'2024-02-06 18:02:59',4,0,NULL,NULL,NULL,'5de36ef7-faa8-422d-943d-fdd6ad3497a0'),(2538,'ART clients with visits consulted','ART clients with visits consulted','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n ART clients with visits consulted\n ART clients with visits consulted\n \n 2023-09-21 12:41:53 UTC\n \n 2024-02-06 12:38:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2538\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id and vt.visit_type_id in (10,19) \n JOIN obs o on o.encounter_id=en.encounter_id \n and o.concept_id in (3843, 4276) and o.voided =0 \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 18:11:53',4,'2024-02-06 18:08:12',4,0,NULL,NULL,NULL,'9340a449-ab16-4a98-8dcb-240635a9042d'),(2539,'Clients initiated on ART this month','Clients initiated on ART this month','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients initiated on ART this month\n Clients initiated on ART this month\n \n 2023-09-21 12:42:21 UTC\n \n 2024-02-06 10:21:22 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2539\n select distinct patient.patient_id AS Id \n \n from obs o \n -- CLIENTS NEWLY INITIATED ON ART \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND (o.concept_id = 2249 \n \n AND CAST(o.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n AND patient.voided = 0 AND o.voided = 0 \n AND o.person_id not in ( \n select distinct os.person_id from obs os \n where os.concept_id = 3634 \n AND os.value_coded = 2095 \n and os.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and o.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages'\n','2023-09-21 18:12:21',4,'2024-02-06 15:51:22',4,0,NULL,NULL,NULL,'d3e386aa-99a9-4463-9e81-f663ca35cad2'),(2540,'TB clients with visits started','TB clients with visits started','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB clients with visits started\n TB clients with visits started\n \n 2023-09-21 12:42:50 UTC\n \n 2023-09-21 12:43:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2540\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id \n JOIN obs o on o.encounter_id=en.encounter_id \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n and v.visit_type_id = 13 \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 14:42:50',4,'2023-09-21 14:43:05',4,0,NULL,NULL,NULL,'e6d2d518-2160-4fc8-84dc-a680c609b27f'),(2541,'TB clients with visits consulted','TB clients with visits consulted','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB clients with visits consulted\n TB clients with visits consulted\n \n 2023-09-21 12:44:18 UTC\n \n 2023-09-21 12:45:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2541\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id \n JOIN obs o on o.encounter_id=en.encounter_id \n and o.concept_id in (4153,1158) and o.voided =0 \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n and v.visit_type_id = 13 \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 14:44:18',4,'2023-09-21 14:45:05',4,0,NULL,NULL,NULL,'d205535e-f890-488a-a256-a69835a9a9d8'),(2542,'HTS Clients Seen','HTS Clients Seen','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HTS Clients Seen\n HTS Clients Seen\n \n 2023-09-21 12:45:02 UTC\n \n 2023-09-21 12:45:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2542\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in( \nSELECT Id \nFROM ( \n select distinct o.person_id as Id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n where o.concept_id = 4845 and o.value_coded = 4847 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n ) as A \n)\n','2023-09-21 14:45:02',4,'2023-09-21 14:45:39',4,0,NULL,NULL,NULL,'ce0fbba8-f81e-4f15-9da5-b341fd68b611'),(2543,'HTS clients with visits started','HTS clients with visits started','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HTS clients with visits started\n HTS clients with visits started\n \n 2023-09-21 12:45:52 UTC\n \n 2023-09-21 12:46:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2543\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id \n JOIN obs o on o.encounter_id=en.encounter_id \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n and v.visit_type_id = 15 \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 14:45:52',4,'2023-09-21 14:46:05',4,0,NULL,NULL,NULL,'fe7fb845-5325-4d00-8cab-7041e6759f04'),(2544,'1st Postnatal (PNC) Attendance','1st Postnatal (PNC) Attendance','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n 1st Postnatal (PNC) Attendance\n 1st Postnatal (PNC) Attendance\n \n 2023-09-21 12:46:47 UTC\n \n 2023-09-21 12:47:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2544\n select \n o.person_id \nfrom obs o \ninner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as examination_timing \n from obs oss \n where oss.concept_id = 4393 and oss.voided=0 \n and cast(oss.obs_datetime as date) >= cast(:startDate as date) \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where concept_id = 4393 \n and o.obs_datetime = max_observation\n','2023-09-21 14:46:47',4,'2023-09-21 14:47:10',4,0,NULL,NULL,NULL,'290d3497-9608-4796-9826-1dc624696dbd'),(2545,'HTS clients with visits consulted','HTS clients with visits consulted','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HTS clients with visits consulted\n HTS clients with visits consulted\n \n 2023-09-21 12:47:27 UTC\n \n 2023-09-21 12:47:54 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2545\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id \n JOIN obs o on o.encounter_id=en.encounter_id \n and o.concept_id = 4238 and o.voided =0 \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n and v.visit_type_id = 15 \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 14:47:27',4,'2023-09-21 14:47:54',4,0,NULL,NULL,NULL,'35051ec1-423c-4ede-a68f-88e94f2dc6a2'),(2546,'Self test Kits distributed','Self test Kits distributed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Self test Kits distributed\n Self test Kits distributed\n \n 2023-09-21 12:48:21 UTC\n \n 2023-09-21 12:48:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2546\n (select patient.patient_id AS Id \n from obs o \n -- HTS SELF TEST STRATEGY \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n AND o.concept_id = 4833 and o.value_coded = 4834 \n AND patient.voided = 0 AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n ) \n \nUNION ALL \n(select patient.patient_id AS Id \n from obs o \n -- HTS SELF TEST STRATEGY \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n AND o.concept_id = 4836 and o.value_coded in (4837, 4838, 4839) \n AND patient.voided = 0 AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n )\n','2023-09-21 14:48:21',4,'2023-09-21 14:48:36',4,0,NULL,NULL,NULL,'4ef31fd0-53cc-4296-adc1-1b74455e2a5f'),(2547,'ANC clients with visits started','ANC clients with visits started','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n ANC clients with visits started\n ANC clients with visits started\n \n 2023-09-21 12:49:04 UTC\n \n 2023-09-21 12:49:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2547\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id \n JOIN obs o on o.encounter_id=en.encounter_id \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n and v.visit_type_id = 16 \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 14:49:04',4,'2023-09-21 14:49:44',4,0,NULL,NULL,NULL,'928922c7-633f-4cb0-9149-88ae7e50e237'),(2548,'Under5 Clients Seen','Under5 Clients Seen','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Under5 Clients Seen\n Under5 Clients Seen\n \n 2023-09-21 12:49:57 UTC\n \n 2023-09-21 12:50:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2548\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in( \nSELECT Id \nFROM ( \n select distinct o.person_id as Id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n where o.concept_id = 4285 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n ) as A \n)\n','2023-09-21 14:49:57',4,'2023-09-21 14:50:12',4,0,NULL,NULL,NULL,'93a89f3f-f556-4592-b12e-cf8849d58b58'),(2549,'ANC clients with visits consulted','ANC clients with visits consulted','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n ANC clients with visits consulted\n ANC clients with visits consulted\n \n 2023-09-21 12:50:25 UTC\n \n 2023-09-21 12:51:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2549\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id \n JOIN obs o on o.encounter_id=en.encounter_id \n and o.concept_id = 4663 and o.voided =0 \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n and v.visit_type_id = 16 \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 14:50:25',4,'2023-09-21 14:51:08',4,0,NULL,NULL,NULL,'ab0560b8-8a8b-4759-983b-d3b0d69afafa'),(2550,'HEI Clients Seen','HEI Clients Seen','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HEI Clients Seen\n HEI Clients Seen\n \n 2023-09-21 12:51:29 UTC\n \n 2024-02-06 12:40:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2550\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in( \nSELECT Id \nFROM ( \n select distinct o.person_id as Id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n where o.concept_id in (4189,4558) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n ) as A \n)\n','2023-09-21 18:21:29',4,'2024-02-06 18:10:40',4,0,NULL,NULL,NULL,'f8e02920-02de-4c2b-9b44-6974b937b51c'),(2551,'PNC clients with visits started','PNC clients with visits started','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PNC clients with visits started\n PNC clients with visits started\n \n 2023-09-21 12:51:49 UTC\n \n 2023-09-21 12:52:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2551\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id \n JOIN obs o on o.encounter_id=en.encounter_id \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n and v.visit_type_id = 17 \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 14:51:49',4,'2023-09-21 14:52:21',4,0,NULL,NULL,NULL,'dddf7e03-38fe-419f-81a4-625dabb0fd4e'),(2552,'Family Planning Clients seen','Family Planning Clients seen','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Family Planning Clients seen\n Family Planning Clients seen\n \n 2023-09-21 12:52:28 UTC\n \n 2023-09-21 12:52:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2552\n select \n o.person_id \nfrom obs o \ninner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as examination_timing \n from obs oss \n where oss.concept_id = 4557 and oss.voided=0 \n and cast(oss.obs_datetime as date) >= cast(:startDate as date) \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where concept_id = 4557 \n and o.obs_datetime = max_observation\n','2023-09-21 14:52:28',4,'2023-09-21 14:52:43',4,0,NULL,NULL,NULL,'287d14af-8d53-48d0-8cf4-47f141b0e9ea'),(2553,'PNC clients with visits consulted','PNC clients with visits consulted','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PNC clients with visits consulted\n PNC clients with visits consulted\n \n 2023-09-21 12:52:50 UTC\n \n 2023-09-21 12:53:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2553\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id \n JOIN obs o on o.encounter_id=en.encounter_id \n and o.concept_id = 4386 and o.voided =0 \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n and v.visit_type_id = 17 \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 14:52:50',4,'2023-09-21 14:53:03',4,0,NULL,NULL,NULL,'bf6795b4-6d7f-49bd-aff7-53781f102898'),(2554,'Cervical Cancer Screening clients seen','Cervical Cancer Screening clients seen','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Cervical Cancer Screening clients seen\n Cervical Cancer Screening clients seen\n \n 2023-09-21 12:53:29 UTC\n \n 2023-10-17 13:11:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2554\n select \n o.person_id \nfrom obs o \ninner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as examination_timing \n from obs oss \n where oss.concept_id = 4511 and oss.voided=0 \n and cast(oss.obs_datetime as date) >= cast(:startDate as date) \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where concept_id = 4511 \n and o.obs_datetime = max_observation\n','2023-09-21 18:23:29',4,'2023-10-17 18:41:36',4,0,NULL,NULL,NULL,'f436cc71-62c7-413d-81b3-0f6bbad88a73'),(2555,'HEI clients with visits started','HEI clients with visits started','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HEI clients with visits started\n HEI clients with visits started\n \n 2023-09-21 12:54:17 UTC\n \n 2023-09-21 12:54:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2555\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id \n JOIN obs o on o.encounter_id=en.encounter_id \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n and v.visit_type_id = 18 \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 14:54:17',4,'2023-09-21 14:54:29',4,0,NULL,NULL,NULL,'e26ba5ce-54c6-4693-8f0c-52aae22ce97b'),(2556,'ANC Clients Seen','ANC Clients Seen','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n ANC Clients Seen\n ANC Clients Seen\n \n 2023-09-21 12:54:42 UTC\n \n 2023-09-21 12:54:57 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2556\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in( \nSELECT Id \nFROM ( \n select distinct o.person_id as Id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n where o.concept_id = 4663 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n ) as A \n)\n','2023-09-21 14:54:42',4,'2023-09-21 14:54:57',4,0,NULL,NULL,NULL,'f58dd29e-bfcf-411a-a5fa-789722177fd1'),(2557,'HEI clients with visits consulted','HEI clients with visits consulted','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HEI clients with visits consulted\n HEI clients with visits consulted\n \n 2023-09-21 12:55:13 UTC\n \n 2023-09-21 12:56:33 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2557\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id \n JOIN obs o on o.encounter_id=en.encounter_id \n and o.concept_id in (4558, 4186) and o.voided =0 \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n and v.visit_type_id = 18 \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 14:55:13',4,'2023-09-21 14:56:33',4,0,NULL,NULL,NULL,'2bcc29bb-b22f-4866-8035-f7f1db1ead87'),(2558,'ANC Clients Seen','ANC Clients Seen','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n ANC Clients Seen\n ANC Clients Seen\n \n 2023-09-21 12:55:47 UTC\n \n 2023-09-21 12:56:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2558\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 14:55:47',4,'2023-09-21 14:56:41',4,0,NULL,NULL,NULL,'7006c9eb-caa2-4617-9151-d6872b35e3a1'),(2559,'Cervical Cancer Screening clients seen','Cervical Cancer Screening clients seen','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Cervical Cancer Screening clients seen\n Cervical Cancer Screening clients seen\n \n 2023-09-21 12:57:08 UTC\n \n 2023-09-21 12:57:52 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2559\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 14:57:08',4,'2023-09-21 14:57:52',4,0,NULL,NULL,NULL,'697c637f-d0ae-45a2-9eab-f4f9012c2412'),(2560,'Family Planning clients with visits started','Family Planning clients with visits started','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Family Planning clients with visits started\n Family Planning clients with visits started\n \n 2023-09-21 12:57:35 UTC\n \n 2023-09-21 12:57:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2560\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id \n JOIN obs o on o.encounter_id=en.encounter_id \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n and v.visit_type_id = 22 \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 14:57:35',4,'2023-09-21 14:57:59',4,0,NULL,NULL,NULL,'a713664a-9547-4de1-bcea-eab77e351ec5'),(2561,'Family Planning Clients seen','Family Planning Clients seen','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Family Planning Clients seen\n Family Planning Clients seen\n \n 2023-09-21 12:58:35 UTC\n \n 2023-09-21 12:59:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2561\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 14:58:35',4,'2023-09-21 14:59:30',4,0,NULL,NULL,NULL,'4934d5cb-a141-4144-9937-59b8bb142789'),(2562,'Family Planning clients with visits consulted','Family Planning clients with visits consulted','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Family Planning clients with visits consulted\n Family Planning clients with visits consulted\n \n 2023-09-21 12:58:46 UTC\n \n 2023-09-21 12:59:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2562\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id \n JOIN obs o on o.encounter_id=en.encounter_id \n and o.concept_id = 4557 and o.voided =0 \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n and v.visit_type_id = 22 \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 14:58:46',4,'2023-09-21 14:59:18',4,0,NULL,NULL,NULL,'ada60155-c22d-4ad4-b960-45bb814acd47'),(2563,'HEI Clients Seen','HEI Clients Seen','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HEI Clients Seen\n HEI Clients Seen\n \n 2023-09-21 12:59:50 UTC\n \n 2023-09-21 13:00:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2563\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 14:59:50',4,'2023-09-21 15:00:32',4,0,NULL,NULL,NULL,'8f5713d9-1797-48ed-92ba-7a6bbc3f02be'),(2564,'Under 5 clients with visits started','Under 5 clients with visits started','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Under 5 clients with visits started\n Under 5 clients with visits started\n \n 2023-09-21 12:59:58 UTC\n \n 2023-09-21 13:00:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2564\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id \n JOIN obs o on o.encounter_id=en.encounter_id \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n and v.visit_type_id = 20 \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 14:59:58',4,'2023-09-21 15:00:12',4,0,NULL,NULL,NULL,'b569e5c1-aab8-4a67-955c-b09d0c5c1b6b'),(2565,'Under 5 clients with visits consulted','Under 5 clients with visits consulted','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Under 5 clients with visits consulted\n Under 5 clients with visits consulted\n \n 2023-09-21 13:00:57 UTC\n \n 2023-09-21 13:01:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2565\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id \n JOIN obs o on o.encounter_id=en.encounter_id \n and o.concept_id = 4285 and o.voided =0 \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n and v.visit_type_id = 20 \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 15:00:57',4,'2023-09-21 15:01:12',4,0,NULL,NULL,NULL,'ae2b5eee-422b-4307-a985-7bd763147582'),(2566,'HTS Clients Seen','HTS Clients Seen','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HTS Clients Seen\n HTS Clients Seen\n \n 2023-09-21 13:00:59 UTC\n \n 2023-09-21 13:01:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2566\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:00:59',4,'2023-09-21 15:01:59',4,0,NULL,NULL,NULL,'198319c7-6986-4599-8b2a-886ed81d7c37'),(2567,'1st Postnatal (PNC) Attendance','1st Postnatal (PNC) Attendance','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n 1st Postnatal (PNC) Attendance\n 1st Postnatal (PNC) Attendance\n \n 2023-09-21 13:01:44 UTC\n \n 2023-09-21 13:02:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2567\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:01:44',4,'2023-09-21 15:02:26',4,0,NULL,NULL,NULL,'07589d1a-d289-491c-a8dd-ac6e506b6eca'),(2568,'Cervical Cancer Screening clients with visits started','Cervical Cancer Screening clients with visits started','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Cervical Cancer Screening clients with visits started\n Cervical Cancer Screening clients with visits started\n \n 2023-09-21 13:02:00 UTC\n \n 2023-09-21 13:02:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2568\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id \n JOIN obs o on o.encounter_id=en.encounter_id \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n and v.visit_type_id = 21 \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 15:02:00',4,'2023-09-21 15:02:14',4,0,NULL,NULL,NULL,'4f7cc18d-1104-4427-b582-f73b99bd0837'),(2569,'Self test Kits distributed','Self test Kits distributed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Self test Kits distributed\n Self test Kits distributed\n \n 2023-09-21 13:02:50 UTC\n \n 2023-09-21 13:04:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2569\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:02:50',4,'2023-09-21 15:04:03',4,0,NULL,NULL,NULL,'5cc879f5-78be-4f74-9cd0-06ae596deffe'),(2570,'Cervical Cancer Screening clients with visits consulted','Cervical Cancer Screening clients with visits consulted','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Cervical Cancer Screening clients with visits consulted\n Cervical Cancer Screening clients with visits consulted\n \n 2023-09-21 13:02:56 UTC\n \n 2023-09-21 13:03:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2570\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id \n JOIN obs o on o.encounter_id=en.encounter_id \n and o.concept_id = 4511 and o.voided =0 \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n and v.visit_type_id = 21 \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 15:02:56',4,'2023-09-21 15:03:08',4,0,NULL,NULL,NULL,'cf21c6a3-0a19-44c7-b2c7-e14246d7bc96'),(2571,'Under5 Clients Seen','Under5 Clients Seen','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Under5 Clients Seen\n Under5 Clients Seen\n \n 2023-09-21 13:03:36 UTC\n \n 2023-09-21 13:05:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2571\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:03:36',4,'2023-09-21 15:05:20',4,0,NULL,NULL,NULL,'d8654256-acae-40b0-a3c2-feafeb2f36ad'),(2572,'eRegister Monitoring Report','eRegister Monitoring Report','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n eRegister Monitoring Report\n eRegister Monitoring Report\n \n 2023-09-21 13:06:13 UTC\n \n 2023-09-21 13:26:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2572\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-09-21 15:06:13',4,'2023-09-21 15:26:06',4,0,NULL,NULL,NULL,'a9290709-3dd9-4bfe-823d-b1702d10ec0f'),(2573,'eRegister Monitoring Report Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n eRegister Monitoring Report Data Set\n \n 2023-09-21 13:06:21 UTC\n \n 2023-09-22 08:47:46 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2573\n \n \n \n ANC_Consul\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n \n \n ANC_Seen\n \n \n \n \n \n \n \n \n \n ANC_Visits\n \n \n \n \n \n \n \n \n \n ART_Consul\n \n \n \n \n \n \n \n \n \n ART_Visits\n \n \n \n \n \n \n \n \n \n Cerv_Consu\n \n \n \n \n \n \n \n \n \n Cerv_Scree\n \n \n \n \n \n \n \n \n \n Cerv_Visit\n \n \n \n \n \n \n \n \n \n ClntsOnArt\n \n \n \n \n \n \n \n \n \n FP_Consult\n \n \n \n \n \n \n \n \n \n FP_Seen\n \n \n \n \n \n \n \n \n \n FP_Visits\n \n \n \n \n \n \n \n \n \n HEI_Consul\n \n \n \n \n \n \n \n \n \n HEI_Seen\n \n \n \n \n \n \n \n \n \n HEI_Visits\n \n \n \n \n \n \n \n \n \n HTS_Consul\n \n \n \n \n \n \n \n \n \n HTS_Seen\n \n \n \n \n \n \n \n \n \n HTS_Visits\n \n \n \n \n \n \n \n \n \n LTest_Rev\n \n \n \n \n \n \n \n \n \n LTest_Sent\n \n \n \n \n \n \n \n \n \n PNC_Attend\n \n \n \n \n \n \n \n \n \n PNC_Consul\n \n \n \n \n \n \n \n \n \n PNC_Visits\n \n \n \n \n \n \n \n \n \n Self_tes_D\n \n \n \n \n \n \n \n \n \n TB_Consult\n \n \n \n \n \n \n \n \n \n TB_Visits\n \n \n \n \n \n \n \n \n \n Tx_New\n \n \n \n \n \n \n \n \n \n Under5_Con\n \n \n \n \n \n \n \n \n \n Under5_See\n \n \n \n \n \n \n \n \n \n Under5_Vis\n \n \n \n \n \n \n \n \n \n','2023-09-21 13:06:21',4,'2023-09-22 08:47:46',4,0,NULL,NULL,NULL,'a971d8e2-a66a-487c-aae4-36c6f14a3328'),(2574,' ANC clients with visits started',' ANC clients with visits started','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n ANC clients with visits started\n ANC clients with visits started\n \n 2023-09-21 13:07:00 UTC\n \n 2023-09-21 13:07:46 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2574\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:07:00',4,'2023-09-21 15:07:46',4,0,NULL,NULL,NULL,'69485106-52a5-452e-91ef-6ecf80894a7f'),(2575,'ART clients with visits consulted','ART clients with visits consulted','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n ART clients with visits consulted\n ART clients with visits consulted\n \n 2023-09-21 13:08:16 UTC\n \n 2023-09-21 13:08:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2575\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:08:16',4,'2023-09-21 15:08:50',4,0,NULL,NULL,NULL,'7cce44cb-0809-4493-84bb-2fdbe745ceab'),(2576,'ART clients with visits started','ART clients with visits started','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n ART clients with visits started\n ART clients with visits started\n \n 2023-09-21 13:09:47 UTC\n \n 2023-09-21 13:11:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2576\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:09:47',4,'2023-09-21 15:11:10',4,0,NULL,NULL,NULL,'a5551436-00f8-45c4-aa3b-6aaae3160f55'),(2577,'Clients initiated on ART this month','Clients initiated on ART this month','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients initiated on ART this month\n Clients initiated on ART this month\n \n 2023-09-21 13:11:24 UTC\n \n 2023-09-21 13:12:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2577\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:11:24',4,'2023-09-21 15:12:20',4,0,NULL,NULL,NULL,'e6b92d7a-5f7e-4001-957e-30b6be452168'),(2578,'ANC clients with visits consulted','ANC clients with visits consulted','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n ANC clients with visits consulted\n ANC clients with visits consulted\n \n 2023-09-21 13:11:45 UTC\n \n 2023-09-21 13:12:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2578\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:11:45',4,'2023-09-21 15:12:58',4,0,NULL,NULL,NULL,'5c7fcfb9-3d39-4225-a4f3-8ed358e16626'),(2579,'TB clients with visits started','TB clients with visits started','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB clients with visits started\n TB clients with visits started\n \n 2023-09-21 13:13:10 UTC\n \n 2023-09-21 13:13:56 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2579\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:13:10',4,'2023-09-21 15:13:56',4,0,NULL,NULL,NULL,'09767de3-79b3-43e2-82da-339278f5e10d'),(2580,'TB clients with visits consulted','TB clients with visits consulted','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB clients with visits consulted\n TB clients with visits consulted\n \n 2023-09-21 13:14:13 UTC\n \n 2023-09-21 13:16:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2580\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:14:13',4,'2023-09-21 15:16:03',4,0,NULL,NULL,NULL,'d4ae74d3-d618-4e3b-8d10-4c54e5f3b75a'),(2581,'HTS clients with visits started','HTS clients with visits started','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HTS clients with visits started\n HTS clients with visits started\n \n 2023-09-21 13:16:45 UTC\n \n 2023-09-21 13:17:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2581\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:16:45',4,'2023-09-21 15:17:18',4,0,NULL,NULL,NULL,'91f470f1-71bf-4a21-bd12-efe0fe142c0a'),(2582,'HTS clients with visits consulted','HTS clients with visits consulted','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HTS clients with visits consulted\n HTS clients with visits consulted\n \n 2023-09-21 13:17:44 UTC\n \n 2023-09-21 13:18:19 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2582\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:17:44',4,'2023-09-21 15:18:19',4,0,NULL,NULL,NULL,'2bd858aa-2daf-4fd2-9028-9d6fba579a89'),(2583,'PNC clients with visits started','PNC clients with visits started','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PNC clients with visits started\n PNC clients with visits started\n \n 2023-09-21 13:18:49 UTC\n \n 2023-09-21 13:19:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2583\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:18:49',4,'2023-09-21 15:19:20',4,0,NULL,NULL,NULL,'80003d94-268b-4726-ba0d-0fa830e90463'),(2584,'PNC clients with visits consulted','PNC clients with visits consulted','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PNC clients with visits consulted\n PNC clients with visits consulted\n \n 2023-09-21 13:19:39 UTC\n \n 2023-09-21 13:20:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2584\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:19:39',4,'2023-09-21 15:20:18',4,0,NULL,NULL,NULL,'e64fd32d-8284-4fb5-a227-8f338859ceaa'),(2586,'HEI clients with visits started','HEI clients with visits started','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HEI clients with visits started\n HEI clients with visits started\n \n 2023-09-21 13:23:38 UTC\n \n 2023-09-21 13:24:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2586\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:23:38',4,'2023-09-21 15:24:10',4,0,NULL,NULL,NULL,'e7e581aa-9b90-4f56-b8a1-9bfc607f8b4f'),(2587,'HEI clients with visits consulted','HEI clients with visits consulted','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HEI clients with visits consulted\n HEI clients with visits consulted\n \n 2023-09-21 13:24:38 UTC\n \n 2023-09-21 13:25:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2587\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:24:38',4,'2023-09-21 15:25:05',4,0,NULL,NULL,NULL,'dd05778e-c5bd-4430-90fa-fd97b36402d2'),(2588,'Family Planning clients with visits started','Family Planning clients with visits started','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Family Planning clients with visits started\n Family Planning clients with visits started\n \n 2023-09-21 13:25:31 UTC\n \n 2023-09-21 13:26:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2588\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:25:31',4,'2023-09-21 15:26:32',4,0,NULL,NULL,NULL,'3278fb6f-2276-4390-a5c2-9863d056f3a0'),(2589,'Family Planning clients with visits consulted','Family Planning clients with visits consulted','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Family Planning clients with visits consulted\n Family Planning clients with visits consulted\n \n 2023-09-21 13:26:58 UTC\n \n 2023-09-21 13:27:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2589\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:26:58',4,'2023-09-21 15:27:32',4,0,NULL,NULL,NULL,'822f0677-6a2b-47cf-9265-0841d65e9716'),(2590,'Under 5 clients with visits consulted','Under 5 clients with visits consulted','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Under 5 clients with visits consulted\n Under 5 clients with visits consulted\n \n 2023-09-21 13:28:28 UTC\n \n 2023-09-21 13:31:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2590\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:28:28',4,'2023-09-21 15:31:36',4,0,NULL,NULL,NULL,'3a2857b0-1d9c-4f7d-95e9-abcba540935d'),(2591,'Under 5 clients with visits started','Under 5 clients with visits started','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Under 5 clients with visits started\n Under 5 clients with visits started\n \n 2023-09-21 13:30:05 UTC\n \n 2023-09-21 13:30:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2591\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:30:05',4,'2023-09-21 15:30:36',4,0,NULL,NULL,NULL,'f62e6fdd-a64b-4619-925c-d86fc3987060'),(2592,'Clients current on ART','Clients current on ART','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients current on ART\n Clients current on ART\n \n 2023-09-21 13:31:58 UTC\n \n 2023-09-21 13:35:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2592\n (SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n person.gender AS Gender, \n observed_age_group.name AS age_group, \n observed_age_group.sort_order AS sort_order \n \n from obs o \n -- CLIENTS NEWLY INITIATED ON ART \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND (o.concept_id = 2249 \n \n AND MONTH(o.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(o.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n ) \n AND patient.voided = 0 AND o.voided = 0 \n AND o.person_id not in ( \n select distinct os.person_id from obs os \n where os.concept_id = 3634 \n AND os.value_coded = 2095 \n and os.voided = 0 \n AND MONTH(os.obs_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.obs_datetime) = YEAR(CAST(:endDate AS DATE)) \n ) \n \n and o.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages') AS Newly_Initiated_ART_Clients \nORDER BY Newly_Initiated_ART_Clients.patientName) \n \nUNION \n \n(SELECT Id \nFROM ( \n \nselect distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n person.gender AS Gender, \n observed_age_group.name AS age_group, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- CLIENTS SEEN FOR ART \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND (o.concept_id = 3843 AND o.value_coded = 3841 OR o.value_coded = 3842) \n AND MONTH(o.obs_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(o.obs_datetime) = YEAR(CAST(:endDate AS DATE)) \n AND patient.voided = 0 AND o.voided = 0 \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n \n) AS Clients_Seen \n \nWHERE Clients_Seen.Id not in ( \n select distinct patient.patient_id AS Id \n from obs o \n -- CLIENTS INITIATED ON ART \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND (o.concept_id = 2249 \n AND MONTH(o.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(o.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n ) \n AND patient.voided = 0 AND o.voided = 0 \n AND o.person_id not in ( \n select distinct os.person_id from obs os \n where os.concept_id = 3634 \n AND os.value_coded = 2095 \n and os.voided = 0 \n AND MONTH(os.obs_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.obs_datetime) = YEAR(CAST(:endDate AS DATE)) \n ) \n \n ) \nAND Clients_Seen.Id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 and os.voided = 0 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 and os.voided = 0 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \nAND Clients_Seen.Id not in \n ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 and os.voided = 0 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) \n and o.person_id in ( \n -- Death \n select distinct p.person_id \n from person p \n where dead = 1 \n and death_date <= CAST(:endDate AS DATE) \n and voided = 0 \n ) \n ) \nAND Clients_Seen.Id not in ( \n -- Visitors \n select o.person_id \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as examination_timing \n from obs oss \n where oss.concept_id = 5416 and oss.value_coded =1 and oss.voided=0 \n and cast(oss.obs_datetime as date) >= cast(:startDate as date) \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where concept_id = 5416 \n and o.obs_datetime = max_observation \n ) \n \nORDER BY Clients_Seen.patientName) \n \nUNION \n \n \n-- INCLUDE MISSED APPOINTMENTS WITHIN 28 DAYS ACCORDING TO THE NEW PEPFAR GUIDELINE \n(SELECT Id \nFROM \n (select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n person.gender AS Gender, \n observed_age_group.name AS age_group, \n observed_age_group.sort_order AS sort_order \n \n from obs o \n -- CLIENTS WHO MISSED APPOINTMENTS < 28 DAYS \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n -- begin \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up < cast(:endDate as date) \n and DATEDIFF(CAST(:endDate AS DATE),latest_follow_up) <= 28 \n \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where (os.concept_id = 3843 AND os.value_coded = 3841 OR os.value_coded = 3842) \n AND MONTH(os.obs_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.obs_datetime) = YEAR(CAST(:endDate AS DATE)) \n and os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND MONTH(os.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n and os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n \n -- TOUTS \n select tout_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.obs_datetime AS latest_consultation \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(max(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 2403 \n and obs_datetime <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 2398 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as tout_clients \n where tout_clients.latest_consultation < cast(:endDate as date) \n \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n \n ) \n \n and active_clients.person_id not in( \n -- Visitors \n select o.person_id \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as examination_timing \n from obs oss \n where oss.concept_id = 5416 and oss.value_coded =1 and oss.voided=0 \n and cast(oss.obs_datetime as date) >= cast(:startDate as date) \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where concept_id = 5416 \n and o.obs_datetime = max_observation \n ) \n ) \n -- end \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages') AS TwentyEightDayDefaulters \n order by TwentyEightDayDefaulters.patientName) \n \n \nUNION \n \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n person.gender AS Gender, \n observed_age_group.name AS age_group, \n observed_age_group.sort_order AS sort_order \n \n from obs o \n \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n -- begin \n select active_clients.person_id-- , active_clients.latest_follow_up \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where (os.concept_id = 3843 AND os.value_coded = 3841 OR os.value_coded = 3842) \n AND MONTH(os.obs_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.obs_datetime) = YEAR(CAST(:endDate AS DATE)) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND MONTH(os.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 and os.voided = 0 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 and os.voided = 0 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select o.person_id \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as examination_timing \n from obs oss \n where oss.concept_id = 5416 and oss.value_coded =1 and oss.voided=0 \n and cast(oss.obs_datetime as date) >= cast(:startDate as date) \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where concept_id = 5416 \n and o.obs_datetime = max_observation \n ) \n ) \n -- end \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages') AS Seen_Previous_ART_Clients \nORDER BY Seen_Previous_ART_Clients.patientName) \n\n','2023-09-21 15:31:58',4,'2023-09-21 15:35:41',4,0,NULL,NULL,NULL,'ad403c3b-d759-44ab-8965-252ca6127ce7'),(2593,'Cervical Cancer Screening clients with visits started','Cervical Cancer Screening clients with visits started','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Cervical Cancer Screening clients with visits started\n Cervical Cancer Screening clients with visits started\n \n 2023-09-21 13:32:10 UTC\n \n 2023-09-21 13:32:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2593\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:32:10',4,'2023-09-21 15:32:43',4,0,NULL,NULL,NULL,'c7967fcd-a8b7-41d4-b540-364a60a59621'),(2594,'Cervical Cancer Screening clients with visits consulted','Cervical Cancer Screening clients with visits consulted','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Cervical Cancer Screening clients with visits consulted\n Cervical Cancer Screening clients with visits consulted\n \n 2023-09-21 13:33:06 UTC\n \n 2023-09-21 13:34:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2594\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:33:06',4,'2023-09-21 15:34:03',4,0,NULL,NULL,NULL,'b526566e-555d-40c6-88d4-0b89242b1dde'),(2595,'Clients current on ART','Clients current on ART','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients current on ART\n Clients current on ART\n \n 2023-09-21 13:36:28 UTC\n \n 2023-09-21 13:37:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2595\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:36:28',4,'2023-09-21 15:37:08',4,0,NULL,NULL,NULL,'1db1c64d-177f-4ecc-b1d7-c9fd2b029eff'),(2596,'Clients with LAB tests sent','Clients with LAB tests sent','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients with LAB tests sent\n Clients with LAB tests sent\n \n 2023-09-22 08:35:11 UTC\n \n 2023-09-22 08:35:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2596\n select distinct patient.patient_id AS Id \n from orders o \n INNER JOIN patient ON o.patient_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n AND o.concept_id = 5484 \n AND CAST(o.date_created AS DATE)>= CAST(:startDate AS DATE) \n AND CAST(o.date_created AS DATE) <= CAST(:endDate AS DATE) \n LEFT OUTER JOIN patient_identifier p ON p.patient_id = person.person_id AND p.identifier_type = 5\n','2023-09-22 08:35:11',4,'2023-09-22 08:35:51',4,0,NULL,NULL,NULL,'f06f1ccb-c048-44d3-8037-35f8660a6b95'),(2597,'Clients with LAB tests sent','Clients with LAB tests sent','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients with LAB tests sent\n Clients with LAB tests sent\n \n 2023-09-22 08:36:30 UTC\n \n 2023-09-22 08:38:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2597\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-22 08:36:30',4,'2023-09-22 08:38:26',4,0,NULL,NULL,NULL,'c29cff5d-5919-4b60-8ab7-c6d4c7ea01da'),(2598,'Clients with LAB tests received','Clients with LAB tests received','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients with LAB tests received\n Clients with LAB tests received\n \n 2023-09-22 08:39:02 UTC\n \n 2024-02-06 09:57:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2598\n Select pId \n From \n ( \n select oss.person_id as pId, concat(oss.value_numeric, " ", "copies/ml") as Results \n from obs oss \n where oss.concept_id = 5485 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) >= cast(:startDate as date) \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n \n UNION \n \n select oss.person_id as pId, "LDL" as Results \n from obs oss \n where oss.concept_id = 5489 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) >= cast(:startDate as date) \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n \n ) As received_results\n','2023-09-22 14:09:02',4,'2024-02-06 15:27:28',4,0,NULL,NULL,NULL,'6939902b-1909-4f24-b71d-da60ab1d131b'),(2599,'Clients with LAB tests received','Clients with LAB tests received','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients with LAB tests received\n Clients with LAB tests received\n \n 2023-09-22 08:39:53 UTC\n \n 2023-09-22 08:42:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2599\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-22 08:39:53',4,'2023-09-22 08:42:39',4,0,NULL,NULL,NULL,'e47a29f8-b851-480f-9812-e54da393fdb9'),(2600,'Contacts of TB Patients','Contacts of TB Patients','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Contacts of TB Patients\n Contacts of TB Patients\n \n 2024-02-27 09:43:12 UTC\n \n 2024-02-27 10:34:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2600\n select contact.person_id \n from \n (select B.person_id, B.obs_datetime \n from obs B \n inner join \n (select person_id, max(obs_datetime) as latest_consultation \n from obs where concept_id = 5926 \n and obs_datetime <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.latest_consultation = B.obs_datetime \n where concept_id = 5962 and value_coded = 2146 \n and A.latest_consultation = B.obs_datetime \n and voided = 0 \n group by B.person_id \n ) as contact\n','2024-02-27 15:13:12',4,'2024-02-27 16:04:55',4,0,NULL,NULL,NULL,'f74fefb2-b6d4-4c26-b214-fdb965aeb103'),(2601,'Contacts of TB Patients screened for TB','Contacts of TB Patients screened for TB','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Contacts of TB Patients screened for TB\n Contacts of TB Patients screened for TB\n \n 2024-02-27 10:35:41 UTC\n \n 2024-02-27 10:36:09 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2601\n select contact.person_id \n from \n (select B.person_id \n from obs B \n inner join \n (select person_id, max(obs_datetime) as latest_consultation \n from obs where concept_id = 5904 \n and obs_datetime <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.latest_consultation = B.obs_datetime \n where concept_id = 5962 and value_coded = 2146 \n and A.latest_consultation = B.obs_datetime \n and voided = 0 \n group by B.person_id \n ) as contact\n','2024-02-27 16:05:41',4,'2024-02-27 16:06:09',4,0,NULL,NULL,NULL,'6733708e-c472-4c84-89a2-13e0938a8360'),(2602,'Presumptive TB contacts with bacteriologic result(s)','Presumptive TB contacts with bacteriologic test result (s)','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Presumptive TB contacts with bacteriologic result(s)\n Presumptive TB contacts with bacteriologic test result (s)\n \n 2024-02-27 14:08:31 UTC\n \n 2024-02-27 14:16:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2602\n \n select distinct Id \n FROM \n ( \n -- Bacteriologically confirmed Genotypic test results and Phenotypic test results \n select distinct person_id as Id \n From obs o \n where o.concept_id in (3814, 3815) \n and cast(o.obs_datetime as date) >= CAST(:startDate AS DATE) \n and cast(o.obs_datetime as date) <= CAST(:endDate AS DATE) \n and o.voided = 0 \n \n -- MTB not Detected \n and o.person_id in \n ( \n select distinct o.person_id \n from obs o \n inner join \n ( \n select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as examination_timing \n from obs oss \n where oss.concept_id in (5954,5433,5955,5956,5959) \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.Id = o.person_id \n where o.concept_id in (3787,3805,3840,5957) \n and o.voided=0 \n and cast(o.obs_datetime as date) = cast(max_observation as date) \n \n ) \n \n ) As Pulmonary_Bacteriologic\n','2024-02-27 19:38:31',4,'2024-02-27 19:46:55',4,0,NULL,NULL,NULL,'5c82cebb-b76f-4acd-a416-752578f29546'),(2603,'Contacts of TB Patients who are positive to a bacteriologic test ','Contacts of TB Patients who are positive to a bacteriologic test ','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Contacts of TB Patients who are positive to a bacteriologic test \n Contacts of TB Patients who are positive to a bacteriologic test \n \n 2024-02-27 14:17:57 UTC\n \n 2024-02-27 17:56:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2603\n select distinct Id \n FROM \n ( \n -- Bacteriologically results \n select distinct person_id as Id \n From obs o \n where o.concept_id = 5953 \n and cast(o.obs_datetime as date) >= CAST(:startDate AS DATE) \n and cast(o.obs_datetime as date) <= CAST(:endDate AS DATE) \n and o.voided = 0 \n \n -- MTB Detected \n and o.person_id in \n ( \n select distinct o.person_id \n from obs o \n inner join \n ( \n select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as examination_timing \n from obs oss \n where oss.concept_id in (5954,5433,5955,5956,5959) \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.Id = o.person_id \n where o.concept_id in (3787,3805,3840,5957) \n and o.value_coded in (3816,3817,3718, 1738, 3828,3829,3830, 3831, 3832,3833,3834, 3835,3836, 3837,3838,3839) \n and o.voided=0 \n and cast(o.obs_datetime as date) = cast(max_observation as date) \n \n ) \n \n ) As Pulmonary_Bacteriologic\n','2024-02-27 19:47:57',4,'2024-02-27 23:26:03',4,0,NULL,NULL,NULL,'c632d1d1-ddd1-40ca-bdfd-8df133511db3'),(2604,'Contacts of TB Patients who are positive bacteriologic test & started TB treatment','Contacts of TB Patients who are positive to a bacteriologic test and started on TB treatment','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Contacts of TB Patients who are positive bacteriologic test & started TB treatment\n Contacts of TB Patients who are positive to a bacteriologic test and started on TB treatment\n \n 2024-02-27 18:19:38 UTC\n \n 2024-02-27 18:20:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2604\n select distinct Id \n FROM \n ( \n -- Bacteriologically results \n select distinct person_id as Id \n From obs o \n where o.concept_id = 5953 \n and cast(o.obs_datetime as date) >= CAST(:startDate AS DATE) \n and cast(o.obs_datetime as date) <= CAST(:endDate AS DATE) \n and o.voided = 0 \n \n -- MTB Detected \n and o.person_id in \n ( \n select distinct o.person_id \n from obs o \n inner join \n ( \n select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as examination_timing \n from obs oss \n where oss.concept_id in (5954,5433,5955,5956,5959) \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.Id = o.person_id \n where o.concept_id in (3787,3805,3840,5957) \n and o.value_coded in (3816,3817,3718, 1738, 3828,3829,3830, 3831, 3832,3833,3834, 3835,3836, 3837,3838,3839) \n and o.voided=0 \n and cast(o.obs_datetime as date) = cast(max_observation as date) \n \n ) \n \n ) As Pulmonary_Bacteriologic \n inner join ( \n select ob.person_id as pId \n FROM obs ob \n -- Pulmonary TB \n where ob.concept_id = 2237 \n AND cast(ob.value_datetime as date) >= CAST(:startDate AS DATE) \n and cast(ob.value_datetime as date) <= CAST(:endDate AS DATE) \n and ob.voided = 0 \n ) as Pulmonary \n on Pulmonary_Bacteriologic.Id = Pulmonary.pId\n','2024-02-27 23:49:38',4,'2024-02-27 23:50:06',4,0,NULL,NULL,NULL,'d2360af2-f13b-4b10-978f-5f230a0a83d7'),(2605,'Contacts of TB patients - Presumptive','Contacts of TB patients who have one or more signs and symptoms of TB (Presumptive)','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Contacts of TB patients - Presumptive\n Contacts of TB patients who have one or more signs and symptoms of TB (Presumptive)\n \n 2024-02-27 18:31:50 UTC\n \n 2024-02-27 18:32:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2605\n select ob.person_id as pId \n FROM obs ob \n where ob.concept_id = 5940 \n AND cast(ob.obs_datetime as date) >= CAST(:startDate AS DATE) \n and cast(ob.obs_datetime as date) <= CAST(:endDate AS DATE) \n and ob.voided = 0\n','2024-02-28 00:01:50',4,'2024-02-28 00:02:42',4,0,NULL,NULL,NULL,'17e19631-0322-48e3-8a42-352880f64b8f'),(2606,'Detection_Age','TB detection age groups','org.openmrs.module.reporting.indicator.dimension.Dimension','org.openmrs.module.reporting.indicator.dimension.CohortDefinitionDimension','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Detection_Age\n TB detection age groups\n \n 2024-02-27 18:42:36 UTC\n \n 2024-02-27 18:47:04 UTC\n \n \n endDate\n \n java.util.Date\n true\n \n \n 2606\n \n \n 15+years\n \n \n \n \n maxAge\n 120\n \n \n minAge\n 15\n \n \n effectiveDate\n ${endDate}\n \n \n \n \n \n 5-14yrs\n \n \n \n \n maxAge\n 14\n \n \n minAge\n 5\n \n \n effectiveDate\n ${endDate}\n \n \n \n \n \n <5yrs\n \n \n \n \n maxAge\n 4\n \n \n minAge\n 0\n \n \n effectiveDate\n ${endDate}\n \n \n \n \n \n','2024-02-28 00:12:36',4,'2024-02-28 00:17:04',4,0,NULL,NULL,NULL,'c12ee61b-5bc3-4476-866b-3a5a1ac37038'),(2607,'Contacts of TB Patients','Contacts of TB Patients','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Contacts of TB Patients\n Contacts of TB Patients\n \n 2024-02-27 18:52:39 UTC\n \n 2024-02-27 18:54:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2607\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 00:22:39',4,'2024-02-28 00:24:05',4,0,NULL,NULL,NULL,'ec97d270-a1a8-4d2c-ae71-b6ffcb555781'),(2610,'Contacts of TB Patients screened for TB','Contacts of TB Patients screened for TB','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Contacts of TB Patients screened for TB\n Contacts of TB Patients screened for TB\n \n 2024-02-27 19:00:00 UTC\n \n 2024-02-27 19:00:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2610\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 00:30:00',4,'2024-02-28 00:30:51',4,0,NULL,NULL,NULL,'1fefae20-e24c-4809-97a3-0bb2942ca618'),(2611,'Contacts of TB patients -Presumptive','Contacts of TB patients who have one or more signs and symptoms of TB (Presumptive)','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Contacts of TB patients -Presumptive\n Contacts of TB patients who have one or more signs and symptoms of TB (Presumptive)\n \n 2024-02-27 19:02:10 UTC\n \n 2024-02-27 19:03:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2611\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 00:32:10',4,'2024-02-28 00:33:04',4,0,NULL,NULL,NULL,'61a06072-21c6-492d-94c7-f59c8980ce28'),(2612,'Presumptive TB contacts with bacteriologic test result (s)','Presumptive TB contacts with bacteriologic test result (s)','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Presumptive TB contacts with bacteriologic test result (s)\n Presumptive TB contacts with bacteriologic test result (s)\n \n 2024-02-27 19:04:19 UTC\n \n 2024-02-27 19:10:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2612\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 00:34:19',4,'2024-02-28 00:40:31',4,0,NULL,NULL,NULL,'93c6d789-932b-4b13-903a-1c238427492c'),(2614,'Contacts of TB Patients who are positive to a bacteriologic test ','Contacts of TB Patients who are positive to a bacteriologic test ','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Contacts of TB Patients who are positive to a bacteriologic test \n Contacts of TB Patients who are positive to a bacteriologic test \n \n 2024-02-27 19:11:53 UTC\n \n 2024-02-27 19:12:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2614\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 00:41:53',4,'2024-02-28 00:42:39',4,0,NULL,NULL,NULL,'ad43ca8a-5327-49d6-82a9-d4a5b532e54e'),(2615,'Contacts of TB Patients who are positive to a bacteriologic test and started on TB treatment','Contacts of TB Patients who are positive to a bacteriologic test and started on TB treatment','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Contacts of TB Patients who are positive to a bacteriologic test and started on TB treatment\n Contacts of TB Patients who are positive to a bacteriologic test and started on TB treatment\n \n 2024-02-27 19:13:47 UTC\n \n 2024-02-27 19:14:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2615\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 00:43:47',4,'2024-02-28 00:44:36',4,0,NULL,NULL,NULL,'eecb27c4-5eea-4c61-8093-2e76f27c5733'),(2616,'TB Case Detection - Block 2: Contact Tracing and screening ','TB Case Detection - Block 2: Contact Tracing and screening ','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Case Detection - Block 2: Contact Tracing and screening \n TB Case Detection - Block 2: Contact Tracing and screening \n \n 2024-02-27 19:18:00 UTC\n \n 2024-02-27 19:18:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2616\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2024-02-28 00:48:00',4,'2024-02-28 00:48:20',4,0,NULL,NULL,NULL,'18beaf66-8afb-4c42-85f3-6a4f9e6e4c86'),(2617,'TB Case Detection - Block 2: Contact Tracing and screening Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Case Detection - Block 2: Contact Tracing and screening Data Set\n \n 2024-02-27 19:18:20 UTC\n \n 2024-02-27 19:48:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2617\n \n \n Detection_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n AlPosBacTB\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n \n \n AllBacRes\n \n \n \n \n \n \n \n \n \n AllConPres\n \n \n \n \n \n \n \n \n \n AllConScre\n \n \n \n \n \n \n \n \n \n AllContact\n \n \n \n \n \n \n \n \n \n AllPosBact\n \n \n \n \n \n \n \n \n \n BacRes5-14\n \n \n \n \n Detection_Age\n 5-14yrs\n \n \n \n \n \n BacRes<5ys\n \n \n \n \n Detection_Age\n <5yrs\n \n \n \n \n \n Con15+ys\n \n \n \n \n Detection_Age\n 15+years\n \n \n \n \n \n ConPre15+y\n \n \n \n \n \n \n ConPre5-14\n \n \n \n \n \n \n ConPres<5y\n \n \n \n \n \n \n ConScr15+y\n \n \n \n \n \n \n ConScr5-14\n \n \n \n \n \n \n ConScr<5ys\n \n \n \n \n \n \n Cont5-14ys\n \n \n \n \n \n \n Cont<5ys\n \n \n \n \n \n \n PoBaTB5-14\n \n \n \n \n \n \n PoBacTB15+\n \n \n \n \n \n \n PosBac15+y\n \n \n \n \n \n \n PosBac5-14\n \n \n \n \n \n \n PosBac<5ys\n \n \n \n \n \n \n PosBacTB<5\n \n \n \n \n \n \n','2024-02-28 00:48:20',4,'2024-02-28 01:18:21',4,0,NULL,NULL,NULL,'8ce17921-9b17-4c08-9bfc-679a5d0d56da'),(2618,'TB patients given 2RHZE/4RHE weighing 30-39kg','TB patients given 2RHZE/4RHE weighing 30-39kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4RHE weighing 30-39kg\n TB patients given 2RHZE/4RHE weighing 30-39kg\n \n 2024-02-28 09:00:45 UTC\n \n 2024-02-28 09:01:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2618\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6002 -- 2RHZE/4RHE \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=30 and _weight < 40 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 14:30:45',4,'2024-02-28 14:31:30',4,0,NULL,NULL,NULL,'bce1bee1-bb3f-4a76-afef-2247f4cd563d'),(2619,'TB patients given 2RHZE/4RHE weighing 40-54kg','TB patients given 2RHZE/4RHE weighing 40-54kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4RHE weighing 40-54kg\n TB patients given 2RHZE/4RHE weighing 40-54kg\n \n 2024-02-28 09:03:00 UTC\n \n 2024-02-28 09:03:22 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2619\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6002 -- 2RHZE/4RHE \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=40 and _weight < 55 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 14:33:00',4,'2024-02-28 14:33:22',4,0,NULL,NULL,NULL,'1e603efc-b71c-45c5-8c9b-8f3126d88455'),(2620,'TB patients given 2RHZE/4RHE weighing 55-70kg','TB patients given 2RHZE/4RHE weighing 55-70kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4RHE weighing 55-70kg\n TB patients given 2RHZE/4RHE weighing 55-70kg\n \n 2024-02-28 09:03:53 UTC\n \n 2024-02-28 09:04:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2620\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6002 -- 2RHZE/4RHE \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=55 and _weight <= 70 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 14:33:53',4,'2024-02-28 14:34:42',4,0,NULL,NULL,NULL,'7a53ac46-5c90-4320-83ff-2f59647d980f'),(2621,'TB patients given 2RHZE/4RHE weighing > 70','TB patients given 2RHZE/4RHE weighing > 70','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4RHE weighing > 70\n TB patients given 2RHZE/4RHE weighing > 70\n \n 2024-02-28 09:05:44 UTC\n \n 2024-02-28 09:06:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2621\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6002 -- 2RHZE/4RHE \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight > 70 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 14:35:44',4,'2024-02-28 14:36:26',4,0,NULL,NULL,NULL,'fe5b0998-1225-4b7e-b565-e15fa88e7ca7'),(2622,'TB patients given 2HPMZ/2HPM weighing 40-50kg','TB patients given 2HPMZ/2HPM weighing 40-50kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HPMZ/2HPM weighing 40-50kg\n TB patients given 2HPMZ/2HPM weighing 40-50kg\n \n 2024-02-28 09:08:25 UTC\n \n 2024-02-28 09:08:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2622\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6003 -- 2HPMZ/2HPM \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=40 and _weight < 50 \n)weight__ \nON regimen.Id = weight__.Id \n\n','2024-02-28 14:38:25',4,'2024-02-28 14:38:53',4,0,NULL,NULL,NULL,'97d1eb39-6c72-4cd7-85f2-a7667daea615'),(2623,'TB patients given 2HPMZ/2HPM weighing 50-65kg','TB patients given 2HPMZ/2HPM weighing 50-65kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HPMZ/2HPM weighing 50-65kg\n TB patients given 2HPMZ/2HPM weighing 50-65kg\n \n 2024-02-28 09:09:48 UTC\n \n 2024-02-28 09:10:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2623\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6003 -- 2HPMZ/2HPM \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=50 and _weight < 65 \n)weight__ \nON regimen.Id = weight__.Id \n\n','2024-02-28 14:39:48',4,'2024-02-28 14:40:58',4,0,NULL,NULL,NULL,'4698f622-e7a9-4dd9-8c2d-6af54419f71f'),(2624,'TB patients given 2HPMZ/2HPM weighing > 65kg','TB patients given 2HPMZ/2HPM weighing > 65kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HPMZ/2HPM weighing > 65kg\n TB patients given 2HPMZ/2HPM weighing > 65kg\n \n 2024-02-28 09:11:30 UTC\n \n 2024-02-28 09:12:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2624\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6003 -- 2HPMZ/2HPM \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=65 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 14:41:30',4,'2024-02-28 14:42:01',4,0,NULL,NULL,NULL,'707a44a5-5cd1-46d8-9880-4c4396914acc'),(2625,'TB patients given 2RHZE/4HR weighing <2kg','TB patients given 2RHZE/4HR weighing <2kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing <2kg\n TB patients given 2RHZE/4HR weighing <2kg\n \n 2024-02-28 09:16:33 UTC\n \n 2024-02-28 09:18:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2625\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6004 -- 2RHZE/4HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight < 2 \n)weight__ \nON regimen.Id = weight__.Id \n\n','2024-02-28 14:46:33',4,'2024-02-28 14:48:07',4,0,NULL,NULL,NULL,'4c663664-65db-4048-8554-4546b580ff2f'),(2626,'TB patients given 2RHZE/4HR weighing 2-2.9kg','TB patients given 2RHZE/4HR weighing 2-2.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing 2-2.9kg\n TB patients given 2RHZE/4HR weighing 2-2.9kg\n \n 2024-02-28 09:17:03 UTC\n \n 2024-02-28 09:18:56 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2626\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6004 -- 2RHZE/4HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=2 and _weight <=2.9 \n)weight__ \nON regimen.Id = weight__.Id \n\n','2024-02-28 14:47:03',4,'2024-02-28 14:48:56',4,0,NULL,NULL,NULL,'bcc6e6f5-8e74-4a51-bf4e-74f9aa16c937'),(2627,'TB patients given 2RHZE/4HR weighing 3-3.9kg','TB patients given 2RHZE/4HR weighing 3-3.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing 3-3.9kg\n TB patients given 2RHZE/4HR weighing 3-3.9kg\n \n 2024-02-28 09:17:29 UTC\n \n 2024-02-28 09:19:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2627\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6004 -- 2RHZE/4HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=3 and _weight <=3.9 \n)weight__ \nON regimen.Id = weight__.Id \n\n','2024-02-28 14:47:29',4,'2024-02-28 14:49:26',4,0,NULL,NULL,NULL,'5f931adb-9e99-4e78-a063-02bd6d424205'),(2628,'TB patients given 2RHZE/4HR weighing 4-7.9kg','TB patients given 2RHZE/4HR weighing 4-7.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing 4-7.9kg\n TB patients given 2RHZE/4HR weighing 4-7.9kg\n \n 2024-02-28 09:20:41 UTC\n \n 2024-02-28 09:22:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2628\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6004 -- 2RHZE/4HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=4 and _weight <=7.9 \n)weight__ \nON regimen.Id = weight__.Id \n\n','2024-02-28 14:50:41',4,'2024-02-28 14:52:44',4,0,NULL,NULL,NULL,'e45460ed-89cd-4be9-a60b-b3b96c18690c'),(2629,'TB patients given 2RHZE/4HR weighing 8-11.9kg','TB patients given 2RHZE/4HR weighing 8-11.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing 8-11.9kg\n TB patients given 2RHZE/4HR weighing 8-11.9kg\n \n 2024-02-28 09:21:07 UTC\n \n 2024-02-28 09:23:25 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2629\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6004 -- 2RHZE/4HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=8 and _weight <=11.9 \n)weight__ \nON regimen.Id = weight__.Id \n\n','2024-02-28 14:51:07',4,'2024-02-28 14:53:25',4,0,NULL,NULL,NULL,'abc8ec30-9c64-4b20-90d5-84d305425137'),(2630,'TB patients given 2RHZE/4HR weighing 12-15.9kg','TB patients given 2RHZE/4HR weighing 12-15.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing 12-15.9kg\n TB patients given 2RHZE/4HR weighing 12-15.9kg\n \n 2024-02-28 09:21:43 UTC\n \n 2024-02-28 09:24:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2630\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6004 -- 2RHZE/4HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=12 and _weight <=15.9 \n)weight__ \nON regimen.Id = weight__.Id \n\n','2024-02-28 14:51:43',4,'2024-02-28 14:54:08',4,0,NULL,NULL,NULL,'52ec3a8d-b3e6-41dc-aa67-2ff1a07dfd2d'),(2631,'TB patients given 2RHZE/4HR weighing 16-24.9kg','TB patients given 2RHZE/4HR weighing 16-24.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing 16-24.9kg\n TB patients given 2RHZE/4HR weighing 16-24.9kg\n \n 2024-02-28 09:24:47 UTC\n \n 2024-02-28 09:26:48 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2631\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6004 -- 2RHZE/4HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=16 and _weight <=24.9 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 14:54:47',4,'2024-02-28 14:56:48',4,0,NULL,NULL,NULL,'aaaa184e-66a3-41ee-805d-63a160e900d7'),(2632,'TB patients given 2RHZE/4HR weighing 25-<30kg','TB patients given 2RHZE/4HR weighing 25-<30kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing 25-<30kg\n TB patients given 2RHZE/4HR weighing 25-<30kg\n \n 2024-02-28 09:25:32 UTC\n \n 2024-02-28 09:27:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2632\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6004 -- 2RHZE/4HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=25 and _weight <30 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 14:55:32',4,'2024-02-28 14:57:11',4,0,NULL,NULL,NULL,'0f4326f5-cd2a-4800-a7cb-fe455816074e'),(2633,'TB patients given 2RHZE/4HR weighing 30-<35kg','TB patients given 2RHZE/4HR weighing 30-<35kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing 30-<35kg\n TB patients given 2RHZE/4HR weighing 30-<35kg\n \n 2024-02-28 09:25:58 UTC\n \n 2024-02-28 09:27:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2633\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6004 -- 2RHZE/4HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=30 and _weight <35 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 14:55:58',4,'2024-02-28 14:57:39',4,0,NULL,NULL,NULL,'a8c81b22-814f-4ec1-870c-a46e92de3ee2'),(2634,'TB patients given 2RHZE/4HR weighing 35-<50kg','TB patients given 2RHZE/4HR weighing 35-<50kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing 35-<50kg\n TB patients given 2RHZE/4HR weighing 35-<50kg\n \n 2024-02-28 09:28:44 UTC\n \n 2024-02-28 09:30:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2634\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6004 -- 2RHZE/4HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=35 and _weight <50 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 14:58:44',4,'2024-02-28 15:00:43',4,0,NULL,NULL,NULL,'780376a9-7a64-41f5-8f4d-0bcae15e9ca9'),(2635,'TB patients given 2RHZE/4HR weighing 50-<65kg','TB patients given 2RHZE/4HR weighing 50-<65kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing 50-<65kg\n TB patients given 2RHZE/4HR weighing 50-<65kg\n \n 2024-02-28 09:29:39 UTC\n \n 2024-02-28 09:31:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2635\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6004 -- 2RHZE/4HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=50 and _weight <65 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 14:59:39',4,'2024-02-28 15:01:03',4,0,NULL,NULL,NULL,'7adf4555-6be7-4db8-911c-41e8087ab25f'),(2636,'TB patients given 2RHZE/4HR weighing >65kg','TB patients given 2RHZE/4HR weighing >65kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing >65kg\n TB patients given 2RHZE/4HR weighing >65kg\n \n 2024-02-28 09:30:09 UTC\n \n 2024-02-28 09:31:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2636\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6004 -- 2RHZE/4HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=65 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:00:09',4,'2024-02-28 15:01:20',4,0,NULL,NULL,NULL,'3ba100cc-0cf9-491d-a702-3382611c1f47'),(2637,'TB patients given 2HRE/10HR weighing < 2kg','TB patients given 2HRE/10HR weighing < 2kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing < 2kg\n TB patients given 2HRE/10HR weighing < 2kg\n \n 2024-02-28 09:46:22 UTC\n \n 2024-02-28 09:47:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2637\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6006 -- 2HRE/10HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight<2 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:16:22',4,'2024-02-28 15:17:53',4,0,NULL,NULL,NULL,'c7f2046d-c7a7-4d48-9c85-2a455c7dbdc0'),(2638,'TB patients given 2HRE/10HR weighing 2-2.9kg','TB patients given 2HRE/10HR weighing 2-2.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing 2-2.9kg\n TB patients given 2HRE/10HR weighing 2-2.9kg\n \n 2024-02-28 09:46:56 UTC\n \n 2024-02-28 09:48:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2638\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6006 -- 2HRE/10HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=2 and _weight <=2.9 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:16:56',4,'2024-02-28 15:18:18',4,0,NULL,NULL,NULL,'de0d0c97-70f7-4883-bc11-e831a85a64bd'),(2639,'TB patients given 2HRE/10HR weighing 3-3.9kg','TB patients given 2HRE/10HR weighing 3-3.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing 3-3.9kg\n TB patients given 2HRE/10HR weighing 3-3.9kg\n \n 2024-02-28 09:47:20 UTC\n \n 2024-02-28 09:48:37 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2639\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6006 -- 2HRE/10HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=3 and _weight <=3.9 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:17:20',4,'2024-02-28 15:18:37',4,0,NULL,NULL,NULL,'8a6d80b4-4f5f-416d-8242-73f18ca89178'),(2640,'TB patients given 2HRE/10HR weighing 4-7.9kg','TB patients given 2HRE/10HR weighing 4-7.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing 4-7.9kg\n TB patients given 2HRE/10HR weighing 4-7.9kg\n \n 2024-02-28 09:49:19 UTC\n \n 2024-02-28 09:50:56 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2640\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6006 -- 2HRE/10HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=4 and _weight <=7.9 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:19:19',4,'2024-02-28 15:20:56',4,0,NULL,NULL,NULL,'38551c29-6e79-4f40-9411-9beecdee568e'),(2641,'TB patients given 2HRE/10HR weighing 8-11.9kg','TB patients given 2HRE/10HR weighing 8-11.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing 8-11.9kg\n TB patients given 2HRE/10HR weighing 8-11.9kg\n \n 2024-02-28 09:49:56 UTC\n \n 2024-02-28 09:51:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2641\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6006 -- 2HRE/10HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=8 and _weight <=11.9 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:19:56',4,'2024-02-28 15:21:15',4,0,NULL,NULL,NULL,'59ff1d6e-fe8b-4ca9-9b15-10937a9fa334'),(2642,'TB patients given 2HRE/10HR weighing 12-15.9kg','TB patients given 2HRE/10HR weighing 12-15.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing 12-15.9kg\n TB patients given 2HRE/10HR weighing 12-15.9kg\n \n 2024-02-28 09:50:27 UTC\n \n 2024-02-28 09:51:35 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2642\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6006 -- 2HRE/10HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=12 and _weight <=15.9 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:20:27',4,'2024-02-28 15:21:35',4,0,NULL,NULL,NULL,'1fab63d8-a077-4f3d-b679-8ea75eefc879'),(2643,'TB patients given 2HRE/10HR weighing 16-24.9kg','TB patients given 2HRE/10HR weighing 16-24.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing 16-24.9kg\n TB patients given 2HRE/10HR weighing 16-24.9kg\n \n 2024-02-28 09:52:51 UTC\n \n 2024-02-28 09:54:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2643\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6006 -- 2HRE/10HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=16 and _weight <=24.9 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:22:51',4,'2024-02-28 15:24:31',4,0,NULL,NULL,NULL,'e3ca9790-a1cc-4ede-adb2-2adf7417ef0e'),(2644,'TB patients given 2HRE/10HR weighing 25-<30kg','TB patients given 2HRE/10HR weighing 25-<30kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing 25-<30kg\n TB patients given 2HRE/10HR weighing 25-<30kg\n \n 2024-02-28 09:53:35 UTC\n \n 2024-02-28 09:54:52 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2644\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6006 -- 2HRE/10HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=25 and _weight <30 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:23:35',4,'2024-02-28 15:24:52',4,0,NULL,NULL,NULL,'61d82671-e514-447c-9f93-6ff18cefcc43'),(2645,'TB patients given 2HRE/10HR weighing 30-<35kg','TB patients given 2HRE/10HR weighing 30-<35kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing 30-<35kg\n TB patients given 2HRE/10HR weighing 30-<35kg\n \n 2024-02-28 09:53:58 UTC\n \n 2024-02-28 09:55:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2645\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6006 -- 2HRE/10HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=30 and _weight <35 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:23:58',4,'2024-02-28 15:25:23',4,0,NULL,NULL,NULL,'ba68f071-b28c-4593-9eb5-d766c4059246'),(2646,'TB patients given 2HRE/10HR weighing 35-<50kg','TB patients given 2HRE/10HR weighing 35-<50kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing 35-<50kg\n TB patients given 2HRE/10HR weighing 35-<50kg\n \n 2024-02-28 09:56:05 UTC\n \n 2024-02-28 09:57:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2646\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6006 -- 2HRE/10HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=35 and _weight <50 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:26:05',4,'2024-02-28 15:27:36',4,0,NULL,NULL,NULL,'97a65448-6d14-44c7-b5f6-c9239129cc04'),(2647,'TB patients given 2HRE/10HR weighing 50-<65kg','TB patients given 2HRE/10HR weighing 50-<65kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing 50-<65kg\n TB patients given 2HRE/10HR weighing 50-<65kg\n \n 2024-02-28 09:58:05 UTC\n \n 2024-02-28 09:59:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2647\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6006 -- 2HRE/10HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=50 and _weight <65 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:28:05',4,'2024-02-28 15:29:08',4,0,NULL,NULL,NULL,'d55f2b31-4ae3-474d-888a-e00f28cb793d'),(2648,'TB patients given 2HRE/10HR weighing > 65kg','TB patients given 2HRE/10HR weighing > 65kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing > 65kg\n TB patients given 2HRE/10HR weighing > 65kg\n \n 2024-02-28 09:58:37 UTC\n \n 2024-02-28 09:59:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2648\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6006 -- 2HRE/10HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=65 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:28:37',4,'2024-02-28 15:29:30',4,0,NULL,NULL,NULL,'1f23c88a-059b-4f38-b2eb-fc6799b4f222'),(2649,'TB patients given 2RHZE/2HR weighing < 2kg','TB patients given 2RHZE/2HR weighing < 2kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing < 2kg\n TB patients given 2RHZE/2HR weighing < 2kg\n \n 2024-02-28 10:01:29 UTC\n \n 2024-02-28 10:02:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2649\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6005 -- 2RHZE/2HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight<2 \n)weight__ \nON regimen.Id = weight__.Id \n\n','2024-02-28 15:31:29',4,'2024-02-28 15:32:50',4,0,NULL,NULL,NULL,'8d42e0e8-c79a-4f69-abc6-4fa27df65a30'),(2650,'TB patients given 2RHZE/2HR weighing 2-2.9kg','TB patients given 2RHZE/2HR weighing 2-2.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing 2-2.9kg\n TB patients given 2RHZE/2HR weighing 2-2.9kg\n \n 2024-02-28 10:01:54 UTC\n \n 2024-02-28 10:03:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2650\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6005 -- 2RHZE/2HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=2 and _weight <=2.9 \n)weight__ \nON regimen.Id = weight__.Id \n\n','2024-02-28 15:31:54',4,'2024-02-28 15:33:05',4,0,NULL,NULL,NULL,'b2fe9c79-18fe-49be-aa3c-b7bfbd65ba1c'),(2651,'TB patients given 2RHZE/2HR weighing 3-3.9kg','TB patients given 2RHZE/2HR weighing 3-3.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing 3-3.9kg\n TB patients given 2RHZE/2HR weighing 3-3.9kg\n \n 2024-02-28 10:02:16 UTC\n \n 2024-02-28 10:03:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2651\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6005 -- 2RHZE/2HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=3 and _weight <=3.9 \n)weight__ \nON regimen.Id = weight__.Id \n\n','2024-02-28 15:32:16',4,'2024-02-28 15:33:21',4,0,NULL,NULL,NULL,'22385e11-6674-42cb-9da8-78d2340fb975'),(2652,'B patients given 2RHZE/2HR weighing 4-7.9kg','B patients given 2RHZE/2HR weighing 4-7.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n B patients given 2RHZE/2HR weighing 4-7.9kg\n B patients given 2RHZE/2HR weighing 4-7.9kg\n \n 2024-02-28 10:04:18 UTC\n \n 2024-02-28 10:05:37 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2652\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6005 -- 2RHZE/2HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=4 and _weight <=7.9 \n)weight__ \nON regimen.Id = weight__.Id \n\n','2024-02-28 15:34:18',4,'2024-02-28 15:35:37',4,0,NULL,NULL,NULL,'356dbe3c-dd76-4e39-b486-3e86492b4eb0'),(2653,'B patients given 2RHZE/2HR weighing 8-11.9kg','B patients given 2RHZE/2HR weighing 8-11.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n B patients given 2RHZE/2HR weighing 8-11.9kg\n B patients given 2RHZE/2HR weighing 8-11.9kg\n \n 2024-02-28 10:04:50 UTC\n \n 2024-02-28 10:06:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2653\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6005 -- 2RHZE/2HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=8 and _weight <=11.9 \n)weight__ \nON regimen.Id = weight__.Id \n\n','2024-02-28 15:34:50',4,'2024-02-28 15:36:00',4,0,NULL,NULL,NULL,'3d88ce54-fe6f-45ec-9628-303ede656df6'),(2654,'B patients given 2RHZE/2HR weighing 12-15.9kg','B patients given 2RHZE/2HR weighing 12-15.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n B patients given 2RHZE/2HR weighing 12-15.9kg\n B patients given 2RHZE/2HR weighing 12-15.9kg\n \n 2024-02-28 10:05:14 UTC\n \n 2024-02-28 10:06:38 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2654\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6005 -- 2RHZE/2HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=12 and _weight <=15.9 \n)weight__ \nON regimen.Id = weight__.Id \n\n','2024-02-28 15:35:14',4,'2024-02-28 15:36:38',4,0,NULL,NULL,NULL,'f072dc00-cc6a-4c1d-b049-3d71fdd7c418'),(2655,'TB patients given 2RHZE/2HR weighing 4-7.9kg','TB patients given 2RHZE/2HR weighing 4-7.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing 4-7.9kg\n TB patients given 2RHZE/2HR weighing 4-7.9kg\n \n 2024-02-28 10:10:03 UTC\n \n 2024-02-28 10:11:16 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2655\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6005 -- 2RHZE/2HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=4 and _weight <=7.9 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:40:03',4,'2024-02-28 15:41:16',4,0,NULL,NULL,NULL,'5d170b44-4744-44a0-8b5c-9a147276a165'),(2656,'TB patients given 2RHZE/2HR weighing 8-11.9kg','TB patients given 2RHZE/2HR weighing 8-11.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing 8-11.9kg\n TB patients given 2RHZE/2HR weighing 8-11.9kg\n \n 2024-02-28 10:10:27 UTC\n \n 2024-02-28 10:11:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2656\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6005 -- 2RHZE/2HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=8 and _weight <=11.9 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:40:27',4,'2024-02-28 15:41:41',4,0,NULL,NULL,NULL,'4c12f685-7ba2-4a98-85d9-e8c718af019c'),(2657,'TB patients given 2RHZE/2HR weighing 12-15.9kg','TB patients given 2RHZE/2HR weighing 12-15.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing 12-15.9kg\n TB patients given 2RHZE/2HR weighing 12-15.9kg\n \n 2024-02-28 10:10:49 UTC\n \n 2024-02-28 10:11:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2657\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6005 -- 2RHZE/2HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=12 and _weight <=15.9 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:40:49',4,'2024-02-28 15:41:59',4,0,NULL,NULL,NULL,'2da2a070-b7ba-4cd7-90c5-41cddf07a601'),(2658,'TB patients given 2RHZE/2HR weighing 16-24.9kg','TB patients given 2RHZE/2HR weighing 16-24.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing 16-24.9kg\n TB patients given 2RHZE/2HR weighing 16-24.9kg\n \n 2024-02-28 10:12:34 UTC\n \n 2024-02-28 10:13:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2658\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6005 -- 2RHZE/2HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=16 and _weight <=24.9 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:42:34',4,'2024-02-28 15:43:58',4,0,NULL,NULL,NULL,'ecfd9cec-ff1f-4d86-b760-18ee712a0d36'),(2659,'TB patients given 2RHZE/2HR weighing 25-<30kg','TB patients given 2RHZE/2HR weighing 25-<30kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing 25-<30kg\n TB patients given 2RHZE/2HR weighing 25-<30kg\n \n 2024-02-28 10:13:03 UTC\n \n 2024-02-28 10:14:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2659\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6005 -- 2RHZE/2HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=25 and _weight <30 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:43:03',4,'2024-02-28 15:44:18',4,0,NULL,NULL,NULL,'66c43d8e-18e2-41e5-a0b0-501a2b508a22'),(2660,'TB patients given 2RHZE/2HR weighing 30-<35kg','TB patients given 2RHZE/2HR weighing 30-<35kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing 30-<35kg\n TB patients given 2RHZE/2HR weighing 30-<35kg\n \n 2024-02-28 10:13:24 UTC\n \n 2024-02-28 10:14:35 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2660\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6005 -- 2RHZE/2HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=30 and _weight <35 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:43:24',4,'2024-02-28 15:44:35',4,0,NULL,NULL,NULL,'362a2af4-9cdc-4380-8631-4188d1354417'),(2661,'TB patients given 2RHZE/2HR weighing 35-<50kg','TB patients given 2RHZE/2HR weighing 35-<50kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing 35-<50kg\n TB patients given 2RHZE/2HR weighing 35-<50kg\n \n 2024-02-28 10:15:06 UTC\n \n 2024-02-28 10:16:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2661\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6005 -- 2RHZE/2HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=35 and _weight <50 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:45:06',4,'2024-02-28 15:46:29',4,0,NULL,NULL,NULL,'210d7eb7-846b-42fe-a1e5-c47bc1450cb6'),(2662,'TB patients given 2RHZE/2HR weighing 50-<65kg','TB patients given 2RHZE/2HR weighing 50-<65kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing 50-<65kg\n TB patients given 2RHZE/2HR weighing 50-<65kg\n \n 2024-02-28 10:15:34 UTC\n \n 2024-02-28 10:17:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2662\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6005 -- 2RHZE/2HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=50 and _weight <65 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:45:34',4,'2024-02-28 15:47:01',4,0,NULL,NULL,NULL,'8662ce61-9594-487c-9c1c-c683a2f95180'),(2663,'TB patients given 2RHZE/2HR weighing >65kg','TB patients given 2RHZE/2HR weighing >65kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing >65kg\n TB patients given 2RHZE/2HR weighing >65kg\n \n 2024-02-28 10:16:01 UTC\n \n 2024-02-28 10:36:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2663\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6005 -- 2RHZE/2HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=65 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:46:01',4,'2024-02-28 16:06:50',4,0,NULL,NULL,NULL,'d0c91360-93f7-4b62-a335-38d1f9e8e458'),(2664,'TB patients given 2HPMZ/2HPM weighing 40-50kg','TB patients given 2HPMZ/2HPM weighing 40-50kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HPMZ/2HPM weighing 40-50kg\n TB patients given 2HPMZ/2HPM weighing 40-50kg\n \n 2024-02-28 10:38:37 UTC\n \n 2024-02-28 10:40:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2664\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 16:08:37',4,'2024-02-28 16:10:21',4,0,NULL,NULL,NULL,'267131cd-92f8-4d89-9153-7666479e3d96'),(2665,'TB patients given 2HPMZ/2HPM weighing 50-65kg','TB patients given 2HPMZ/2HPM weighing 50-65kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HPMZ/2HPM weighing 50-65kg\n TB patients given 2HPMZ/2HPM weighing 50-65kg\n \n 2024-02-28 10:40:43 UTC\n \n 2024-02-28 10:42:38 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2665\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 16:10:43',4,'2024-02-28 16:12:38',4,0,NULL,NULL,NULL,'a2cce7b4-84b0-407c-a850-045310956d08'),(2666,'TB patients given 2HPMZ/2HPM weighing > 65kg','TB patients given 2HPMZ/2HPM weighing > 65kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HPMZ/2HPM weighing > 65kg\n TB patients given 2HPMZ/2HPM weighing > 65kg\n \n 2024-02-28 10:41:20 UTC\n \n 2024-02-28 10:43:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2666\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 16:11:20',4,'2024-02-28 16:13:29',4,0,NULL,NULL,NULL,'66aa10a3-2291-4f8a-a710-af0231160982'),(2667,'TB patients given 2RHZE/4RHE weighing 30-39kg','TB patients given 2RHZE/4RHE weighing 30-39kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4RHE weighing 30-39kg\n TB patients given 2RHZE/4RHE weighing 30-39kg\n \n 2024-02-28 10:45:02 UTC\n \n 2024-02-28 10:47:52 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2667\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 16:15:02',4,'2024-02-28 16:17:52',4,0,NULL,NULL,NULL,'507430f5-598c-485d-876a-0e1dbcdaea22'),(2668,'TB patients given 2RHZE/4RHE weighing 40-54kg','TB patients given 2RHZE/4RHE weighing 40-54kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4RHE weighing 40-54kg\n TB patients given 2RHZE/4RHE weighing 40-54kg\n \n 2024-02-28 10:46:01 UTC\n \n 2024-02-28 10:48:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2668\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 16:16:01',4,'2024-02-28 16:18:15',4,0,NULL,NULL,NULL,'2d8b3440-8b64-4836-8097-0ee78b1421f9'),(2669,'TB patients given 2RHZE/4RHE weighing 55-70kg','TB patients given 2RHZE/4RHE weighing 55-70kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4RHE weighing 55-70kg\n TB patients given 2RHZE/4RHE weighing 55-70kg\n \n 2024-02-28 10:47:03 UTC\n \n COUNT\n','2024-02-28 16:17:03',4,NULL,NULL,0,NULL,NULL,NULL,'77aaf4be-b225-465a-b3dc-685757328958'),(2670,'TB patients given 2RHZE/4RHE weighing 55-70kg','TB patients given 2RHZE/4RHE weighing 55-70kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4RHE weighing 55-70kg\n TB patients given 2RHZE/4RHE weighing 55-70kg\n \n 2024-02-28 10:47:06 UTC\n \n 2024-02-28 10:49:09 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2670\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 16:17:06',4,'2024-02-28 16:19:09',4,0,NULL,NULL,NULL,'4ca65f2c-58a1-46f2-be7d-d2e0b8b52eca'),(2671,'TB patients given 2RHZE/4RHE weighing > 70','TB patients given 2RHZE/4RHE weighing > 70','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4RHE weighing > 70\n TB patients given 2RHZE/4RHE weighing > 70\n \n 2024-02-28 10:48:45 UTC\n \n 2024-02-28 10:51:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2671\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 16:18:45',4,'2024-02-28 16:21:07',4,0,NULL,NULL,NULL,'aacf0718-0185-42a7-8e9f-dc32a196d708'),(2672,'TB patients given 2RHZE/4HR weighing <2kg','TB patients given 2RHZE/4HR weighing <2kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing <2kg\n TB patients given 2RHZE/4HR weighing <2kg\n \n 2024-02-28 10:52:59 UTC\n \n 2024-02-28 10:55:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2672\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 16:22:59',4,'2024-02-28 16:25:06',4,0,NULL,NULL,NULL,'fcef6215-4d11-4edb-a132-3a001295eac7'),(2673,'TB patients given 2RHZE/4HR weighing 2-2.9kg','TB patients given 2RHZE/4HR weighing 2-2.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing 2-2.9kg\n TB patients given 2RHZE/4HR weighing 2-2.9kg\n \n 2024-02-28 10:53:34 UTC\n \n COUNT\n','2024-02-28 16:23:34',4,NULL,NULL,0,NULL,NULL,NULL,'a0f2d45a-30f4-4c5f-af64-3a6ccb151c33'),(2674,'TB patients given 2RHZE/4HR weighing 2-2.9kg','TB patients given 2RHZE/4HR weighing 2-2.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing 2-2.9kg\n TB patients given 2RHZE/4HR weighing 2-2.9kg\n \n 2024-02-28 10:53:37 UTC\n \n 2024-02-28 10:57:48 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2674\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 16:23:37',4,'2024-02-28 16:27:48',4,0,NULL,NULL,NULL,'a5aff9a2-2ff6-49ce-a1f9-5b2c07874d5c'),(2675,'TB patients given 2RHZE/4HR weighing 3-3.9kg','TB patients given 2RHZE/4HR weighing 3-3.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing 3-3.9kg\n TB patients given 2RHZE/4HR weighing 3-3.9kg\n \n 2024-02-28 10:56:04 UTC\n \n 2024-02-28 10:58:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2675\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 16:26:04',4,'2024-02-28 16:28:10',4,0,NULL,NULL,NULL,'06a8c0b0-b7a3-4443-b168-9816354d5519'),(2676,'TB patients given 2RHZE/4HR weighing 4-7.9kg','TB patients given 2RHZE/4HR weighing 4-7.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing 4-7.9kg\n TB patients given 2RHZE/4HR weighing 4-7.9kg\n \n 2024-02-28 10:57:21 UTC\n \n 2024-02-28 10:59:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2676\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 16:27:21',4,'2024-02-28 16:29:15',4,0,NULL,NULL,NULL,'fba7f805-6a0e-4a02-89fe-d8fe6491ff51'),(2677,'TB patients given 2RHZE/4HR weighing 8-11.9kg','TB patients given 2RHZE/4HR weighing 8-11.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing 8-11.9kg\n TB patients given 2RHZE/4HR weighing 8-11.9kg\n \n 2024-02-28 10:59:49 UTC\n \n 2024-02-28 11:03:52 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2677\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 16:29:49',4,'2024-02-28 16:33:52',4,0,NULL,NULL,NULL,'acb3c52b-cd20-4b33-8b0e-f8f8865d283c'),(2678,'TB patients given 2RHZE/4HR weighing 12-15.9kg','TB patients given 2RHZE/4HR weighing 12-15.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing 12-15.9kg\n TB patients given 2RHZE/4HR weighing 12-15.9kg\n \n 2024-02-28 11:00:16 UTC\n \n 2024-02-28 11:04:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2678\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 16:30:16',4,'2024-02-28 16:34:11',4,0,NULL,NULL,NULL,'af2dc223-8a19-46b1-b8ae-add6e943f891'),(2679,'TB patients given 2RHZE/4HR weighing 16-24.9kg','TB patients given 2RHZE/4HR weighing 16-24.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing 16-24.9kg\n TB patients given 2RHZE/4HR weighing 16-24.9kg\n \n 2024-02-28 11:00:43 UTC\n \n 2024-02-28 11:04:34 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2679\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 16:30:43',4,'2024-02-28 16:34:34',4,0,NULL,NULL,NULL,'693ddd70-5db7-46ba-8195-670f174b867f'),(2680,'TB patients given 2RHZE/4HR weighing 25-<30kg','TB patients given 2RHZE/4HR weighing 25-<30kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing 25-<30kg\n TB patients given 2RHZE/4HR weighing 25-<30kg\n \n 2024-02-28 11:01:10 UTC\n \n 2024-02-28 11:04:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2680\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 16:31:10',4,'2024-02-28 16:34:58',4,0,NULL,NULL,NULL,'2bd66740-4941-4932-8876-43e12c912ef0'),(2681,'TB patients given 2RHZE/4HR weighing 30-<35kg','TB patients given 2RHZE/4HR weighing 30-<35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing 30-<35kg\n TB patients given 2RHZE/4HR weighing 30-<35kg\n \n 2024-02-28 11:05:44 UTC\n \n 2024-02-28 11:08:52 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2681\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 16:35:44',4,'2024-02-28 16:38:52',4,0,NULL,NULL,NULL,'5201f808-7174-4785-b5a8-fb855cb1bc00'),(2682,'TB patients given 2RHZE/4HR weighing 35-<50kg','TB patients given 2RHZE/4HR weighing 35-<50kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing 35-<50kg\n TB patients given 2RHZE/4HR weighing 35-<50kg\n \n 2024-02-28 11:07:34 UTC\n \n 2024-02-28 11:10:34 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2682\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 16:37:34',4,'2024-02-28 16:40:34',4,0,NULL,NULL,NULL,'663aa7b1-0169-4cd3-aabb-1d33b0a54706'),(2683,'TB patients given 2RHZE/4HR weighing 50-<65kg','TB patients given 2RHZE/4HR weighing 50-<65kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing 50-<65kg\n TB patients given 2RHZE/4HR weighing 50-<65kg\n \n 2024-02-28 11:07:58 UTC\n \n 2024-02-28 11:10:49 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2683\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 16:37:58',4,'2024-02-28 16:40:49',4,0,NULL,NULL,NULL,'a07688e5-85a2-468b-9dc8-13a8c1100b47'),(2684,'TB patients given 2RHZE/4HR weighing >65kg','TB patients given 2RHZE/4HR weighing >65kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing >65kg\n TB patients given 2RHZE/4HR weighing >65kg\n \n 2024-02-28 11:08:27 UTC\n \n 2024-02-28 11:11:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2684\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 16:38:27',4,'2024-02-28 16:41:07',4,0,NULL,NULL,NULL,'70b78a75-3be5-4dc5-a191-21ce2d9621ee'),(2685,'TB patients given 2HRE/10HR weighing < 2kg','TB patients given 2HRE/10HR weighing < 2kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing < 2kg\n TB patients given 2HRE/10HR weighing < 2kg\n \n 2024-02-28 13:08:41 UTC\n \n 2024-02-28 13:14:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2685\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 18:38:41',4,'2024-02-28 18:44:55',4,0,NULL,NULL,NULL,'e8ffcdff-a39c-463b-8da6-a622ef5cefaf'),(2686,'TB patients given 2HRE/10HR weighing 2-2.9kg','TB patients given 2HRE/10HR weighing 2-2.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing 2-2.9kg\n TB patients given 2HRE/10HR weighing 2-2.9kg\n \n 2024-02-28 13:09:10 UTC\n \n 2024-02-28 13:15:22 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2686\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 18:39:10',4,'2024-02-28 18:45:22',4,0,NULL,NULL,NULL,'fd54220d-0eea-4c40-91d3-6842888ba3b5'),(2687,'TB patients given 2HRE/10HR weighing 3-3.9kg','TB patients given 2HRE/10HR weighing 3-3.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing 3-3.9kg\n TB patients given 2HRE/10HR weighing 3-3.9kg\n \n 2024-02-28 13:09:39 UTC\n \n 2024-02-28 13:16:19 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2687\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 18:39:39',4,'2024-02-28 18:46:19',4,0,NULL,NULL,NULL,'be84889c-0395-437b-9400-c2a7e8eb2ccf'),(2688,'TB patients given 2HRE/10HR weighing 4-7.9kg','TB patients given 2HRE/10HR weighing 4-7.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing 4-7.9kg\n TB patients given 2HRE/10HR weighing 4-7.9kg\n \n 2024-02-28 13:10:10 UTC\n \n 2024-02-28 13:16:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2688\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 18:40:10',4,'2024-02-28 18:46:40',4,0,NULL,NULL,NULL,'a204e666-8840-4614-bf83-af7330f68aaa'),(2689,'TB patients given 2HRE/10HR weighing 8-11.9kg','TB patients given 2HRE/10HR weighing 8-11.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing 8-11.9kg\n TB patients given 2HRE/10HR weighing 8-11.9kg\n \n 2024-02-28 13:17:57 UTC\n \n 2024-02-28 13:23:09 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2689\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 18:47:57',4,'2024-02-28 18:53:09',4,0,NULL,NULL,NULL,'139114c2-da7a-4749-89b4-e99e72994d81'),(2690,'TB patients given 2HRE/10HR weighing 12-15.9kg','TB patients given 2HRE/10HR weighing 12-15.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing 12-15.9kg\n TB patients given 2HRE/10HR weighing 12-15.9kg\n \n 2024-02-28 13:19:00 UTC\n \n 2024-02-28 13:23:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2690\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 18:49:00',4,'2024-02-28 18:53:27',4,0,NULL,NULL,NULL,'346da8a7-01a5-4c66-b438-15b66599e85d'),(2691,'TB patients given 2HRE/10HR weighing 16-24.9kg','TB patients given 2HRE/10HR weighing 16-24.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing 16-24.9kg\n TB patients given 2HRE/10HR weighing 16-24.9kg\n \n 2024-02-28 13:19:33 UTC\n \n 2024-02-28 13:23:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2691\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 18:49:33',4,'2024-02-28 18:53:55',4,0,NULL,NULL,NULL,'697a3eab-7fc5-4656-b90c-c8f503ba104e'),(2692,'TB patients given 2HRE/10HR weighing 25-<30kg','TB patients given 2HRE/10HR weighing 25-<30kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing 25-<30kg\n TB patients given 2HRE/10HR weighing 25-<30kg\n \n 2024-02-28 13:20:00 UTC\n \n 2024-02-28 13:24:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2692\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 18:50:00',4,'2024-02-28 18:54:21',4,0,NULL,NULL,NULL,'9aaeb85e-bf5b-4cfd-ac28-53cdb1bd4675'),(2693,'TB patients given 2HRE/10HR weighing 30-<35kg','TB patients given 2HRE/10HR weighing 30-<35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing 30-<35kg\n TB patients given 2HRE/10HR weighing 30-<35kg\n \n 2024-02-28 13:26:24 UTC\n \n 2024-02-28 13:30:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2693\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 18:56:24',4,'2024-02-28 19:00:36',4,0,NULL,NULL,NULL,'614b47d9-f71d-43f7-9f20-348a7341b425'),(2694,'TB patients given 2HRE/10HR weighing 35-<50kg','TB patients given 2HRE/10HR weighing 35-<50kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing 35-<50kg\n TB patients given 2HRE/10HR weighing 35-<50kg\n \n 2024-02-28 13:27:03 UTC\n \n 2024-02-28 13:30:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2694\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 18:57:03',4,'2024-02-28 19:00:58',4,0,NULL,NULL,NULL,'90a894c8-2f13-45b8-a9ff-718cc0b5d958'),(2695,'TB patients given 2HRE/10HR weighing 50-<65kg','TB patients given 2HRE/10HR weighing 50-<65kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing 50-<65kg\n TB patients given 2HRE/10HR weighing 50-<65kg\n \n 2024-02-28 13:27:34 UTC\n \n 2024-02-28 13:31:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2695\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 18:57:34',4,'2024-02-28 19:01:21',4,0,NULL,NULL,NULL,'310e9e3a-ae90-4d16-b876-81d55f05e601'),(2696,'TB patients given 2HRE/10HR weighing > 65kg','TB patients given 2HRE/10HR weighing > 65kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing > 65kg\n TB patients given 2HRE/10HR weighing > 65kg\n \n 2024-02-28 13:28:06 UTC\n \n 2024-02-28 13:31:54 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2696\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 18:58:06',4,'2024-02-28 19:01:54',4,0,NULL,NULL,NULL,'fb06b275-034c-492c-bb27-10bef23fce0d'),(2697,'TB patients given 2RHZE/2HR weighing 2-2.9kg','TB patients given 2RHZE/2HR weighing 2-2.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing 2-2.9kg\n TB patients given 2RHZE/2HR weighing 2-2.9kg\n \n 2024-02-28 13:38:38 UTC\n \n 2024-02-28 13:43:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2697\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 19:08:38',4,'2024-02-28 19:13:00',4,0,NULL,NULL,NULL,'d5432933-9558-4f54-8f6e-abc5e9a0223b'),(2698,'TB patients given 2RHZE/2HR weighing 3-3.9kg','TB patients given 2RHZE/2HR weighing 3-3.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing 3-3.9kg\n TB patients given 2RHZE/2HR weighing 3-3.9kg\n \n 2024-02-28 13:39:06 UTC\n \n 2024-02-28 13:48:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2698\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 19:09:06',4,'2024-02-28 19:18:32',4,0,NULL,NULL,NULL,'9379b271-3680-47a4-a2be-8145d4e58fa0'),(2699,'TB patients given 2RHZE/2HR weighing 4-7.9kg','TB patients given 2RHZE/2HR weighing 4-7.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing 4-7.9kg\n TB patients given 2RHZE/2HR weighing 4-7.9kg\n \n 2024-02-28 13:40:21 UTC\n \n 2024-02-28 13:48:54 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2699\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 19:10:21',4,'2024-02-28 19:18:54',4,0,NULL,NULL,NULL,'c0729714-b7a1-4c39-b44a-dd01fcb1aecc'),(2700,'TB patients given 2RHZE/2HR weighing 8-11.9kg','TB patients given 2RHZE/2HR weighing 8-11.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing 8-11.9kg\n TB patients given 2RHZE/2HR weighing 8-11.9kg\n \n 2024-02-28 13:42:30 UTC\n \n 2024-02-28 13:51:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2700\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 19:12:30',4,'2024-02-28 19:21:42',4,0,NULL,NULL,NULL,'17375042-6d27-4096-a84b-bbe596fd7580'),(2701,'TB patients given 2RHZE/2HR weighing 12-15.9kg','TB patients given 2RHZE/2HR weighing 12-15.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing 12-15.9kg\n TB patients given 2RHZE/2HR weighing 12-15.9kg\n \n 2024-02-28 14:06:02 UTC\n \n 2024-02-28 14:14:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2701\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 19:36:02',4,'2024-02-28 19:44:26',4,0,NULL,NULL,NULL,'57ab8f00-8036-404f-9365-a541b14bca39'),(2702,'TB patients given 2RHZE/2HR weighing 16-24.9kg','TB patients given 2RHZE/2HR weighing 16-24.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing 16-24.9kg\n TB patients given 2RHZE/2HR weighing 16-24.9kg\n \n 2024-02-28 14:07:12 UTC\n \n 2024-02-28 14:14:09 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2702\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 19:37:12',4,'2024-02-28 19:44:09',4,0,NULL,NULL,NULL,'385c3355-f68b-4e23-9658-503b7056e688'),(2703,'TB patients given 2RHZE/2HR weighing 25-<30kg','TB patients given 2RHZE/2HR weighing 25-<30kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing 25-<30kg\n TB patients given 2RHZE/2HR weighing 25-<30kg\n \n 2024-02-28 14:08:18 UTC\n \n 2024-02-28 14:13:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2703\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 19:38:18',4,'2024-02-28 19:43:50',4,0,NULL,NULL,NULL,'ee38e990-b599-423f-8a88-51ab26f92f1c'),(2704,'TB patients given 2RHZE/2HR weighing < 2kg','TB patients given 2RHZE/2HR weighing < 2kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing < 2kg\n TB patients given 2RHZE/2HR weighing < 2kg\n \n 2024-02-28 14:10:05 UTC\n \n 2024-02-28 14:13:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2704\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 19:40:05',4,'2024-02-28 19:43:31',4,0,NULL,NULL,NULL,'316b34a7-3579-4f2a-9c1e-59ab23cc0188'),(2705,'TB patients given 2RHZE/2HR weighing 30-<35kg','TB patients given 2RHZE/2HR weighing 30-<35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing 30-<35kg\n TB patients given 2RHZE/2HR weighing 30-<35kg\n \n 2024-02-28 14:15:59 UTC\n \n COUNT\n','2024-02-28 19:45:59',4,NULL,NULL,0,NULL,NULL,NULL,'979c7335-0622-4f85-a7cf-2b64b47c7cbf'),(2706,'TB patients given 2RHZE/2HR weighing 30-<35kg','TB patients given 2RHZE/2HR weighing 30-<35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing 30-<35kg\n TB patients given 2RHZE/2HR weighing 30-<35kg\n \n 2024-02-28 14:15:59 UTC\n \n 2024-02-28 14:19:57 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2706\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 19:45:59',4,'2024-02-28 19:49:57',4,0,NULL,NULL,NULL,'db9dc079-bbf6-42dc-958e-c7c002c4e97c'),(2707,'TB patients given 2RHZE/2HR weighing 35-<50kg','TB patients given 2RHZE/2HR weighing 35-<50kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing 35-<50kg\n TB patients given 2RHZE/2HR weighing 35-<50kg\n \n 2024-02-28 14:16:32 UTC\n \n 2024-02-28 14:19:49 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2707\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 19:46:32',4,'2024-02-28 19:49:49',4,0,NULL,NULL,NULL,'cb160b1b-14c9-4b6d-b4f5-b0287f0ee584'),(2708,'TB patients given 2RHZE/2HR weighing 50-<65kg','TB patients given 2RHZE/2HR weighing 50-<65kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing 50-<65kg\n TB patients given 2RHZE/2HR weighing 50-<65kg\n \n 2024-02-28 14:17:00 UTC\n \n 2024-02-28 14:21:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2708\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 19:47:00',4,'2024-02-28 19:51:28',4,0,NULL,NULL,NULL,'a605a26b-e6b2-4e39-8568-adea9afbe93c'),(2709,'TB patients given 2RHZE/2HR weighing >65kg','TB patients given 2RHZE/2HR weighing >65kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing >65kg\n TB patients given 2RHZE/2HR weighing >65kg\n \n 2024-02-28 14:17:28 UTC\n \n 2024-02-28 14:21:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2709\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 19:47:28',4,'2024-02-28 19:51:11',4,0,NULL,NULL,NULL,'79f70c54-0a3f-456a-bd82-f97868b651e3'),(2710,'TB Case Registration - Block 5','TB Case Registration - Block 5','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Case Registration - Block 5\n TB Case Registration - Block 5\n \n 2024-02-28 14:24:40 UTC\n \n 2024-02-28 14:25:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2710\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2024-02-28 19:54:40',4,'2024-02-28 19:55:12',4,0,NULL,NULL,NULL,'2043afe9-3ece-4901-a898-69be11ff0ac5'),(2711,'TB Case Registration - Block 5 Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Case Registration - Block 5 Data Set\n \n 2024-02-28 14:25:12 UTC\n \n 2024-02-29 09:52:37 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2711\n \n \n \n 2HPMZ_40-5\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n \n \n 2HPMZ_50-6\n \n \n \n \n \n \n \n \n \n 2HPMZ_65\n \n \n \n \n \n \n \n \n \n 2HRE/10H12\n \n \n \n \n \n \n \n \n \n 2HRE/10H16\n \n \n \n \n \n \n \n \n \n 2HRE/10H2-\n \n \n \n \n \n \n \n \n \n 2HRE/10H25\n \n \n \n \n \n \n \n \n \n 2HRE/10H3-\n \n \n \n \n \n \n \n \n \n 2HRE/10H30\n \n \n \n \n \n \n \n \n \n 2HRE/10H35\n \n \n \n \n \n \n \n \n \n 2HRE/10H4-\n \n \n \n \n \n \n \n \n \n 2HRE/10H50\n \n \n \n \n \n \n \n \n \n 2HRE/10H65\n \n \n \n \n \n \n \n \n \n 2HRE/10H8-\n \n \n \n \n \n \n \n \n \n 2HRE/10H<2\n \n \n \n \n \n \n \n \n \n 2RHZE/2H12\n \n \n \n \n \n \n \n \n \n 2RHZE/2H16\n \n \n \n \n \n \n \n \n \n 2RHZE/2H2-\n \n \n \n \n \n \n \n \n \n 2RHZE/2H25\n \n \n \n \n \n \n \n \n \n 2RHZE/2H3-\n \n \n \n \n \n \n \n \n \n 2RHZE/2H30\n \n \n \n \n \n \n \n \n \n 2RHZE/2H35\n \n \n \n \n \n \n \n \n \n 2RHZE/2H4-\n \n \n \n \n \n \n \n \n \n 2RHZE/2H50\n \n \n \n \n \n \n \n \n \n 2RHZE/2H65\n \n \n \n \n \n \n \n \n \n 2RHZE/2H8-\n \n \n \n \n \n \n \n \n \n 2RHZE/2H<2\n \n \n \n \n \n \n \n \n \n 2RHZE/4H12\n \n \n \n \n \n \n \n \n \n 2RHZE/4H16\n \n \n \n \n \n \n \n \n \n 2RHZE/4H2-\n \n \n \n \n \n \n \n \n \n 2RHZE/4H25\n \n \n \n \n \n \n \n \n \n 2RHZE/4H3-\n \n \n \n \n \n \n \n \n \n 2RHZE/4H30\n \n \n \n \n \n \n \n \n \n 2RHZE/4H35\n \n \n \n \n \n \n \n \n \n 2RHZE/4H4-\n \n \n \n \n \n \n \n \n \n 2RHZE/4H50\n \n \n \n \n \n \n \n \n \n 2RHZE/4H65\n \n \n \n \n \n \n \n \n \n 2RHZE/4H8-\n \n \n \n \n \n \n \n \n \n 2RHZE/4H<2\n \n \n \n \n \n \n \n \n \n 2RHZE/4R30\n \n \n \n \n \n \n \n \n \n 2RHZE/4R40\n \n \n \n \n \n \n \n \n \n 2RHZE/4R55\n \n \n \n \n \n \n \n \n \n 2RHZE/4R70\n \n \n \n \n \n \n \n \n \n','2024-02-28 19:55:12',4,'2024-02-29 15:22:37',4,0,NULL,NULL,NULL,'8be20f45-e610-469e-b1ba-5b16a08a151f'),(2712,'TB patients diagnosed with GeneXpert - sputum','TB patients diagnosed with GeneXpert - sputum','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients diagnosed with GeneXpert - sputum\n TB patients diagnosed with GeneXpert - sputum\n \n 2024-02-29 13:40:42 UTC\n \n 2024-02-29 13:41:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2712\n select diagnosis.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_diagnosis \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 3814 and o.value_coded = 3824 -- GeneXpert Sputum \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)diagnosis \n\n','2024-02-29 19:10:42',4,'2024-02-29 19:11:05',4,0,NULL,NULL,NULL,'d8a123a8-d4f2-454d-be8b-bb9ccd11c979'),(2713,'TB patients diagnosed with LPA','TB patients diagnosed with LPA','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients diagnosed with LPA\n TB patients diagnosed with LPA\n \n 2024-02-29 13:42:00 UTC\n \n 2024-02-29 13:42:37 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2713\n select diagnosis.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_diagnosis \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 3814 and o.value_coded = 3825 -- LPA \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)diagnosis\n','2024-02-29 19:12:00',4,'2024-02-29 19:12:37',4,0,NULL,NULL,NULL,'dbc7ab7e-b251-43e3-b9fc-78250f1dc6d2'),(2714,'TB patients diagnosed with smear microscopy','TB patients diagnosed with smear microscopy','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients diagnosed with smear microscopy\n TB patients diagnosed with smear microscopy\n \n 2024-02-29 13:47:25 UTC\n \n 2024-02-29 13:48:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2714\n select diagnosis.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_diagnosis \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 3815 and o.value_coded = 3819 -- Smear microscopy \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)diagnosis\n','2024-02-29 19:17:25',4,'2024-02-29 19:18:20',4,0,NULL,NULL,NULL,'86c13563-ee30-4fbe-9ee2-3ba5baa43b99'),(2715,'TB patients diagnosed with Culture','TB patients diagnosed with Culture','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients diagnosed with Culture\n TB patients diagnosed with Culture\n \n 2024-02-29 13:50:16 UTC\n \n 2024-02-29 13:50:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2715\n select diagnosis.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_diagnosis \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 3815 and o.value_coded = 3819 -- Smear microscopy \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)diagnosis\n','2024-02-29 19:20:16',4,'2024-02-29 19:20:55',4,0,NULL,NULL,NULL,'bb273381-7ea5-4c12-83fd-5f6e7e10e853'),(2716,'TB patients diagnosed with Culture','TB patients diagnosed with Culture','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients diagnosed with Culture\n TB patients diagnosed with Culture\n \n 2024-02-29 14:01:00 UTC\n \n 2024-02-29 14:06:16 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2716\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-29 19:31:00',4,'2024-02-29 19:36:16',4,0,NULL,NULL,NULL,'b9218e8a-e0af-48a8-8107-dcc9a9a7a066'),(2717,'TB patients diagnosed with GeneXpert - sputum','TB patients diagnosed with GeneXpert - sputum','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients diagnosed with GeneXpert - sputum\n TB patients diagnosed with GeneXpert - sputum\n \n 2024-02-29 14:10:38 UTC\n \n COUNT\n','2024-02-29 19:40:38',4,NULL,NULL,0,NULL,NULL,NULL,'3a5d9a42-ab26-4205-b5a2-f2f53ea6c5bc'),(2718,'TB patients diagnosed with GeneXpert - sputum','TB patients diagnosed with GeneXpert - sputum','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients diagnosed with GeneXpert - sputum\n TB patients diagnosed with GeneXpert - sputum\n \n 2024-02-29 14:10:40 UTC\n \n 2024-02-29 14:35:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2718\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-29 19:40:40',4,'2024-02-29 20:05:27',4,0,NULL,NULL,NULL,'a9c92543-222b-490d-bfa3-d2bcb6825eec'),(2719,'TB patients diagnosed with LPA','TB patients diagnosed with LPA','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients diagnosed with LPA\n TB patients diagnosed with LPA\n \n 2024-02-29 14:36:14 UTC\n \n 2024-02-29 14:38:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2719\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-29 20:06:14',4,'2024-02-29 20:08:26',4,0,NULL,NULL,NULL,'7b6eb2f0-56a4-4c91-81c2-1e4abb4e98d2'),(2720,'TB patients diagnosed with smear microscopy','TB patients diagnosed with smear microscopy','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients diagnosed with smear microscopy\n TB patients diagnosed with smear microscopy\n \n 2024-02-29 14:37:25 UTC\n \n 2024-02-29 14:39:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2720\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-29 20:07:25',4,'2024-02-29 20:09:11',4,0,NULL,NULL,NULL,'a27eacbd-b0a6-446f-950f-0402e720c4bb'); +INSERT INTO `serialized_object` VALUES (2480,'Clients given 6A with >=20Copies Viral Load','Clients given 6A with >=20Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6A with >=20Copies Viral Load\n Clients given 6A with >=20Copies Viral Load\n \n 2023-08-17 14:35:48 UTC\n \n 2023-08-17 14:36:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2480\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:35:48',4,'2023-08-17 16:36:40',4,0,NULL,NULL,NULL,'aaaf1254-b937-4fdd-abdf-7f99bc97c9e4'),(2481,'Clients given 5e with poor adherence','Clients given 5e with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5e with poor adherence\n Clients given 5e with poor adherence\n \n 2023-08-17 14:36:47 UTC\n \n 2023-08-17 14:37:52 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2481\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:36:47',4,'2023-08-17 16:37:52',4,0,NULL,NULL,NULL,'b6365db8-5402-488e-bf43-1b4b3869592c'),(2482,'Clients given 6A with <20 Copies Viral Load','Clients given 6A with <20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6A with <20 Copies Viral Load\n Clients given 6A with <20 Copies Viral Load\n \n 2023-08-17 14:37:57 UTC\n \n 2023-08-17 14:40:25 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2482\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:37:57',4,'2023-08-17 16:40:25',4,0,NULL,NULL,NULL,'6dc49bb6-9be8-4b6b-9db7-7cd1e9e9832b'),(2483,'Clients given 5e with fair adherence','Clients given 5e with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5e with fair adherence\n Clients given 5e with fair adherence\n \n 2023-08-17 14:38:45 UTC\n \n 2023-08-17 14:40:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2483\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:38:45',4,'2023-08-17 16:40:42',4,0,NULL,NULL,NULL,'c9761b31-3a7f-4cdb-bce2-e422d0f0a1d9'),(2484,'Clients given 6A with Undetectable Viral Load','Clients given 6A with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6A with Undetectable Viral Load\n Clients given 6A with Undetectable Viral Load\n \n 2023-08-17 14:41:52 UTC\n \n 2023-08-17 14:43:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2484\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:41:52',4,'2023-08-17 16:43:11',4,0,NULL,NULL,NULL,'88ff8b16-c2f3-4f73-accf-0b799dbd4357'),(2485,'Clients given 6B with >=20Copies Viral Load','Clients given 6B with >=20Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6B with >=20Copies Viral Load\n Clients given 6B with >=20Copies Viral Load\n \n 2023-08-17 14:43:49 UTC\n \n 2023-08-17 15:26:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2485\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:43:49',4,'2023-08-17 17:26:07',4,0,NULL,NULL,NULL,'3e4ca350-0d23-4326-b54b-1da860205aa2'),(2486,'Clients given 5e with good adherence','Clients given 5e with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5e with good adherence\n Clients given 5e with good adherence\n \n 2023-08-17 14:44:26 UTC\n \n 2023-08-17 14:46:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2486\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:44:26',4,'2023-08-17 16:46:50',4,0,NULL,NULL,NULL,'bf269091-cd68-4987-adc0-88a0d53b0799'),(2487,'Clients given 5f with poor adherence','Clients given 5f with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5f with poor adherence\n Clients given 5f with poor adherence\n \n 2023-08-17 14:45:30 UTC\n \n 2023-08-17 14:47:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2487\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:45:30',4,'2023-08-17 16:47:18',4,0,NULL,NULL,NULL,'8628ac34-e4de-44ad-bf49-0cd48799c0e0'),(2488,'Clients given 5f with fair adherence','Clients given 5f with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5f with fair adherence\n Clients given 5f with fair adherence\n \n 2023-08-17 14:47:44 UTC\n \n 2023-08-17 14:48:56 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2488\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:47:44',4,'2023-08-17 16:48:56',4,0,NULL,NULL,NULL,'05773449-f7c2-428e-b2d7-13d526846f6d'),(2489,'Clients given 5f with good adherence','Clients given 5f with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5f with good adherence\n Clients given 5f with good adherence\n \n 2023-08-17 14:48:23 UTC\n \n 2023-08-17 14:51:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2489\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:48:23',4,'2023-08-17 16:51:06',4,0,NULL,NULL,NULL,'0a2c5054-fcf0-46e8-94bd-150cc697fad7'),(2490,'Clients given 5g with poor adherence','Clients given 5g with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5g with poor adherence\n Clients given 5g with poor adherence\n \n 2023-08-17 14:51:41 UTC\n \n 2023-08-17 14:52:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2490\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:51:41',4,'2023-08-17 16:52:53',4,0,NULL,NULL,NULL,'92f0cb76-2f6b-4be0-b525-90c4d4665b90'),(2491,'Clients given 5g with fair adherence','Clients given 5g with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5g with fair adherence\n Clients given 5g with fair adherence\n \n 2023-08-17 14:54:10 UTC\n \n 2023-08-17 14:55:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2491\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:54:10',4,'2023-08-17 16:55:17',4,0,NULL,NULL,NULL,'d159ee3c-798c-4b94-ae55-f17634b6bd38'),(2492,'Clients given 5g with good adherence','Clients given 5g with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5g with good adherence\n Clients given 5g with good adherence\n \n 2023-08-17 14:55:50 UTC\n \n 2023-08-17 14:56:54 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2492\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:55:50',4,'2023-08-17 16:56:54',4,0,NULL,NULL,NULL,'2c0bc567-51cc-4892-a4ce-5266c8e9cf58'),(2493,'Clients given 5h with poor adherence','Clients given 5h with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5h with poor adherence\n Clients given 5h with poor adherence\n \n 2023-08-17 14:56:39 UTC\n \n 2023-08-17 14:58:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2493\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:56:39',4,'2023-08-17 16:58:17',4,0,NULL,NULL,NULL,'18332615-0cd2-4f3c-a2dd-537056310823'),(2494,'Clients given 5h with fair adherence','Clients given 5h with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5h with fair adherence\n Clients given 5h with fair adherence\n \n 2023-08-17 14:57:51 UTC\n \n 2023-08-17 14:59:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2494\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:57:51',4,'2023-08-17 16:59:12',4,0,NULL,NULL,NULL,'9bee8b12-d34c-4ec0-a136-cdc38d312f76'),(2495,'Clients given 5h with good adherence','Clients given 5h with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5h with good adherence\n Clients given 5h with good adherence\n \n 2023-08-17 14:59:01 UTC\n \n 2023-08-17 15:00:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2495\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:59:01',4,'2023-08-17 17:00:11',4,0,NULL,NULL,NULL,'8d2837ca-19e0-461e-8bde-fdee3e9f117c'),(2496,'Clients given 6a with poor adherence','Clients given 6a with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6a with poor adherence\n Clients given 6a with poor adherence\n \n 2023-08-17 15:00:41 UTC\n \n 2023-08-17 15:01:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2496\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:00:41',4,'2023-08-17 17:01:40',4,0,NULL,NULL,NULL,'25323965-1cc3-4c63-b997-5c6ff173ad1b'),(2497,'Clients given 6a with fair adherence','Clients given 6a with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6a with fair adherence\n Clients given 6a with fair adherence\n \n 2023-08-17 15:01:29 UTC\n \n 2023-08-17 15:03:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2497\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:01:29',4,'2023-08-17 17:03:14',4,0,NULL,NULL,NULL,'38990f18-eb9c-43ff-8323-96c3a6eb90c2'),(2498,'Clients given 6a with good adherence','Clients given 6a with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6a with good adherence\n Clients given 6a with good adherence\n \n 2023-08-17 15:02:51 UTC\n \n 2023-08-17 15:04:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2498\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:02:51',4,'2023-08-17 17:04:00',4,0,NULL,NULL,NULL,'2e00abe1-aed1-485e-858f-2a0baf0eaf3c'),(2499,'Clients given 6b with poor adherence','Clients given 6b with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6b with poor adherence\n Clients given 6b with poor adherence\n \n 2023-08-17 15:04:48 UTC\n \n 2023-08-17 15:06:13 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2499\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:04:48',4,'2023-08-17 17:06:13',4,0,NULL,NULL,NULL,'2452d808-0319-435c-8a68-0f849c38d53e'),(2500,'Clients given 6b with fair adherence','Clients given 6b with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6b with fair adherence\n Clients given 6b with fair adherence\n \n 2023-08-17 15:06:01 UTC\n \n 2023-08-17 15:08:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2500\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:06:01',4,'2023-08-17 17:08:42',4,0,NULL,NULL,NULL,'6a9e9b7e-3e06-4f47-9abb-ad685a5d86ca'),(2501,'Clients given 6b with good adherence','Clients given 6b with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6b with good adherence\n Clients given 6b with good adherence\n \n 2023-08-17 15:06:55 UTC\n \n 2023-08-17 15:09:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2501\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:06:55',4,'2023-08-17 17:09:06',4,0,NULL,NULL,NULL,'8340a9bc-f2fc-4a2d-ab84-74569dfe8a86'),(2502,'Clients given 6c with poor adherence','Clients given 6c with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6c with poor adherence\n Clients given 6c with poor adherence\n \n 2023-08-17 15:09:40 UTC\n \n 2023-08-17 15:11:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2502\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:09:40',4,'2023-08-17 17:11:01',4,0,NULL,NULL,NULL,'052f51db-d6e4-4078-9f3f-bed7d17b48bd'),(2503,'Clients given 6c with fair adherence','Clients given 6c with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6c with fair adherence\n Clients given 6c with fair adherence\n \n 2023-08-17 15:10:40 UTC\n \n 2023-08-17 15:12:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2503\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:10:40',4,'2023-08-17 17:12:06',4,0,NULL,NULL,NULL,'f8e62785-7303-493a-9c20-6c9f4280faf0'),(2504,'Clients given 6c with good adherence','Clients given 6c with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6c with good adherence\n Clients given 6c with good adherence\n \n 2023-08-17 15:11:54 UTC\n \n 2023-08-17 15:13:48 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2504\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:11:54',4,'2023-08-17 17:13:48',4,0,NULL,NULL,NULL,'9b361e36-e897-4212-8c7f-26121e595425'),(2505,'Clients given 6d with poor adherence','Clients given 6d with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6d with poor adherence\n Clients given 6d with poor adherence\n \n 2023-08-17 15:13:21 UTC\n \n 2023-08-17 15:15:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2505\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:13:21',4,'2023-08-17 17:15:04',4,0,NULL,NULL,NULL,'56b2509b-811c-4452-8432-5807792f207a'),(2506,'Clients given 6d with fair adherence','Clients given 6d with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6d with fair adherence\n Clients given 6d with fair adherence\n \n 2023-08-17 15:14:20 UTC\n \n 2023-08-17 15:16:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2506\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:14:20',4,'2023-08-17 17:16:21',4,0,NULL,NULL,NULL,'2808446d-305f-4bf7-b83b-3a5aad7cc119'),(2507,'Clients given 6d with good adherence','Clients given 6d with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6d with good adherence\n Clients given 6d with good adherence\n \n 2023-08-17 15:17:32 UTC\n \n 2023-08-17 15:17:52 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2507\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6d \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4703)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-17 17:17:32',4,'2023-08-17 17:17:52',4,0,NULL,NULL,NULL,'a10f7cfb-6012-4c2a-8f4f-f9ef7cdd8310'),(2508,'Clients given 6d with good adherence','Clients given 6d with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6d with good adherence\n Clients given 6d with good adherence\n \n 2023-08-17 15:18:32 UTC\n \n 2023-08-17 15:19:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2508\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:18:32',4,'2023-08-17 17:19:41',4,0,NULL,NULL,NULL,'e271c92e-f3e8-4218-a758-f2d91fd4173e'),(2509,'Clients given 6e with poor adherence','Clients given 6e with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6e with poor adherence\n Clients given 6e with poor adherence\n \n 2023-08-17 15:19:01 UTC\n \n 2023-08-17 15:20:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2509\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:19:01',4,'2023-08-17 17:20:53',4,0,NULL,NULL,NULL,'8c2c0191-d6e6-4f9c-a84d-976f24a47e5a'),(2510,'Clients given 6e with fair adherence','Clients given 6e with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6e with fair adherence\n Clients given 6e with fair adherence\n \n 2023-08-17 15:20:17 UTC\n \n 2023-08-17 15:22:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2510\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:20:17',4,'2023-08-17 17:22:00',4,0,NULL,NULL,NULL,'16552ea9-b4bb-4ae3-ae13-c04d366a5a72'),(2511,'Clients given 6e with good adherence','Clients given 6e with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6e with good adherence\n Clients given 6e with good adherence\n \n 2023-08-17 15:21:28 UTC\n \n 2023-08-17 15:23:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2511\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:21:28',4,'2023-08-17 17:23:08',4,0,NULL,NULL,NULL,'ca215c1b-6a15-42a3-b752-9ce21c651e13'),(2512,'Clients given 6f with poor adherence','Clients given 6f with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6f with poor adherence\n Clients given 6f with poor adherence\n \n 2023-08-17 15:22:56 UTC\n \n 2023-08-17 15:24:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2512\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:22:56',4,'2023-08-17 17:24:10',4,0,NULL,NULL,NULL,'ba0a85d0-9c18-49b9-8c42-417c8d96221c'),(2513,'Clients given 6f with fair adherence','Clients given 6f with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6f with fair adherence\n Clients given 6f with fair adherence\n \n 2023-08-17 15:23:41 UTC\n \n 2023-08-17 15:25:35 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2513\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:23:41',4,'2023-08-17 17:25:35',4,0,NULL,NULL,NULL,'7abe4ec4-ba33-4f66-97c3-33ffd356c478'),(2514,'Clients given 6f with good adherence','Clients given 6f with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6f with good adherence\n Clients given 6f with good adherence\n \n 2023-08-17 15:25:08 UTC\n \n 2023-08-17 15:27:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2514\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 17:25:08',4,'2023-08-17 17:27:07',4,0,NULL,NULL,NULL,'605e06e0-b274-46a5-8404-e45f6bdbf36d'),(2515,'Clients given 6B with <20 Copies Viral Load','Clients given 6B with <20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6B with <20 Copies Viral Load\n Clients given 6B with <20 Copies Viral Load\n \n 2023-08-17 16:05:27 UTC\n \n 2023-08-17 16:06:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2515\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 18:05:27',4,'2023-08-17 18:06:26',4,0,NULL,NULL,NULL,'57a592d4-f5a1-4ac8-afd9-dbabd8335120'),(2516,'Clients given 6B with Undetectable Viral Load','Clients given 6B with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6B with Undetectable Viral Load\n Clients given 6B with Undetectable Viral Load\n \n 2023-08-17 16:07:16 UTC\n \n 2023-08-17 17:13:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2516\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 18:07:16',4,'2023-08-17 19:13:12',4,0,NULL,NULL,NULL,'9a6c692c-675e-490a-827d-788308c41aa2'),(2517,'Clients given 6C with >=20 Copies Viral Load','Clients given 6C with >=20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C with >=20 Copies Viral Load\n Clients given 6C with >=20 Copies Viral Load\n \n 2023-08-17 16:09:20 UTC\n \n 2023-08-17 16:10:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2517\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 18:09:20',4,'2023-08-17 18:10:11',4,0,NULL,NULL,NULL,'2b0f18d1-d6bc-48db-81e9-139e7127a014'),(2518,'Clients given 6C with <20 Copies Viral Load','Clients given 6C with <20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C with <20 Copies Viral Load\n Clients given 6C with <20 Copies Viral Load\n \n 2023-08-17 16:11:36 UTC\n \n 2023-08-17 16:12:54 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2518\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 18:11:36',4,'2023-08-17 18:12:54',4,0,NULL,NULL,NULL,'b95e0670-059d-4690-986c-e7b162edc56a'),(2519,'Clients given 6C with Undetectable Viral Load','Clients given 6C with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C with Undetectable Viral Load\n Clients given 6C with Undetectable Viral Load\n \n 2023-08-17 16:13:36 UTC\n \n 2023-08-17 16:14:33 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2519\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 18:13:36',4,'2023-08-17 18:14:33',4,0,NULL,NULL,NULL,'ef772750-6723-46e8-b1cd-2c843e8dd384'),(2520,'Clients given 6D with >=20Copies Viral Load','Clients given 6D with >=20Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D with >=20Copies Viral Load\n Clients given 6D with >=20Copies Viral Load\n \n 2023-08-17 16:15:12 UTC\n \n 2023-08-17 16:16:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2520\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 18:15:12',4,'2023-08-17 18:16:15',4,0,NULL,NULL,NULL,'7067eaf1-d98c-4806-a595-c20526eb9695'),(2521,'Clients given 6D with <20 Copies Viral Load','Clients given 6D with <20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D with <20 Copies Viral Load\n Clients given 6D with <20 Copies Viral Load\n \n 2023-08-17 16:17:05 UTC\n \n 2023-08-17 16:18:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2521\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 18:17:05',4,'2023-08-17 18:18:05',4,0,NULL,NULL,NULL,'cc8e5238-6071-4a37-b946-f6e9bf94dd26'),(2522,'Clients given 6D with Undetectable Viral Load','Clients given 6D with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D with Undetectable Viral Load\n Clients given 6D with Undetectable Viral Load\n \n 2023-08-17 16:18:46 UTC\n \n 2023-08-17 16:19:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2522\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 18:18:46',4,'2023-08-17 18:19:45',4,0,NULL,NULL,NULL,'1df8beb0-cc67-496d-ba90-fa0dbc121691'),(2523,'Clients given 6E with >=20Copies Viral Load','Clients given 6E with >=20Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E with >=20Copies Viral Load\n Clients given 6E with >=20Copies Viral Load\n \n 2023-08-17 16:20:29 UTC\n \n 2023-08-17 16:21:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2523\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 18:20:29',4,'2023-08-17 18:21:30',4,0,NULL,NULL,NULL,'6462e250-cf41-469a-83d7-e8b085ae587d'),(2524,'Clients given 6E with <20 Copies Viral Load','Clients given 6E with <20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E with <20 Copies Viral Load\n Clients given 6E with <20 Copies Viral Load\n \n 2023-08-17 16:22:10 UTC\n \n 2023-08-17 16:24:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2524\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 18:22:10',4,'2023-08-17 18:24:14',4,0,NULL,NULL,NULL,'3492f4eb-af9b-448f-b4f1-fe314ce449f1'),(2525,'Children ARV Regimen_3rdLine_Adherence','Children ARV Regimen_3rdLine_Adherence','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_Adherence\n Children ARV Regimen_3rdLine_Adherence\n \n 2023-08-17 16:26:16 UTC\n \n 2023-08-17 16:26:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2525\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-17 18:26:16',4,'2023-08-17 18:26:28',4,0,NULL,NULL,NULL,'3262e4c0-f728-4cc8-ac30-b7413a14a644'),(2526,'Children ARV Regimen_3rdLine_Adherence Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_Adherence Data Set\n \n 2023-08-17 16:26:28 UTC\n \n 2023-08-17 16:38:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2526\n \n \n \n 6A_fair\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n \n \n 6A_good\n \n \n \n \n \n \n \n \n \n 6A_poor\n \n \n \n \n \n \n \n \n \n 6B_fair\n \n \n \n \n \n \n \n \n \n 6B_good\n \n \n \n \n \n \n \n \n \n 6B_poor\n \n \n \n \n \n \n \n \n \n 6C_fair\n \n \n \n \n \n \n \n \n \n 6C_good\n \n \n \n \n \n \n \n \n \n 6C_poor\n \n \n \n \n \n \n \n \n \n 6D_fair\n \n \n \n \n \n \n \n \n \n 6D_good\n \n \n \n \n \n \n \n \n \n 6D_poor\n \n \n \n \n \n \n \n \n \n 6E_fair\n \n \n \n \n \n \n \n \n \n 6E_good\n \n \n \n \n \n \n \n \n \n 6E_poor\n \n \n \n \n \n \n \n \n \n 6F_fair\n \n \n \n \n \n \n \n \n \n 6F_good\n \n \n \n \n \n \n \n \n \n 6F_poor\n \n \n \n \n \n \n \n \n \n','2023-08-17 18:26:28',4,'2023-08-17 18:38:11',4,0,NULL,NULL,NULL,'9011d1b7-91da-465d-a4c7-38ea98126d13'),(2527,'Children ARV Regimen_2ndLine_Adherence','Children ARV Regimen_2ndLine_Adherence','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_Adherence\n Children ARV Regimen_2ndLine_Adherence\n \n 2023-08-17 16:40:24 UTC\n \n 2023-08-17 16:40:35 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2527\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-17 18:40:24',4,'2023-08-17 18:40:35',4,0,NULL,NULL,NULL,'ab24cc2a-a3ac-43a7-91c6-65bc90b27ae4'),(2528,'Children ARV Regimen_2ndLine_Adherence Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_Adherence Data Set\n \n 2023-08-17 16:40:35 UTC\n \n 2023-08-17 16:59:47 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2528\n \n \n \n 5A_fair\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n \n \n 5A_good\n \n \n \n \n \n \n \n \n \n 5A_poor\n \n \n \n \n \n \n \n \n \n 5B_fair\n \n \n \n \n \n \n \n \n \n 5B_good\n \n \n \n \n \n \n \n \n \n 5B_poor\n \n \n \n \n \n \n \n \n \n 5C_fair\n \n \n \n \n \n \n \n \n \n 5C_good\n \n \n \n \n \n \n \n \n \n 5C_poor\n \n \n \n \n \n \n \n \n \n 5D_fair\n \n \n \n \n \n \n \n \n \n 5D_good\n \n \n \n \n \n \n \n \n \n 5D_poor\n \n \n \n \n \n \n \n \n \n 5E_fair\n \n \n \n \n \n \n \n \n \n 5E_good\n \n \n \n \n \n \n \n \n \n 5E_poor\n \n \n \n \n \n \n \n \n \n 5F_fair\n \n \n \n \n \n \n \n \n \n 5F_good\n \n \n \n \n \n \n \n \n \n 5F_poor\n \n \n \n \n \n \n \n \n \n 5G_fair\n \n \n \n \n \n \n \n \n \n 5G_good\n \n \n \n \n \n \n \n \n \n 5G_poor\n \n \n \n \n \n \n \n \n \n 5H_fair\n \n \n \n \n \n \n \n \n \n 5H_good\n \n \n \n \n \n \n \n \n \n 5H_poor\n \n \n \n \n \n \n \n \n \n','2023-08-17 18:40:35',4,'2023-08-17 18:59:47',4,0,NULL,NULL,NULL,'63956153-c9e8-480d-b057-96de951cf024'),(2529,'Clients given 6E with Undetectable Viral Load','Clients given 6E with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E with Undetectable Viral Load\n Clients given 6E with Undetectable Viral Load\n \n 2023-08-17 16:48:58 UTC\n \n 2023-08-17 16:50:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2529\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 18:48:58',4,'2023-08-17 18:50:03',4,0,NULL,NULL,NULL,'836381fd-7adf-42ba-8ab4-01e9259a41f5'),(2530,'Clients given 6F with >=20Copies Viral Load','Clients given 6F with >=20Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F with >=20Copies Viral Load\n Clients given 6F with >=20Copies Viral Load\n \n 2023-08-17 16:51:45 UTC\n \n 2023-08-17 16:53:52 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2530\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 18:51:45',4,'2023-08-17 18:53:52',4,0,NULL,NULL,NULL,'b8f0e53a-22a7-40e9-a9e6-e7ce266d4a19'),(2531,'Clients given 6F with <20 Copies Viral Load','Clients given 6F with <20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F with <20 Copies Viral Load\n Clients given 6F with <20 Copies Viral Load\n \n 2023-08-17 16:55:01 UTC\n \n 2023-08-17 16:58:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2531\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 18:55:01',4,'2023-08-17 18:58:01',4,0,NULL,NULL,NULL,'b820ee3d-d805-468d-b7b4-2d1c5ce10a92'),(2532,'Children ARV Regimen_3rdLine_Viral_Load','Children ARV Regimen_3rdLine_Viral_Load','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_Viral_Load\n Children ARV Regimen_3rdLine_Viral_Load\n \n 2023-08-17 16:58:13 UTC\n \n 2023-08-17 16:58:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2532\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-17 18:58:13',4,'2023-08-17 18:58:43',4,0,NULL,NULL,NULL,'72eeaaa5-8c87-4939-a657-99b15cc3ab35'),(2533,'Children ARV Regimen_3rdLine_Viral_Load Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_Viral_Load Data Set\n \n 2023-08-17 16:58:43 UTC\n \n 2023-08-17 17:29:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2533\n \n \n \n 6A<20\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n \n \n 6A>=20\n \n \n \n \n \n \n \n \n \n 6AUndetect\n \n \n \n \n \n \n \n \n \n 6B<20\n \n \n \n \n \n \n \n \n \n 6B>=20\n \n \n \n \n \n \n \n \n \n 6BUndetect\n \n \n \n \n \n \n \n \n \n 6C<20\n \n \n \n \n \n \n \n \n \n 6C>=20\n \n \n \n \n \n \n \n \n \n 6CUndetect\n \n \n \n \n \n \n \n \n \n 6D<20\n \n \n \n \n \n \n \n \n \n 6D>=20\n \n \n \n \n \n \n \n \n \n 6DUndetect\n \n \n \n \n \n \n \n \n \n 6E<20\n \n \n \n \n \n \n \n \n \n 6E>=20\n \n \n \n \n \n \n \n \n \n 6EUndetect\n \n \n \n \n \n \n \n \n \n 6F<20\n \n \n \n \n \n \n \n \n \n 6F>=20\n \n \n \n \n \n \n \n \n \n 6FUndetect\n \n \n \n \n \n \n \n \n \n','2023-08-17 18:58:43',4,'2023-08-17 19:29:02',4,0,NULL,NULL,NULL,'0a51f76b-0306-47fa-947d-55305024054a'),(2534,'Clients given 6F with Undetectable Viral Load','Clients given 6F with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F with Undetectable Viral Load\n Clients given 6F with Undetectable Viral Load\n \n 2023-08-17 16:59:07 UTC\n \n 2023-08-17 17:02:35 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2534\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 18:59:07',4,'2023-08-17 19:02:35',4,0,NULL,NULL,NULL,'b1f06b90-64db-4554-8e81-989e206ed34a'),(2535,'Children ARV Regimen_2ndLine_Viral_Load','Children ARV Regimen_2ndLine_Viral_Load','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_Viral_Load\n Children ARV Regimen_2ndLine_Viral_Load\n \n 2023-08-17 17:06:27 UTC\n \n 2023-08-17 17:06:48 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2535\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-17 19:06:27',4,'2023-08-17 19:06:48',4,0,NULL,NULL,NULL,'701df245-5766-4e37-9d54-89e6ecedb217'),(2536,'Children ARV Regimen_2ndLine_Viral_Load Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_Viral_Load Data Set\n \n 2023-08-17 17:06:48 UTC\n \n 2023-08-17 17:26:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2536\n \n \n \n 5A_Undetec\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n \n \n 5A<20\n \n \n \n \n \n \n \n \n \n 5A>=20\n \n \n \n \n \n \n \n \n \n 5B_Undetec\n \n \n \n \n \n \n \n \n \n 5B<20\n \n \n \n \n \n \n \n \n \n 5B>=20\n \n \n \n \n \n \n \n \n \n 5C_Undetec\n \n \n \n \n \n \n \n \n \n 5C<20\n \n \n \n \n \n \n \n \n \n 5C>=20\n \n \n \n \n \n \n \n \n \n 5E_Undetec\n \n \n \n \n \n \n \n \n \n 5E<20\n \n \n \n \n \n \n \n \n \n 5E>=20\n \n \n \n \n \n \n \n \n \n 5F_Undetec\n \n \n \n \n \n \n \n \n \n 5F<20\n \n \n \n \n \n \n \n \n \n 5F>=20\n \n \n \n \n \n \n \n \n \n 5G_Undetec\n \n \n \n \n \n \n \n \n \n 5G<20\n \n \n \n \n \n \n \n \n \n 5G>=20\n \n \n \n \n \n \n \n \n \n 5H_Undetec\n \n \n \n \n \n \n \n \n \n 5H<20\n \n \n \n \n \n \n \n \n \n 5H>=20\n \n \n \n \n \n \n \n \n \n','2023-08-17 19:06:48',4,'2023-08-17 19:26:20',4,0,NULL,NULL,NULL,'2790255e-587f-411d-9f8a-dbca36aa7e0d'),(2537,'ART clients with visits started','ART clients with visits started','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n ART clients with visits started\n ART clients with visits started\n \n 2023-09-21 12:40:58 UTC\n \n 2024-02-06 12:32:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2537\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1, 2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id and vt.visit_type_id in (10,19) \n JOIN obs o on o.encounter_id=en.encounter_id \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 18:10:58',4,'2024-02-06 18:02:59',4,0,NULL,NULL,NULL,'5de36ef7-faa8-422d-943d-fdd6ad3497a0'),(2538,'ART clients with visits consulted','ART clients with visits consulted','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n ART clients with visits consulted\n ART clients with visits consulted\n \n 2023-09-21 12:41:53 UTC\n \n 2024-02-06 12:38:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2538\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id and vt.visit_type_id in (10,19) \n JOIN obs o on o.encounter_id=en.encounter_id \n and o.concept_id in (3843, 4276) and o.voided =0 \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 18:11:53',4,'2024-02-06 18:08:12',4,0,NULL,NULL,NULL,'9340a449-ab16-4a98-8dcb-240635a9042d'),(2539,'Clients initiated on ART this month','Clients initiated on ART this month','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients initiated on ART this month\n Clients initiated on ART this month\n \n 2023-09-21 12:42:21 UTC\n \n 2024-02-06 10:21:22 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2539\n select distinct patient.patient_id AS Id \n \n from obs o \n -- CLIENTS NEWLY INITIATED ON ART \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND (o.concept_id = 2249 \n \n AND CAST(o.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n AND patient.voided = 0 AND o.voided = 0 \n AND o.person_id not in ( \n select distinct os.person_id from obs os \n where os.concept_id = 3634 \n AND os.value_coded = 2095 \n and os.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and o.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages'\n','2023-09-21 18:12:21',4,'2024-02-06 15:51:22',4,0,NULL,NULL,NULL,'d3e386aa-99a9-4463-9e81-f663ca35cad2'),(2540,'TB clients with visits started','TB clients with visits started','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB clients with visits started\n TB clients with visits started\n \n 2023-09-21 12:42:50 UTC\n \n 2023-09-21 12:43:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2540\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id \n JOIN obs o on o.encounter_id=en.encounter_id \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n and v.visit_type_id = 13 \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 14:42:50',4,'2023-09-21 14:43:05',4,0,NULL,NULL,NULL,'e6d2d518-2160-4fc8-84dc-a680c609b27f'),(2541,'TB clients with visits consulted','TB clients with visits consulted','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB clients with visits consulted\n TB clients with visits consulted\n \n 2023-09-21 12:44:18 UTC\n \n 2023-09-21 12:45:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2541\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id \n JOIN obs o on o.encounter_id=en.encounter_id \n and o.concept_id in (4153,1158) and o.voided =0 \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n and v.visit_type_id = 13 \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 14:44:18',4,'2023-09-21 14:45:05',4,0,NULL,NULL,NULL,'d205535e-f890-488a-a256-a69835a9a9d8'),(2542,'HTS Clients Seen','HTS Clients Seen','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HTS Clients Seen\n HTS Clients Seen\n \n 2023-09-21 12:45:02 UTC\n \n 2023-09-21 12:45:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2542\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in( \nSELECT Id \nFROM ( \n select distinct o.person_id as Id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n where o.concept_id = 4845 and o.value_coded = 4847 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n ) as A \n)\n','2023-09-21 14:45:02',4,'2023-09-21 14:45:39',4,0,NULL,NULL,NULL,'ce0fbba8-f81e-4f15-9da5-b341fd68b611'),(2543,'HTS clients with visits started','HTS clients with visits started','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HTS clients with visits started\n HTS clients with visits started\n \n 2023-09-21 12:45:52 UTC\n \n 2023-09-21 12:46:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2543\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id \n JOIN obs o on o.encounter_id=en.encounter_id \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n and v.visit_type_id = 15 \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 14:45:52',4,'2023-09-21 14:46:05',4,0,NULL,NULL,NULL,'fe7fb845-5325-4d00-8cab-7041e6759f04'),(2544,'1st Postnatal (PNC) Attendance','1st Postnatal (PNC) Attendance','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n 1st Postnatal (PNC) Attendance\n 1st Postnatal (PNC) Attendance\n \n 2023-09-21 12:46:47 UTC\n \n 2023-09-21 12:47:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2544\n select \n o.person_id \nfrom obs o \ninner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as examination_timing \n from obs oss \n where oss.concept_id = 4393 and oss.voided=0 \n and cast(oss.obs_datetime as date) >= cast(:startDate as date) \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where concept_id = 4393 \n and o.obs_datetime = max_observation\n','2023-09-21 14:46:47',4,'2023-09-21 14:47:10',4,0,NULL,NULL,NULL,'290d3497-9608-4796-9826-1dc624696dbd'),(2545,'HTS clients with visits consulted','HTS clients with visits consulted','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HTS clients with visits consulted\n HTS clients with visits consulted\n \n 2023-09-21 12:47:27 UTC\n \n 2023-09-21 12:47:54 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2545\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id \n JOIN obs o on o.encounter_id=en.encounter_id \n and o.concept_id = 4238 and o.voided =0 \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n and v.visit_type_id = 15 \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 14:47:27',4,'2023-09-21 14:47:54',4,0,NULL,NULL,NULL,'35051ec1-423c-4ede-a68f-88e94f2dc6a2'),(2546,'Self test Kits distributed','Self test Kits distributed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Self test Kits distributed\n Self test Kits distributed\n \n 2023-09-21 12:48:21 UTC\n \n 2023-09-21 12:48:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2546\n (select patient.patient_id AS Id \n from obs o \n -- HTS SELF TEST STRATEGY \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n AND o.concept_id = 4833 and o.value_coded = 4834 \n AND patient.voided = 0 AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n ) \n \nUNION ALL \n(select patient.patient_id AS Id \n from obs o \n -- HTS SELF TEST STRATEGY \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n AND o.concept_id = 4836 and o.value_coded in (4837, 4838, 4839) \n AND patient.voided = 0 AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n )\n','2023-09-21 14:48:21',4,'2023-09-21 14:48:36',4,0,NULL,NULL,NULL,'4ef31fd0-53cc-4296-adc1-1b74455e2a5f'),(2547,'ANC clients with visits started','ANC clients with visits started','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n ANC clients with visits started\n ANC clients with visits started\n \n 2023-09-21 12:49:04 UTC\n \n 2023-09-21 12:49:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2547\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id \n JOIN obs o on o.encounter_id=en.encounter_id \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n and v.visit_type_id = 16 \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 14:49:04',4,'2023-09-21 14:49:44',4,0,NULL,NULL,NULL,'928922c7-633f-4cb0-9149-88ae7e50e237'),(2548,'Under5 Clients Seen','Under5 Clients Seen','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Under5 Clients Seen\n Under5 Clients Seen\n \n 2023-09-21 12:49:57 UTC\n \n 2023-09-21 12:50:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2548\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in( \nSELECT Id \nFROM ( \n select distinct o.person_id as Id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n where o.concept_id = 4285 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n ) as A \n)\n','2023-09-21 14:49:57',4,'2023-09-21 14:50:12',4,0,NULL,NULL,NULL,'93a89f3f-f556-4592-b12e-cf8849d58b58'),(2549,'ANC clients with visits consulted','ANC clients with visits consulted','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n ANC clients with visits consulted\n ANC clients with visits consulted\n \n 2023-09-21 12:50:25 UTC\n \n 2023-09-21 12:51:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2549\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id \n JOIN obs o on o.encounter_id=en.encounter_id \n and o.concept_id = 4663 and o.voided =0 \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n and v.visit_type_id = 16 \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 14:50:25',4,'2023-09-21 14:51:08',4,0,NULL,NULL,NULL,'ab0560b8-8a8b-4759-983b-d3b0d69afafa'),(2550,'HEI Clients Seen','HEI Clients Seen','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HEI Clients Seen\n HEI Clients Seen\n \n 2023-09-21 12:51:29 UTC\n \n 2024-02-06 12:40:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2550\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in( \nSELECT Id \nFROM ( \n select distinct o.person_id as Id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n where o.concept_id in (4189,4558) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n ) as A \n)\n','2023-09-21 18:21:29',4,'2024-02-06 18:10:40',4,0,NULL,NULL,NULL,'f8e02920-02de-4c2b-9b44-6974b937b51c'),(2551,'PNC clients with visits started','PNC clients with visits started','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PNC clients with visits started\n PNC clients with visits started\n \n 2023-09-21 12:51:49 UTC\n \n 2023-09-21 12:52:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2551\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id \n JOIN obs o on o.encounter_id=en.encounter_id \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n and v.visit_type_id = 17 \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 14:51:49',4,'2023-09-21 14:52:21',4,0,NULL,NULL,NULL,'dddf7e03-38fe-419f-81a4-625dabb0fd4e'),(2552,'Family Planning Clients seen','Family Planning Clients seen','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Family Planning Clients seen\n Family Planning Clients seen\n \n 2023-09-21 12:52:28 UTC\n \n 2023-09-21 12:52:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2552\n select \n o.person_id \nfrom obs o \ninner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as examination_timing \n from obs oss \n where oss.concept_id = 4557 and oss.voided=0 \n and cast(oss.obs_datetime as date) >= cast(:startDate as date) \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where concept_id = 4557 \n and o.obs_datetime = max_observation\n','2023-09-21 14:52:28',4,'2023-09-21 14:52:43',4,0,NULL,NULL,NULL,'287d14af-8d53-48d0-8cf4-47f141b0e9ea'),(2553,'PNC clients with visits consulted','PNC clients with visits consulted','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PNC clients with visits consulted\n PNC clients with visits consulted\n \n 2023-09-21 12:52:50 UTC\n \n 2023-09-21 12:53:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2553\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id \n JOIN obs o on o.encounter_id=en.encounter_id \n and o.concept_id = 4386 and o.voided =0 \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n and v.visit_type_id = 17 \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 14:52:50',4,'2023-09-21 14:53:03',4,0,NULL,NULL,NULL,'bf6795b4-6d7f-49bd-aff7-53781f102898'),(2554,'Cervical Cancer Screening clients seen','Cervical Cancer Screening clients seen','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Cervical Cancer Screening clients seen\n Cervical Cancer Screening clients seen\n \n 2023-09-21 12:53:29 UTC\n \n 2023-10-17 13:11:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2554\n select \n o.person_id \nfrom obs o \ninner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as examination_timing \n from obs oss \n where oss.concept_id = 4511 and oss.voided=0 \n and cast(oss.obs_datetime as date) >= cast(:startDate as date) \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where concept_id = 4511 \n and o.obs_datetime = max_observation\n','2023-09-21 18:23:29',4,'2023-10-17 18:41:36',4,0,NULL,NULL,NULL,'f436cc71-62c7-413d-81b3-0f6bbad88a73'),(2555,'HEI clients with visits started','HEI clients with visits started','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HEI clients with visits started\n HEI clients with visits started\n \n 2023-09-21 12:54:17 UTC\n \n 2023-09-21 12:54:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2555\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id \n JOIN obs o on o.encounter_id=en.encounter_id \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n and v.visit_type_id = 18 \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 14:54:17',4,'2023-09-21 14:54:29',4,0,NULL,NULL,NULL,'e26ba5ce-54c6-4693-8f0c-52aae22ce97b'),(2556,'ANC Clients Seen','ANC Clients Seen','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n ANC Clients Seen\n ANC Clients Seen\n \n 2023-09-21 12:54:42 UTC\n \n 2023-09-21 12:54:57 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2556\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in( \nSELECT Id \nFROM ( \n select distinct o.person_id as Id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n where o.concept_id = 4663 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n ) as A \n)\n','2023-09-21 14:54:42',4,'2023-09-21 14:54:57',4,0,NULL,NULL,NULL,'f58dd29e-bfcf-411a-a5fa-789722177fd1'),(2557,'HEI clients with visits consulted','HEI clients with visits consulted','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HEI clients with visits consulted\n HEI clients with visits consulted\n \n 2023-09-21 12:55:13 UTC\n \n 2023-09-21 12:56:33 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2557\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id \n JOIN obs o on o.encounter_id=en.encounter_id \n and o.concept_id in (4558, 4186) and o.voided =0 \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n and v.visit_type_id = 18 \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 14:55:13',4,'2023-09-21 14:56:33',4,0,NULL,NULL,NULL,'2bcc29bb-b22f-4866-8035-f7f1db1ead87'),(2558,'ANC Clients Seen','ANC Clients Seen','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n ANC Clients Seen\n ANC Clients Seen\n \n 2023-09-21 12:55:47 UTC\n \n 2023-09-21 12:56:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2558\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 14:55:47',4,'2023-09-21 14:56:41',4,0,NULL,NULL,NULL,'7006c9eb-caa2-4617-9151-d6872b35e3a1'),(2559,'Cervical Cancer Screening clients seen','Cervical Cancer Screening clients seen','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Cervical Cancer Screening clients seen\n Cervical Cancer Screening clients seen\n \n 2023-09-21 12:57:08 UTC\n \n 2023-09-21 12:57:52 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2559\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 14:57:08',4,'2023-09-21 14:57:52',4,0,NULL,NULL,NULL,'697c637f-d0ae-45a2-9eab-f4f9012c2412'),(2560,'Family Planning clients with visits started','Family Planning clients with visits started','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Family Planning clients with visits started\n Family Planning clients with visits started\n \n 2023-09-21 12:57:35 UTC\n \n 2023-09-21 12:57:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2560\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id \n JOIN obs o on o.encounter_id=en.encounter_id \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n and v.visit_type_id = 22 \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 14:57:35',4,'2023-09-21 14:57:59',4,0,NULL,NULL,NULL,'a713664a-9547-4de1-bcea-eab77e351ec5'),(2561,'Family Planning Clients seen','Family Planning Clients seen','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Family Planning Clients seen\n Family Planning Clients seen\n \n 2023-09-21 12:58:35 UTC\n \n 2023-09-21 12:59:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2561\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 14:58:35',4,'2023-09-21 14:59:30',4,0,NULL,NULL,NULL,'4934d5cb-a141-4144-9937-59b8bb142789'),(2562,'Family Planning clients with visits consulted','Family Planning clients with visits consulted','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Family Planning clients with visits consulted\n Family Planning clients with visits consulted\n \n 2023-09-21 12:58:46 UTC\n \n 2023-09-21 12:59:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2562\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id \n JOIN obs o on o.encounter_id=en.encounter_id \n and o.concept_id = 4557 and o.voided =0 \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n and v.visit_type_id = 22 \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 14:58:46',4,'2023-09-21 14:59:18',4,0,NULL,NULL,NULL,'ada60155-c22d-4ad4-b960-45bb814acd47'),(2563,'HEI Clients Seen','HEI Clients Seen','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HEI Clients Seen\n HEI Clients Seen\n \n 2023-09-21 12:59:50 UTC\n \n 2023-09-21 13:00:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2563\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 14:59:50',4,'2023-09-21 15:00:32',4,0,NULL,NULL,NULL,'8f5713d9-1797-48ed-92ba-7a6bbc3f02be'),(2564,'Under 5 clients with visits started','Under 5 clients with visits started','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Under 5 clients with visits started\n Under 5 clients with visits started\n \n 2023-09-21 12:59:58 UTC\n \n 2023-09-21 13:00:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2564\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id \n JOIN obs o on o.encounter_id=en.encounter_id \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n and v.visit_type_id = 20 \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 14:59:58',4,'2023-09-21 15:00:12',4,0,NULL,NULL,NULL,'b569e5c1-aab8-4a67-955c-b09d0c5c1b6b'),(2565,'Under 5 clients with visits consulted','Under 5 clients with visits consulted','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Under 5 clients with visits consulted\n Under 5 clients with visits consulted\n \n 2023-09-21 13:00:57 UTC\n \n 2023-09-21 13:01:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2565\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id \n JOIN obs o on o.encounter_id=en.encounter_id \n and o.concept_id = 4285 and o.voided =0 \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n and v.visit_type_id = 20 \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 15:00:57',4,'2023-09-21 15:01:12',4,0,NULL,NULL,NULL,'ae2b5eee-422b-4307-a985-7bd763147582'),(2566,'HTS Clients Seen','HTS Clients Seen','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HTS Clients Seen\n HTS Clients Seen\n \n 2023-09-21 13:00:59 UTC\n \n 2023-09-21 13:01:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2566\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:00:59',4,'2023-09-21 15:01:59',4,0,NULL,NULL,NULL,'198319c7-6986-4599-8b2a-886ed81d7c37'),(2567,'1st Postnatal (PNC) Attendance','1st Postnatal (PNC) Attendance','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n 1st Postnatal (PNC) Attendance\n 1st Postnatal (PNC) Attendance\n \n 2023-09-21 13:01:44 UTC\n \n 2023-09-21 13:02:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2567\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:01:44',4,'2023-09-21 15:02:26',4,0,NULL,NULL,NULL,'07589d1a-d289-491c-a8dd-ac6e506b6eca'),(2568,'Cervical Cancer Screening clients with visits started','Cervical Cancer Screening clients with visits started','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Cervical Cancer Screening clients with visits started\n Cervical Cancer Screening clients with visits started\n \n 2023-09-21 13:02:00 UTC\n \n 2023-09-21 13:02:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2568\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id \n JOIN obs o on o.encounter_id=en.encounter_id \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n and v.visit_type_id = 21 \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 15:02:00',4,'2023-09-21 15:02:14',4,0,NULL,NULL,NULL,'4f7cc18d-1104-4427-b582-f73b99bd0837'),(2569,'Self test Kits distributed','Self test Kits distributed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Self test Kits distributed\n Self test Kits distributed\n \n 2023-09-21 13:02:50 UTC\n \n 2023-09-21 13:04:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2569\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:02:50',4,'2023-09-21 15:04:03',4,0,NULL,NULL,NULL,'5cc879f5-78be-4f74-9cd0-06ae596deffe'),(2570,'Cervical Cancer Screening clients with visits consulted','Cervical Cancer Screening clients with visits consulted','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Cervical Cancer Screening clients with visits consulted\n Cervical Cancer Screening clients with visits consulted\n \n 2023-09-21 13:02:56 UTC\n \n 2023-09-21 13:03:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2570\n select distinct o.person_id \nfrom obs o \nwhere o.person_id in \n ( \n SELECT DISTINCT p.person_id as id \n FROM visit v \n JOIN person_name pn on v.patient_id = pn.person_id and pn.voided=0 \n JOIN person p on p.person_id = v.patient_id \n JOIN encounter en on en.visit_id = v.visit_id and en.voided=0 and en.encounter_type in (1,2) \n JOIN visit_type vt on vt.visit_type_id = vt.visit_type_id \n JOIN obs o on o.encounter_id=en.encounter_id \n and o.concept_id = 4511 and o.voided =0 \n JOIN location l on v.location_id = l.location_id and l.retired=0 \n WHERE CAST(en.encounter_datetime AS DATE) >= CAST(:startDate AS DATE) and CAST(en.encounter_datetime AS DATE)<= CAST(:endDate AS DATE) \n and v.visit_type_id = 21 \n and (v.location_id = :location or parent_location = :location) \n \n )\n','2023-09-21 15:02:56',4,'2023-09-21 15:03:08',4,0,NULL,NULL,NULL,'cf21c6a3-0a19-44c7-b2c7-e14246d7bc96'),(2571,'Under5 Clients Seen','Under5 Clients Seen','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Under5 Clients Seen\n Under5 Clients Seen\n \n 2023-09-21 13:03:36 UTC\n \n 2023-09-21 13:05:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2571\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:03:36',4,'2023-09-21 15:05:20',4,0,NULL,NULL,NULL,'d8654256-acae-40b0-a3c2-feafeb2f36ad'),(2572,'eRegister Monitoring Report','eRegister Monitoring Report','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n eRegister Monitoring Report\n eRegister Monitoring Report\n \n 2023-09-21 13:06:13 UTC\n \n 2023-09-21 13:26:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2572\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-09-21 15:06:13',4,'2023-09-21 15:26:06',4,0,NULL,NULL,NULL,'a9290709-3dd9-4bfe-823d-b1702d10ec0f'),(2573,'eRegister Monitoring Report Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n eRegister Monitoring Report Data Set\n \n 2023-09-21 13:06:21 UTC\n \n 2023-09-22 08:47:46 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2573\n \n \n \n ANC_Consul\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n \n \n ANC_Seen\n \n \n \n \n \n \n \n \n \n ANC_Visits\n \n \n \n \n \n \n \n \n \n ART_Consul\n \n \n \n \n \n \n \n \n \n ART_Visits\n \n \n \n \n \n \n \n \n \n Cerv_Consu\n \n \n \n \n \n \n \n \n \n Cerv_Scree\n \n \n \n \n \n \n \n \n \n Cerv_Visit\n \n \n \n \n \n \n \n \n \n ClntsOnArt\n \n \n \n \n \n \n \n \n \n FP_Consult\n \n \n \n \n \n \n \n \n \n FP_Seen\n \n \n \n \n \n \n \n \n \n FP_Visits\n \n \n \n \n \n \n \n \n \n HEI_Consul\n \n \n \n \n \n \n \n \n \n HEI_Seen\n \n \n \n \n \n \n \n \n \n HEI_Visits\n \n \n \n \n \n \n \n \n \n HTS_Consul\n \n \n \n \n \n \n \n \n \n HTS_Seen\n \n \n \n \n \n \n \n \n \n HTS_Visits\n \n \n \n \n \n \n \n \n \n LTest_Rev\n \n \n \n \n \n \n \n \n \n LTest_Sent\n \n \n \n \n \n \n \n \n \n PNC_Attend\n \n \n \n \n \n \n \n \n \n PNC_Consul\n \n \n \n \n \n \n \n \n \n PNC_Visits\n \n \n \n \n \n \n \n \n \n Self_tes_D\n \n \n \n \n \n \n \n \n \n TB_Consult\n \n \n \n \n \n \n \n \n \n TB_Visits\n \n \n \n \n \n \n \n \n \n Tx_New\n \n \n \n \n \n \n \n \n \n Under5_Con\n \n \n \n \n \n \n \n \n \n Under5_See\n \n \n \n \n \n \n \n \n \n Under5_Vis\n \n \n \n \n \n \n \n \n \n','2023-09-21 13:06:21',4,'2023-09-22 08:47:46',4,0,NULL,NULL,NULL,'a971d8e2-a66a-487c-aae4-36c6f14a3328'),(2574,' ANC clients with visits started',' ANC clients with visits started','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n ANC clients with visits started\n ANC clients with visits started\n \n 2023-09-21 13:07:00 UTC\n \n 2023-09-21 13:07:46 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2574\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:07:00',4,'2023-09-21 15:07:46',4,0,NULL,NULL,NULL,'69485106-52a5-452e-91ef-6ecf80894a7f'),(2575,'ART clients with visits consulted','ART clients with visits consulted','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n ART clients with visits consulted\n ART clients with visits consulted\n \n 2023-09-21 13:08:16 UTC\n \n 2023-09-21 13:08:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2575\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:08:16',4,'2023-09-21 15:08:50',4,0,NULL,NULL,NULL,'7cce44cb-0809-4493-84bb-2fdbe745ceab'),(2576,'ART clients with visits started','ART clients with visits started','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n ART clients with visits started\n ART clients with visits started\n \n 2023-09-21 13:09:47 UTC\n \n 2023-09-21 13:11:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2576\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:09:47',4,'2023-09-21 15:11:10',4,0,NULL,NULL,NULL,'a5551436-00f8-45c4-aa3b-6aaae3160f55'),(2577,'Clients initiated on ART this month','Clients initiated on ART this month','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients initiated on ART this month\n Clients initiated on ART this month\n \n 2023-09-21 13:11:24 UTC\n \n 2023-09-21 13:12:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2577\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:11:24',4,'2023-09-21 15:12:20',4,0,NULL,NULL,NULL,'e6b92d7a-5f7e-4001-957e-30b6be452168'),(2578,'ANC clients with visits consulted','ANC clients with visits consulted','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n ANC clients with visits consulted\n ANC clients with visits consulted\n \n 2023-09-21 13:11:45 UTC\n \n 2023-09-21 13:12:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2578\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:11:45',4,'2023-09-21 15:12:58',4,0,NULL,NULL,NULL,'5c7fcfb9-3d39-4225-a4f3-8ed358e16626'),(2579,'TB clients with visits started','TB clients with visits started','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB clients with visits started\n TB clients with visits started\n \n 2023-09-21 13:13:10 UTC\n \n 2023-09-21 13:13:56 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2579\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:13:10',4,'2023-09-21 15:13:56',4,0,NULL,NULL,NULL,'09767de3-79b3-43e2-82da-339278f5e10d'),(2580,'TB clients with visits consulted','TB clients with visits consulted','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB clients with visits consulted\n TB clients with visits consulted\n \n 2023-09-21 13:14:13 UTC\n \n 2023-09-21 13:16:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2580\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:14:13',4,'2023-09-21 15:16:03',4,0,NULL,NULL,NULL,'d4ae74d3-d618-4e3b-8d10-4c54e5f3b75a'),(2581,'HTS clients with visits started','HTS clients with visits started','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HTS clients with visits started\n HTS clients with visits started\n \n 2023-09-21 13:16:45 UTC\n \n 2023-09-21 13:17:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2581\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:16:45',4,'2023-09-21 15:17:18',4,0,NULL,NULL,NULL,'91f470f1-71bf-4a21-bd12-efe0fe142c0a'),(2582,'HTS clients with visits consulted','HTS clients with visits consulted','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HTS clients with visits consulted\n HTS clients with visits consulted\n \n 2023-09-21 13:17:44 UTC\n \n 2023-09-21 13:18:19 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2582\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:17:44',4,'2023-09-21 15:18:19',4,0,NULL,NULL,NULL,'2bd858aa-2daf-4fd2-9028-9d6fba579a89'),(2583,'PNC clients with visits started','PNC clients with visits started','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PNC clients with visits started\n PNC clients with visits started\n \n 2023-09-21 13:18:49 UTC\n \n 2023-09-21 13:19:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2583\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:18:49',4,'2023-09-21 15:19:20',4,0,NULL,NULL,NULL,'80003d94-268b-4726-ba0d-0fa830e90463'),(2584,'PNC clients with visits consulted','PNC clients with visits consulted','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PNC clients with visits consulted\n PNC clients with visits consulted\n \n 2023-09-21 13:19:39 UTC\n \n 2023-09-21 13:20:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2584\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:19:39',4,'2023-09-21 15:20:18',4,0,NULL,NULL,NULL,'e64fd32d-8284-4fb5-a227-8f338859ceaa'),(2586,'HEI clients with visits started','HEI clients with visits started','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HEI clients with visits started\n HEI clients with visits started\n \n 2023-09-21 13:23:38 UTC\n \n 2023-09-21 13:24:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2586\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:23:38',4,'2023-09-21 15:24:10',4,0,NULL,NULL,NULL,'e7e581aa-9b90-4f56-b8a1-9bfc607f8b4f'),(2587,'HEI clients with visits consulted','HEI clients with visits consulted','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HEI clients with visits consulted\n HEI clients with visits consulted\n \n 2023-09-21 13:24:38 UTC\n \n 2023-09-21 13:25:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2587\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:24:38',4,'2023-09-21 15:25:05',4,0,NULL,NULL,NULL,'dd05778e-c5bd-4430-90fa-fd97b36402d2'),(2588,'Family Planning clients with visits started','Family Planning clients with visits started','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Family Planning clients with visits started\n Family Planning clients with visits started\n \n 2023-09-21 13:25:31 UTC\n \n 2023-09-21 13:26:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2588\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:25:31',4,'2023-09-21 15:26:32',4,0,NULL,NULL,NULL,'3278fb6f-2276-4390-a5c2-9863d056f3a0'),(2589,'Family Planning clients with visits consulted','Family Planning clients with visits consulted','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Family Planning clients with visits consulted\n Family Planning clients with visits consulted\n \n 2023-09-21 13:26:58 UTC\n \n 2023-09-21 13:27:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2589\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:26:58',4,'2023-09-21 15:27:32',4,0,NULL,NULL,NULL,'822f0677-6a2b-47cf-9265-0841d65e9716'),(2590,'Under 5 clients with visits consulted','Under 5 clients with visits consulted','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Under 5 clients with visits consulted\n Under 5 clients with visits consulted\n \n 2023-09-21 13:28:28 UTC\n \n 2023-09-21 13:31:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2590\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:28:28',4,'2023-09-21 15:31:36',4,0,NULL,NULL,NULL,'3a2857b0-1d9c-4f7d-95e9-abcba540935d'),(2591,'Under 5 clients with visits started','Under 5 clients with visits started','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Under 5 clients with visits started\n Under 5 clients with visits started\n \n 2023-09-21 13:30:05 UTC\n \n 2023-09-21 13:30:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2591\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:30:05',4,'2023-09-21 15:30:36',4,0,NULL,NULL,NULL,'f62e6fdd-a64b-4619-925c-d86fc3987060'),(2592,'Clients current on ART','Clients current on ART','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients current on ART\n Clients current on ART\n \n 2023-09-21 13:31:58 UTC\n \n 2023-09-21 13:35:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2592\n (SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n person.gender AS Gender, \n observed_age_group.name AS age_group, \n observed_age_group.sort_order AS sort_order \n \n from obs o \n -- CLIENTS NEWLY INITIATED ON ART \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND (o.concept_id = 2249 \n \n AND MONTH(o.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(o.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n ) \n AND patient.voided = 0 AND o.voided = 0 \n AND o.person_id not in ( \n select distinct os.person_id from obs os \n where os.concept_id = 3634 \n AND os.value_coded = 2095 \n and os.voided = 0 \n AND MONTH(os.obs_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.obs_datetime) = YEAR(CAST(:endDate AS DATE)) \n ) \n \n and o.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages') AS Newly_Initiated_ART_Clients \nORDER BY Newly_Initiated_ART_Clients.patientName) \n \nUNION \n \n(SELECT Id \nFROM ( \n \nselect distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n person.gender AS Gender, \n observed_age_group.name AS age_group, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- CLIENTS SEEN FOR ART \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND (o.concept_id = 3843 AND o.value_coded = 3841 OR o.value_coded = 3842) \n AND MONTH(o.obs_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(o.obs_datetime) = YEAR(CAST(:endDate AS DATE)) \n AND patient.voided = 0 AND o.voided = 0 \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n \n) AS Clients_Seen \n \nWHERE Clients_Seen.Id not in ( \n select distinct patient.patient_id AS Id \n from obs o \n -- CLIENTS INITIATED ON ART \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND (o.concept_id = 2249 \n AND MONTH(o.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(o.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n ) \n AND patient.voided = 0 AND o.voided = 0 \n AND o.person_id not in ( \n select distinct os.person_id from obs os \n where os.concept_id = 3634 \n AND os.value_coded = 2095 \n and os.voided = 0 \n AND MONTH(os.obs_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.obs_datetime) = YEAR(CAST(:endDate AS DATE)) \n ) \n \n ) \nAND Clients_Seen.Id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 and os.voided = 0 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 and os.voided = 0 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \nAND Clients_Seen.Id not in \n ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 and os.voided = 0 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) \n and o.person_id in ( \n -- Death \n select distinct p.person_id \n from person p \n where dead = 1 \n and death_date <= CAST(:endDate AS DATE) \n and voided = 0 \n ) \n ) \nAND Clients_Seen.Id not in ( \n -- Visitors \n select o.person_id \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as examination_timing \n from obs oss \n where oss.concept_id = 5416 and oss.value_coded =1 and oss.voided=0 \n and cast(oss.obs_datetime as date) >= cast(:startDate as date) \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where concept_id = 5416 \n and o.obs_datetime = max_observation \n ) \n \nORDER BY Clients_Seen.patientName) \n \nUNION \n \n \n-- INCLUDE MISSED APPOINTMENTS WITHIN 28 DAYS ACCORDING TO THE NEW PEPFAR GUIDELINE \n(SELECT Id \nFROM \n (select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n person.gender AS Gender, \n observed_age_group.name AS age_group, \n observed_age_group.sort_order AS sort_order \n \n from obs o \n -- CLIENTS WHO MISSED APPOINTMENTS < 28 DAYS \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n -- begin \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up < cast(:endDate as date) \n and DATEDIFF(CAST(:endDate AS DATE),latest_follow_up) <= 28 \n \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where (os.concept_id = 3843 AND os.value_coded = 3841 OR os.value_coded = 3842) \n AND MONTH(os.obs_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.obs_datetime) = YEAR(CAST(:endDate AS DATE)) \n and os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND MONTH(os.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n and os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n \n -- TOUTS \n select tout_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.obs_datetime AS latest_consultation \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(max(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 2403 \n and obs_datetime <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 2398 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as tout_clients \n where tout_clients.latest_consultation < cast(:endDate as date) \n \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n \n ) \n \n and active_clients.person_id not in( \n -- Visitors \n select o.person_id \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as examination_timing \n from obs oss \n where oss.concept_id = 5416 and oss.value_coded =1 and oss.voided=0 \n and cast(oss.obs_datetime as date) >= cast(:startDate as date) \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where concept_id = 5416 \n and o.obs_datetime = max_observation \n ) \n ) \n -- end \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages') AS TwentyEightDayDefaulters \n order by TwentyEightDayDefaulters.patientName) \n \n \nUNION \n \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n person.gender AS Gender, \n observed_age_group.name AS age_group, \n observed_age_group.sort_order AS sort_order \n \n from obs o \n \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n -- begin \n select active_clients.person_id-- , active_clients.latest_follow_up \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where (os.concept_id = 3843 AND os.value_coded = 3841 OR os.value_coded = 3842) \n AND MONTH(os.obs_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.obs_datetime) = YEAR(CAST(:endDate AS DATE)) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND MONTH(os.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 and os.voided = 0 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 and os.voided = 0 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select o.person_id \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as examination_timing \n from obs oss \n where oss.concept_id = 5416 and oss.value_coded =1 and oss.voided=0 \n and cast(oss.obs_datetime as date) >= cast(:startDate as date) \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where concept_id = 5416 \n and o.obs_datetime = max_observation \n ) \n ) \n -- end \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages') AS Seen_Previous_ART_Clients \nORDER BY Seen_Previous_ART_Clients.patientName) \n\n','2023-09-21 15:31:58',4,'2023-09-21 15:35:41',4,0,NULL,NULL,NULL,'ad403c3b-d759-44ab-8965-252ca6127ce7'),(2593,'Cervical Cancer Screening clients with visits started','Cervical Cancer Screening clients with visits started','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Cervical Cancer Screening clients with visits started\n Cervical Cancer Screening clients with visits started\n \n 2023-09-21 13:32:10 UTC\n \n 2023-09-21 13:32:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2593\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:32:10',4,'2023-09-21 15:32:43',4,0,NULL,NULL,NULL,'c7967fcd-a8b7-41d4-b540-364a60a59621'),(2594,'Cervical Cancer Screening clients with visits consulted','Cervical Cancer Screening clients with visits consulted','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Cervical Cancer Screening clients with visits consulted\n Cervical Cancer Screening clients with visits consulted\n \n 2023-09-21 13:33:06 UTC\n \n 2023-09-21 13:34:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2594\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:33:06',4,'2023-09-21 15:34:03',4,0,NULL,NULL,NULL,'b526566e-555d-40c6-88d4-0b89242b1dde'),(2595,'Clients current on ART','Clients current on ART','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients current on ART\n Clients current on ART\n \n 2023-09-21 13:36:28 UTC\n \n 2023-09-21 13:37:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2595\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-21 15:36:28',4,'2023-09-21 15:37:08',4,0,NULL,NULL,NULL,'1db1c64d-177f-4ecc-b1d7-c9fd2b029eff'),(2596,'Clients with LAB tests sent','Clients with LAB tests sent','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients with LAB tests sent\n Clients with LAB tests sent\n \n 2023-09-22 08:35:11 UTC\n \n 2023-09-22 08:35:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2596\n select distinct patient.patient_id AS Id \n from orders o \n INNER JOIN patient ON o.patient_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n AND o.concept_id = 5484 \n AND CAST(o.date_created AS DATE)>= CAST(:startDate AS DATE) \n AND CAST(o.date_created AS DATE) <= CAST(:endDate AS DATE) \n LEFT OUTER JOIN patient_identifier p ON p.patient_id = person.person_id AND p.identifier_type = 5\n','2023-09-22 08:35:11',4,'2023-09-22 08:35:51',4,0,NULL,NULL,NULL,'f06f1ccb-c048-44d3-8037-35f8660a6b95'),(2597,'Clients with LAB tests sent','Clients with LAB tests sent','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients with LAB tests sent\n Clients with LAB tests sent\n \n 2023-09-22 08:36:30 UTC\n \n 2023-09-22 08:38:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2597\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-22 08:36:30',4,'2023-09-22 08:38:26',4,0,NULL,NULL,NULL,'c29cff5d-5919-4b60-8ab7-c6d4c7ea01da'),(2598,'Clients with LAB tests received','Clients with LAB tests received','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients with LAB tests received\n Clients with LAB tests received\n \n 2023-09-22 08:39:02 UTC\n \n 2024-02-06 09:57:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2598\n Select pId \n From \n ( \n select oss.person_id as pId, concat(oss.value_numeric, " ", "copies/ml") as Results \n from obs oss \n where oss.concept_id = 5485 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) >= cast(:startDate as date) \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n \n UNION \n \n select oss.person_id as pId, "LDL" as Results \n from obs oss \n where oss.concept_id = 5489 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) >= cast(:startDate as date) \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n \n ) As received_results\n','2023-09-22 14:09:02',4,'2024-02-06 15:27:28',4,0,NULL,NULL,NULL,'6939902b-1909-4f24-b71d-da60ab1d131b'),(2599,'Clients with LAB tests received','Clients with LAB tests received','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients with LAB tests received\n Clients with LAB tests received\n \n 2023-09-22 08:39:53 UTC\n \n 2023-09-22 08:42:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2599\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-09-22 08:39:53',4,'2023-09-22 08:42:39',4,0,NULL,NULL,NULL,'e47a29f8-b851-480f-9812-e54da393fdb9'),(2600,'Contacts of TB Patients','Contacts of TB Patients','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Contacts of TB Patients\n Contacts of TB Patients\n \n 2024-02-27 09:43:12 UTC\n \n 2024-02-27 10:34:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2600\n select contact.person_id \n from \n (select B.person_id, B.obs_datetime \n from obs B \n inner join \n (select person_id, max(obs_datetime) as latest_consultation \n from obs where concept_id = 5926 \n and obs_datetime <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.latest_consultation = B.obs_datetime \n where concept_id = 5962 and value_coded = 2146 \n and A.latest_consultation = B.obs_datetime \n and voided = 0 \n group by B.person_id \n ) as contact\n','2024-02-27 15:13:12',4,'2024-02-27 16:04:55',4,0,NULL,NULL,NULL,'f74fefb2-b6d4-4c26-b214-fdb965aeb103'),(2601,'Contacts of TB Patients screened for TB','Contacts of TB Patients screened for TB','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Contacts of TB Patients screened for TB\n Contacts of TB Patients screened for TB\n \n 2024-02-27 10:35:41 UTC\n \n 2024-02-27 10:36:09 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2601\n select contact.person_id \n from \n (select B.person_id \n from obs B \n inner join \n (select person_id, max(obs_datetime) as latest_consultation \n from obs where concept_id = 5904 \n and obs_datetime <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.latest_consultation = B.obs_datetime \n where concept_id = 5962 and value_coded = 2146 \n and A.latest_consultation = B.obs_datetime \n and voided = 0 \n group by B.person_id \n ) as contact\n','2024-02-27 16:05:41',4,'2024-02-27 16:06:09',4,0,NULL,NULL,NULL,'6733708e-c472-4c84-89a2-13e0938a8360'),(2602,'Presumptive TB contacts with bacteriologic result(s)','Presumptive TB contacts with bacteriologic test result (s)','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Presumptive TB contacts with bacteriologic result(s)\n Presumptive TB contacts with bacteriologic test result (s)\n \n 2024-02-27 14:08:31 UTC\n \n 2024-02-27 14:16:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2602\n \n select distinct Id \n FROM \n ( \n -- Bacteriologically confirmed Genotypic test results and Phenotypic test results \n select distinct person_id as Id \n From obs o \n where o.concept_id in (3814, 3815) \n and cast(o.obs_datetime as date) >= CAST(:startDate AS DATE) \n and cast(o.obs_datetime as date) <= CAST(:endDate AS DATE) \n and o.voided = 0 \n \n -- MTB not Detected \n and o.person_id in \n ( \n select distinct o.person_id \n from obs o \n inner join \n ( \n select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as examination_timing \n from obs oss \n where oss.concept_id in (5954,5433,5955,5956,5959) \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.Id = o.person_id \n where o.concept_id in (3787,3805,3840,5957) \n and o.voided=0 \n and cast(o.obs_datetime as date) = cast(max_observation as date) \n \n ) \n \n ) As Pulmonary_Bacteriologic\n','2024-02-27 19:38:31',4,'2024-02-27 19:46:55',4,0,NULL,NULL,NULL,'5c82cebb-b76f-4acd-a416-752578f29546'),(2603,'Contacts of TB Patients who are positive to a bacteriologic test ','Contacts of TB Patients who are positive to a bacteriologic test ','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Contacts of TB Patients who are positive to a bacteriologic test \n Contacts of TB Patients who are positive to a bacteriologic test \n \n 2024-02-27 14:17:57 UTC\n \n 2024-02-27 17:56:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2603\n select distinct Id \n FROM \n ( \n -- Bacteriologically results \n select distinct person_id as Id \n From obs o \n where o.concept_id = 5953 \n and cast(o.obs_datetime as date) >= CAST(:startDate AS DATE) \n and cast(o.obs_datetime as date) <= CAST(:endDate AS DATE) \n and o.voided = 0 \n \n -- MTB Detected \n and o.person_id in \n ( \n select distinct o.person_id \n from obs o \n inner join \n ( \n select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as examination_timing \n from obs oss \n where oss.concept_id in (5954,5433,5955,5956,5959) \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.Id = o.person_id \n where o.concept_id in (3787,3805,3840,5957) \n and o.value_coded in (3816,3817,3718, 1738, 3828,3829,3830, 3831, 3832,3833,3834, 3835,3836, 3837,3838,3839) \n and o.voided=0 \n and cast(o.obs_datetime as date) = cast(max_observation as date) \n \n ) \n \n ) As Pulmonary_Bacteriologic\n','2024-02-27 19:47:57',4,'2024-02-27 23:26:03',4,0,NULL,NULL,NULL,'c632d1d1-ddd1-40ca-bdfd-8df133511db3'),(2604,'Contacts of TB Patients who are positive bacteriologic test & started TB treatment','Contacts of TB Patients who are positive to a bacteriologic test and started on TB treatment','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Contacts of TB Patients who are positive bacteriologic test & started TB treatment\n Contacts of TB Patients who are positive to a bacteriologic test and started on TB treatment\n \n 2024-02-27 18:19:38 UTC\n \n 2024-02-27 18:20:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2604\n select distinct Id \n FROM \n ( \n -- Bacteriologically results \n select distinct person_id as Id \n From obs o \n where o.concept_id = 5953 \n and cast(o.obs_datetime as date) >= CAST(:startDate AS DATE) \n and cast(o.obs_datetime as date) <= CAST(:endDate AS DATE) \n and o.voided = 0 \n \n -- MTB Detected \n and o.person_id in \n ( \n select distinct o.person_id \n from obs o \n inner join \n ( \n select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as examination_timing \n from obs oss \n where oss.concept_id in (5954,5433,5955,5956,5959) \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.Id = o.person_id \n where o.concept_id in (3787,3805,3840,5957) \n and o.value_coded in (3816,3817,3718, 1738, 3828,3829,3830, 3831, 3832,3833,3834, 3835,3836, 3837,3838,3839) \n and o.voided=0 \n and cast(o.obs_datetime as date) = cast(max_observation as date) \n \n ) \n \n ) As Pulmonary_Bacteriologic \n inner join ( \n select ob.person_id as pId \n FROM obs ob \n -- Pulmonary TB \n where ob.concept_id = 2237 \n AND cast(ob.value_datetime as date) >= CAST(:startDate AS DATE) \n and cast(ob.value_datetime as date) <= CAST(:endDate AS DATE) \n and ob.voided = 0 \n ) as Pulmonary \n on Pulmonary_Bacteriologic.Id = Pulmonary.pId\n','2024-02-27 23:49:38',4,'2024-02-27 23:50:06',4,0,NULL,NULL,NULL,'d2360af2-f13b-4b10-978f-5f230a0a83d7'),(2605,'Contacts of TB patients - Presumptive','Contacts of TB patients who have one or more signs and symptoms of TB (Presumptive)','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Contacts of TB patients - Presumptive\n Contacts of TB patients who have one or more signs and symptoms of TB (Presumptive)\n \n 2024-02-27 18:31:50 UTC\n \n 2024-02-27 18:32:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2605\n select ob.person_id as pId \n FROM obs ob \n where ob.concept_id = 5940 \n AND cast(ob.obs_datetime as date) >= CAST(:startDate AS DATE) \n and cast(ob.obs_datetime as date) <= CAST(:endDate AS DATE) \n and ob.voided = 0\n','2024-02-28 00:01:50',4,'2024-02-28 00:02:42',4,0,NULL,NULL,NULL,'17e19631-0322-48e3-8a42-352880f64b8f'),(2606,'Detection_Age','TB detection age groups','org.openmrs.module.reporting.indicator.dimension.Dimension','org.openmrs.module.reporting.indicator.dimension.CohortDefinitionDimension','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Detection_Age\n TB detection age groups\n \n 2024-02-27 18:42:36 UTC\n \n 2024-02-27 18:47:04 UTC\n \n \n endDate\n \n java.util.Date\n true\n \n \n 2606\n \n \n 15+years\n \n \n \n \n maxAge\n 120\n \n \n minAge\n 15\n \n \n effectiveDate\n ${endDate}\n \n \n \n \n \n 5-14yrs\n \n \n \n \n maxAge\n 14\n \n \n minAge\n 5\n \n \n effectiveDate\n ${endDate}\n \n \n \n \n \n <5yrs\n \n \n \n \n maxAge\n 4\n \n \n minAge\n 0\n \n \n effectiveDate\n ${endDate}\n \n \n \n \n \n','2024-02-28 00:12:36',4,'2024-02-28 00:17:04',4,0,NULL,NULL,NULL,'c12ee61b-5bc3-4476-866b-3a5a1ac37038'),(2607,'Contacts of TB Patients','Contacts of TB Patients','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Contacts of TB Patients\n Contacts of TB Patients\n \n 2024-02-27 18:52:39 UTC\n \n 2024-02-27 18:54:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2607\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 00:22:39',4,'2024-02-28 00:24:05',4,0,NULL,NULL,NULL,'ec97d270-a1a8-4d2c-ae71-b6ffcb555781'),(2610,'Contacts of TB Patients screened for TB','Contacts of TB Patients screened for TB','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Contacts of TB Patients screened for TB\n Contacts of TB Patients screened for TB\n \n 2024-02-27 19:00:00 UTC\n \n 2024-02-27 19:00:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2610\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 00:30:00',4,'2024-02-28 00:30:51',4,0,NULL,NULL,NULL,'1fefae20-e24c-4809-97a3-0bb2942ca618'),(2611,'Contacts of TB patients -Presumptive','Contacts of TB patients who have one or more signs and symptoms of TB (Presumptive)','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Contacts of TB patients -Presumptive\n Contacts of TB patients who have one or more signs and symptoms of TB (Presumptive)\n \n 2024-02-27 19:02:10 UTC\n \n 2024-02-27 19:03:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2611\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 00:32:10',4,'2024-02-28 00:33:04',4,0,NULL,NULL,NULL,'61a06072-21c6-492d-94c7-f59c8980ce28'),(2612,'Presumptive TB contacts with bacteriologic test result (s)','Presumptive TB contacts with bacteriologic test result (s)','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Presumptive TB contacts with bacteriologic test result (s)\n Presumptive TB contacts with bacteriologic test result (s)\n \n 2024-02-27 19:04:19 UTC\n \n 2024-02-27 19:10:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2612\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 00:34:19',4,'2024-02-28 00:40:31',4,0,NULL,NULL,NULL,'93c6d789-932b-4b13-903a-1c238427492c'),(2614,'Contacts of TB Patients who are positive to a bacteriologic test ','Contacts of TB Patients who are positive to a bacteriologic test ','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Contacts of TB Patients who are positive to a bacteriologic test \n Contacts of TB Patients who are positive to a bacteriologic test \n \n 2024-02-27 19:11:53 UTC\n \n 2024-02-27 19:12:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2614\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 00:41:53',4,'2024-02-28 00:42:39',4,0,NULL,NULL,NULL,'ad43ca8a-5327-49d6-82a9-d4a5b532e54e'),(2615,'Contacts of TB Patients who are positive to a bacteriologic test and started on TB treatment','Contacts of TB Patients who are positive to a bacteriologic test and started on TB treatment','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Contacts of TB Patients who are positive to a bacteriologic test and started on TB treatment\n Contacts of TB Patients who are positive to a bacteriologic test and started on TB treatment\n \n 2024-02-27 19:13:47 UTC\n \n 2024-02-27 19:14:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2615\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 00:43:47',4,'2024-02-28 00:44:36',4,0,NULL,NULL,NULL,'eecb27c4-5eea-4c61-8093-2e76f27c5733'),(2616,'TB Case Detection - Block 2: Contact Tracing and screening ','TB Case Detection - Block 2: Contact Tracing and screening ','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Case Detection - Block 2: Contact Tracing and screening \n TB Case Detection - Block 2: Contact Tracing and screening \n \n 2024-02-27 19:18:00 UTC\n \n 2024-02-27 19:18:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2616\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2024-02-28 00:48:00',4,'2024-02-28 00:48:20',4,0,NULL,NULL,NULL,'18beaf66-8afb-4c42-85f3-6a4f9e6e4c86'),(2617,'TB Case Detection - Block 2: Contact Tracing and screening Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Case Detection - Block 2: Contact Tracing and screening Data Set\n \n 2024-02-27 19:18:20 UTC\n \n 2024-02-27 19:48:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2617\n \n \n Detection_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n AlPosBacTB\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n \n \n AllBacRes\n \n \n \n \n \n \n \n \n \n AllConPres\n \n \n \n \n \n \n \n \n \n AllConScre\n \n \n \n \n \n \n \n \n \n AllContact\n \n \n \n \n \n \n \n \n \n AllPosBact\n \n \n \n \n \n \n \n \n \n BacRes5-14\n \n \n \n \n Detection_Age\n 5-14yrs\n \n \n \n \n \n BacRes<5ys\n \n \n \n \n Detection_Age\n <5yrs\n \n \n \n \n \n Con15+ys\n \n \n \n \n Detection_Age\n 15+years\n \n \n \n \n \n ConPre15+y\n \n \n \n \n \n \n ConPre5-14\n \n \n \n \n \n \n ConPres<5y\n \n \n \n \n \n \n ConScr15+y\n \n \n \n \n \n \n ConScr5-14\n \n \n \n \n \n \n ConScr<5ys\n \n \n \n \n \n \n Cont5-14ys\n \n \n \n \n \n \n Cont<5ys\n \n \n \n \n \n \n PoBaTB5-14\n \n \n \n \n \n \n PoBacTB15+\n \n \n \n \n \n \n PosBac15+y\n \n \n \n \n \n \n PosBac5-14\n \n \n \n \n \n \n PosBac<5ys\n \n \n \n \n \n \n PosBacTB<5\n \n \n \n \n \n \n','2024-02-28 00:48:20',4,'2024-02-28 01:18:21',4,0,NULL,NULL,NULL,'8ce17921-9b17-4c08-9bfc-679a5d0d56da'),(2618,'TB patients given 2RHZE/4RHE weighing 30-39kg','TB patients given 2RHZE/4RHE weighing 30-39kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4RHE weighing 30-39kg\n TB patients given 2RHZE/4RHE weighing 30-39kg\n \n 2024-02-28 09:00:45 UTC\n \n 2024-02-28 09:01:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2618\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6002 -- 2RHZE/4RHE \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=30 and _weight < 40 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 14:30:45',4,'2024-02-28 14:31:30',4,0,NULL,NULL,NULL,'bce1bee1-bb3f-4a76-afef-2247f4cd563d'),(2619,'TB patients given 2RHZE/4RHE weighing 40-54kg','TB patients given 2RHZE/4RHE weighing 40-54kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4RHE weighing 40-54kg\n TB patients given 2RHZE/4RHE weighing 40-54kg\n \n 2024-02-28 09:03:00 UTC\n \n 2024-02-28 09:03:22 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2619\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6002 -- 2RHZE/4RHE \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=40 and _weight < 55 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 14:33:00',4,'2024-02-28 14:33:22',4,0,NULL,NULL,NULL,'1e603efc-b71c-45c5-8c9b-8f3126d88455'),(2620,'TB patients given 2RHZE/4RHE weighing 55-70kg','TB patients given 2RHZE/4RHE weighing 55-70kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4RHE weighing 55-70kg\n TB patients given 2RHZE/4RHE weighing 55-70kg\n \n 2024-02-28 09:03:53 UTC\n \n 2024-02-28 09:04:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2620\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6002 -- 2RHZE/4RHE \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=55 and _weight <= 70 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 14:33:53',4,'2024-02-28 14:34:42',4,0,NULL,NULL,NULL,'7a53ac46-5c90-4320-83ff-2f59647d980f'),(2621,'TB patients given 2RHZE/4RHE weighing > 70','TB patients given 2RHZE/4RHE weighing > 70','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4RHE weighing > 70\n TB patients given 2RHZE/4RHE weighing > 70\n \n 2024-02-28 09:05:44 UTC\n \n 2024-02-28 09:06:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2621\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6002 -- 2RHZE/4RHE \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight > 70 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 14:35:44',4,'2024-02-28 14:36:26',4,0,NULL,NULL,NULL,'fe5b0998-1225-4b7e-b565-e15fa88e7ca7'),(2622,'TB patients given 2HPMZ/2HPM weighing 40-50kg','TB patients given 2HPMZ/2HPM weighing 40-50kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HPMZ/2HPM weighing 40-50kg\n TB patients given 2HPMZ/2HPM weighing 40-50kg\n \n 2024-02-28 09:08:25 UTC\n \n 2024-02-28 09:08:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2622\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6003 -- 2HPMZ/2HPM \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=40 and _weight < 50 \n)weight__ \nON regimen.Id = weight__.Id \n\n','2024-02-28 14:38:25',4,'2024-02-28 14:38:53',4,0,NULL,NULL,NULL,'97d1eb39-6c72-4cd7-85f2-a7667daea615'),(2623,'TB patients given 2HPMZ/2HPM weighing 50-65kg','TB patients given 2HPMZ/2HPM weighing 50-65kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HPMZ/2HPM weighing 50-65kg\n TB patients given 2HPMZ/2HPM weighing 50-65kg\n \n 2024-02-28 09:09:48 UTC\n \n 2024-02-28 09:10:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2623\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6003 -- 2HPMZ/2HPM \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=50 and _weight < 65 \n)weight__ \nON regimen.Id = weight__.Id \n\n','2024-02-28 14:39:48',4,'2024-02-28 14:40:58',4,0,NULL,NULL,NULL,'4698f622-e7a9-4dd9-8c2d-6af54419f71f'),(2624,'TB patients given 2HPMZ/2HPM weighing > 65kg','TB patients given 2HPMZ/2HPM weighing > 65kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HPMZ/2HPM weighing > 65kg\n TB patients given 2HPMZ/2HPM weighing > 65kg\n \n 2024-02-28 09:11:30 UTC\n \n 2024-02-28 09:12:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2624\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6003 -- 2HPMZ/2HPM \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=65 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 14:41:30',4,'2024-02-28 14:42:01',4,0,NULL,NULL,NULL,'707a44a5-5cd1-46d8-9880-4c4396914acc'),(2625,'TB patients given 2RHZE/4HR weighing <2kg','TB patients given 2RHZE/4HR weighing <2kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing <2kg\n TB patients given 2RHZE/4HR weighing <2kg\n \n 2024-02-28 09:16:33 UTC\n \n 2024-02-28 09:18:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2625\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6004 -- 2RHZE/4HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight < 2 \n)weight__ \nON regimen.Id = weight__.Id \n\n','2024-02-28 14:46:33',4,'2024-02-28 14:48:07',4,0,NULL,NULL,NULL,'4c663664-65db-4048-8554-4546b580ff2f'),(2626,'TB patients given 2RHZE/4HR weighing 2-2.9kg','TB patients given 2RHZE/4HR weighing 2-2.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing 2-2.9kg\n TB patients given 2RHZE/4HR weighing 2-2.9kg\n \n 2024-02-28 09:17:03 UTC\n \n 2024-02-28 09:18:56 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2626\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6004 -- 2RHZE/4HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=2 and _weight <=2.9 \n)weight__ \nON regimen.Id = weight__.Id \n\n','2024-02-28 14:47:03',4,'2024-02-28 14:48:56',4,0,NULL,NULL,NULL,'bcc6e6f5-8e74-4a51-bf4e-74f9aa16c937'),(2627,'TB patients given 2RHZE/4HR weighing 3-3.9kg','TB patients given 2RHZE/4HR weighing 3-3.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing 3-3.9kg\n TB patients given 2RHZE/4HR weighing 3-3.9kg\n \n 2024-02-28 09:17:29 UTC\n \n 2024-02-28 09:19:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2627\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6004 -- 2RHZE/4HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=3 and _weight <=3.9 \n)weight__ \nON regimen.Id = weight__.Id \n\n','2024-02-28 14:47:29',4,'2024-02-28 14:49:26',4,0,NULL,NULL,NULL,'5f931adb-9e99-4e78-a063-02bd6d424205'),(2628,'TB patients given 2RHZE/4HR weighing 4-7.9kg','TB patients given 2RHZE/4HR weighing 4-7.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing 4-7.9kg\n TB patients given 2RHZE/4HR weighing 4-7.9kg\n \n 2024-02-28 09:20:41 UTC\n \n 2024-02-28 09:22:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2628\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6004 -- 2RHZE/4HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=4 and _weight <=7.9 \n)weight__ \nON regimen.Id = weight__.Id \n\n','2024-02-28 14:50:41',4,'2024-02-28 14:52:44',4,0,NULL,NULL,NULL,'e45460ed-89cd-4be9-a60b-b3b96c18690c'),(2629,'TB patients given 2RHZE/4HR weighing 8-11.9kg','TB patients given 2RHZE/4HR weighing 8-11.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing 8-11.9kg\n TB patients given 2RHZE/4HR weighing 8-11.9kg\n \n 2024-02-28 09:21:07 UTC\n \n 2024-02-28 09:23:25 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2629\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6004 -- 2RHZE/4HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=8 and _weight <=11.9 \n)weight__ \nON regimen.Id = weight__.Id \n\n','2024-02-28 14:51:07',4,'2024-02-28 14:53:25',4,0,NULL,NULL,NULL,'abc8ec30-9c64-4b20-90d5-84d305425137'),(2630,'TB patients given 2RHZE/4HR weighing 12-15.9kg','TB patients given 2RHZE/4HR weighing 12-15.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing 12-15.9kg\n TB patients given 2RHZE/4HR weighing 12-15.9kg\n \n 2024-02-28 09:21:43 UTC\n \n 2024-02-28 09:24:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2630\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6004 -- 2RHZE/4HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=12 and _weight <=15.9 \n)weight__ \nON regimen.Id = weight__.Id \n\n','2024-02-28 14:51:43',4,'2024-02-28 14:54:08',4,0,NULL,NULL,NULL,'52ec3a8d-b3e6-41dc-aa67-2ff1a07dfd2d'),(2631,'TB patients given 2RHZE/4HR weighing 16-24.9kg','TB patients given 2RHZE/4HR weighing 16-24.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing 16-24.9kg\n TB patients given 2RHZE/4HR weighing 16-24.9kg\n \n 2024-02-28 09:24:47 UTC\n \n 2024-02-28 09:26:48 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2631\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6004 -- 2RHZE/4HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=16 and _weight <=24.9 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 14:54:47',4,'2024-02-28 14:56:48',4,0,NULL,NULL,NULL,'aaaa184e-66a3-41ee-805d-63a160e900d7'),(2632,'TB patients given 2RHZE/4HR weighing 25-<30kg','TB patients given 2RHZE/4HR weighing 25-<30kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing 25-<30kg\n TB patients given 2RHZE/4HR weighing 25-<30kg\n \n 2024-02-28 09:25:32 UTC\n \n 2024-02-28 09:27:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2632\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6004 -- 2RHZE/4HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=25 and _weight <30 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 14:55:32',4,'2024-02-28 14:57:11',4,0,NULL,NULL,NULL,'0f4326f5-cd2a-4800-a7cb-fe455816074e'),(2633,'TB patients given 2RHZE/4HR weighing 30-<35kg','TB patients given 2RHZE/4HR weighing 30-<35kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing 30-<35kg\n TB patients given 2RHZE/4HR weighing 30-<35kg\n \n 2024-02-28 09:25:58 UTC\n \n 2024-02-28 09:27:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2633\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6004 -- 2RHZE/4HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=30 and _weight <35 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 14:55:58',4,'2024-02-28 14:57:39',4,0,NULL,NULL,NULL,'a8c81b22-814f-4ec1-870c-a46e92de3ee2'),(2634,'TB patients given 2RHZE/4HR weighing 35-<50kg','TB patients given 2RHZE/4HR weighing 35-<50kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing 35-<50kg\n TB patients given 2RHZE/4HR weighing 35-<50kg\n \n 2024-02-28 09:28:44 UTC\n \n 2024-02-28 09:30:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2634\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6004 -- 2RHZE/4HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=35 and _weight <50 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 14:58:44',4,'2024-02-28 15:00:43',4,0,NULL,NULL,NULL,'780376a9-7a64-41f5-8f4d-0bcae15e9ca9'),(2635,'TB patients given 2RHZE/4HR weighing 50-<65kg','TB patients given 2RHZE/4HR weighing 50-<65kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing 50-<65kg\n TB patients given 2RHZE/4HR weighing 50-<65kg\n \n 2024-02-28 09:29:39 UTC\n \n 2024-02-28 09:31:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2635\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6004 -- 2RHZE/4HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=50 and _weight <65 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 14:59:39',4,'2024-02-28 15:01:03',4,0,NULL,NULL,NULL,'7adf4555-6be7-4db8-911c-41e8087ab25f'),(2636,'TB patients given 2RHZE/4HR weighing >65kg','TB patients given 2RHZE/4HR weighing >65kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing >65kg\n TB patients given 2RHZE/4HR weighing >65kg\n \n 2024-02-28 09:30:09 UTC\n \n 2024-02-28 09:31:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2636\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6004 -- 2RHZE/4HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=65 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:00:09',4,'2024-02-28 15:01:20',4,0,NULL,NULL,NULL,'3ba100cc-0cf9-491d-a702-3382611c1f47'),(2637,'TB patients given 2HRE/10HR weighing < 2kg','TB patients given 2HRE/10HR weighing < 2kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing < 2kg\n TB patients given 2HRE/10HR weighing < 2kg\n \n 2024-02-28 09:46:22 UTC\n \n 2024-02-28 09:47:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2637\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6006 -- 2HRE/10HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight<2 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:16:22',4,'2024-02-28 15:17:53',4,0,NULL,NULL,NULL,'c7f2046d-c7a7-4d48-9c85-2a455c7dbdc0'),(2638,'TB patients given 2HRE/10HR weighing 2-2.9kg','TB patients given 2HRE/10HR weighing 2-2.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing 2-2.9kg\n TB patients given 2HRE/10HR weighing 2-2.9kg\n \n 2024-02-28 09:46:56 UTC\n \n 2024-02-28 09:48:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2638\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6006 -- 2HRE/10HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=2 and _weight <=2.9 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:16:56',4,'2024-02-28 15:18:18',4,0,NULL,NULL,NULL,'de0d0c97-70f7-4883-bc11-e831a85a64bd'),(2639,'TB patients given 2HRE/10HR weighing 3-3.9kg','TB patients given 2HRE/10HR weighing 3-3.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing 3-3.9kg\n TB patients given 2HRE/10HR weighing 3-3.9kg\n \n 2024-02-28 09:47:20 UTC\n \n 2024-02-28 09:48:37 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2639\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6006 -- 2HRE/10HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=3 and _weight <=3.9 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:17:20',4,'2024-02-28 15:18:37',4,0,NULL,NULL,NULL,'8a6d80b4-4f5f-416d-8242-73f18ca89178'),(2640,'TB patients given 2HRE/10HR weighing 4-7.9kg','TB patients given 2HRE/10HR weighing 4-7.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing 4-7.9kg\n TB patients given 2HRE/10HR weighing 4-7.9kg\n \n 2024-02-28 09:49:19 UTC\n \n 2024-02-28 09:50:56 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2640\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6006 -- 2HRE/10HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=4 and _weight <=7.9 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:19:19',4,'2024-02-28 15:20:56',4,0,NULL,NULL,NULL,'38551c29-6e79-4f40-9411-9beecdee568e'),(2641,'TB patients given 2HRE/10HR weighing 8-11.9kg','TB patients given 2HRE/10HR weighing 8-11.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing 8-11.9kg\n TB patients given 2HRE/10HR weighing 8-11.9kg\n \n 2024-02-28 09:49:56 UTC\n \n 2024-02-28 09:51:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2641\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6006 -- 2HRE/10HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=8 and _weight <=11.9 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:19:56',4,'2024-02-28 15:21:15',4,0,NULL,NULL,NULL,'59ff1d6e-fe8b-4ca9-9b15-10937a9fa334'),(2642,'TB patients given 2HRE/10HR weighing 12-15.9kg','TB patients given 2HRE/10HR weighing 12-15.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing 12-15.9kg\n TB patients given 2HRE/10HR weighing 12-15.9kg\n \n 2024-02-28 09:50:27 UTC\n \n 2024-02-28 09:51:35 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2642\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6006 -- 2HRE/10HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=12 and _weight <=15.9 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:20:27',4,'2024-02-28 15:21:35',4,0,NULL,NULL,NULL,'1fab63d8-a077-4f3d-b679-8ea75eefc879'),(2643,'TB patients given 2HRE/10HR weighing 16-24.9kg','TB patients given 2HRE/10HR weighing 16-24.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing 16-24.9kg\n TB patients given 2HRE/10HR weighing 16-24.9kg\n \n 2024-02-28 09:52:51 UTC\n \n 2024-02-28 09:54:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2643\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6006 -- 2HRE/10HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=16 and _weight <=24.9 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:22:51',4,'2024-02-28 15:24:31',4,0,NULL,NULL,NULL,'e3ca9790-a1cc-4ede-adb2-2adf7417ef0e'),(2644,'TB patients given 2HRE/10HR weighing 25-<30kg','TB patients given 2HRE/10HR weighing 25-<30kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing 25-<30kg\n TB patients given 2HRE/10HR weighing 25-<30kg\n \n 2024-02-28 09:53:35 UTC\n \n 2024-02-28 09:54:52 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2644\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6006 -- 2HRE/10HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=25 and _weight <30 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:23:35',4,'2024-02-28 15:24:52',4,0,NULL,NULL,NULL,'61d82671-e514-447c-9f93-6ff18cefcc43'),(2645,'TB patients given 2HRE/10HR weighing 30-<35kg','TB patients given 2HRE/10HR weighing 30-<35kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing 30-<35kg\n TB patients given 2HRE/10HR weighing 30-<35kg\n \n 2024-02-28 09:53:58 UTC\n \n 2024-02-28 09:55:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2645\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6006 -- 2HRE/10HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=30 and _weight <35 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:23:58',4,'2024-02-28 15:25:23',4,0,NULL,NULL,NULL,'ba68f071-b28c-4593-9eb5-d766c4059246'),(2646,'TB patients given 2HRE/10HR weighing 35-<50kg','TB patients given 2HRE/10HR weighing 35-<50kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing 35-<50kg\n TB patients given 2HRE/10HR weighing 35-<50kg\n \n 2024-02-28 09:56:05 UTC\n \n 2024-02-28 09:57:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2646\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6006 -- 2HRE/10HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=35 and _weight <50 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:26:05',4,'2024-02-28 15:27:36',4,0,NULL,NULL,NULL,'97a65448-6d14-44c7-b5f6-c9239129cc04'),(2647,'TB patients given 2HRE/10HR weighing 50-<65kg','TB patients given 2HRE/10HR weighing 50-<65kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing 50-<65kg\n TB patients given 2HRE/10HR weighing 50-<65kg\n \n 2024-02-28 09:58:05 UTC\n \n 2024-02-28 09:59:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2647\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6006 -- 2HRE/10HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=50 and _weight <65 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:28:05',4,'2024-02-28 15:29:08',4,0,NULL,NULL,NULL,'d55f2b31-4ae3-474d-888a-e00f28cb793d'),(2648,'TB patients given 2HRE/10HR weighing > 65kg','TB patients given 2HRE/10HR weighing > 65kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing > 65kg\n TB patients given 2HRE/10HR weighing > 65kg\n \n 2024-02-28 09:58:37 UTC\n \n 2024-02-28 09:59:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2648\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6006 -- 2HRE/10HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=65 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:28:37',4,'2024-02-28 15:29:30',4,0,NULL,NULL,NULL,'1f23c88a-059b-4f38-b2eb-fc6799b4f222'),(2649,'TB patients given 2RHZE/2HR weighing < 2kg','TB patients given 2RHZE/2HR weighing < 2kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing < 2kg\n TB patients given 2RHZE/2HR weighing < 2kg\n \n 2024-02-28 10:01:29 UTC\n \n 2024-02-28 10:02:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2649\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6005 -- 2RHZE/2HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight<2 \n)weight__ \nON regimen.Id = weight__.Id \n\n','2024-02-28 15:31:29',4,'2024-02-28 15:32:50',4,0,NULL,NULL,NULL,'8d42e0e8-c79a-4f69-abc6-4fa27df65a30'),(2650,'TB patients given 2RHZE/2HR weighing 2-2.9kg','TB patients given 2RHZE/2HR weighing 2-2.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing 2-2.9kg\n TB patients given 2RHZE/2HR weighing 2-2.9kg\n \n 2024-02-28 10:01:54 UTC\n \n 2024-02-28 10:03:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2650\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6005 -- 2RHZE/2HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=2 and _weight <=2.9 \n)weight__ \nON regimen.Id = weight__.Id \n\n','2024-02-28 15:31:54',4,'2024-02-28 15:33:05',4,0,NULL,NULL,NULL,'b2fe9c79-18fe-49be-aa3c-b7bfbd65ba1c'),(2651,'TB patients given 2RHZE/2HR weighing 3-3.9kg','TB patients given 2RHZE/2HR weighing 3-3.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing 3-3.9kg\n TB patients given 2RHZE/2HR weighing 3-3.9kg\n \n 2024-02-28 10:02:16 UTC\n \n 2024-02-28 10:03:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2651\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6005 -- 2RHZE/2HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=3 and _weight <=3.9 \n)weight__ \nON regimen.Id = weight__.Id \n\n','2024-02-28 15:32:16',4,'2024-02-28 15:33:21',4,0,NULL,NULL,NULL,'22385e11-6674-42cb-9da8-78d2340fb975'),(2652,'B patients given 2RHZE/2HR weighing 4-7.9kg','B patients given 2RHZE/2HR weighing 4-7.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n B patients given 2RHZE/2HR weighing 4-7.9kg\n B patients given 2RHZE/2HR weighing 4-7.9kg\n \n 2024-02-28 10:04:18 UTC\n \n 2024-02-28 10:05:37 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2652\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6005 -- 2RHZE/2HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=4 and _weight <=7.9 \n)weight__ \nON regimen.Id = weight__.Id \n\n','2024-02-28 15:34:18',4,'2024-02-28 15:35:37',4,0,NULL,NULL,NULL,'356dbe3c-dd76-4e39-b486-3e86492b4eb0'),(2653,'B patients given 2RHZE/2HR weighing 8-11.9kg','B patients given 2RHZE/2HR weighing 8-11.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n B patients given 2RHZE/2HR weighing 8-11.9kg\n B patients given 2RHZE/2HR weighing 8-11.9kg\n \n 2024-02-28 10:04:50 UTC\n \n 2024-02-28 10:06:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2653\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6005 -- 2RHZE/2HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=8 and _weight <=11.9 \n)weight__ \nON regimen.Id = weight__.Id \n\n','2024-02-28 15:34:50',4,'2024-02-28 15:36:00',4,0,NULL,NULL,NULL,'3d88ce54-fe6f-45ec-9628-303ede656df6'),(2654,'B patients given 2RHZE/2HR weighing 12-15.9kg','B patients given 2RHZE/2HR weighing 12-15.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n B patients given 2RHZE/2HR weighing 12-15.9kg\n B patients given 2RHZE/2HR weighing 12-15.9kg\n \n 2024-02-28 10:05:14 UTC\n \n 2024-02-28 10:06:38 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2654\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6005 -- 2RHZE/2HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=12 and _weight <=15.9 \n)weight__ \nON regimen.Id = weight__.Id \n\n','2024-02-28 15:35:14',4,'2024-02-28 15:36:38',4,0,NULL,NULL,NULL,'f072dc00-cc6a-4c1d-b049-3d71fdd7c418'),(2655,'TB patients given 2RHZE/2HR weighing 4-7.9kg','TB patients given 2RHZE/2HR weighing 4-7.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing 4-7.9kg\n TB patients given 2RHZE/2HR weighing 4-7.9kg\n \n 2024-02-28 10:10:03 UTC\n \n 2024-02-28 10:11:16 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2655\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6005 -- 2RHZE/2HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=4 and _weight <=7.9 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:40:03',4,'2024-02-28 15:41:16',4,0,NULL,NULL,NULL,'5d170b44-4744-44a0-8b5c-9a147276a165'),(2656,'TB patients given 2RHZE/2HR weighing 8-11.9kg','TB patients given 2RHZE/2HR weighing 8-11.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing 8-11.9kg\n TB patients given 2RHZE/2HR weighing 8-11.9kg\n \n 2024-02-28 10:10:27 UTC\n \n 2024-02-28 10:11:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2656\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6005 -- 2RHZE/2HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=8 and _weight <=11.9 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:40:27',4,'2024-02-28 15:41:41',4,0,NULL,NULL,NULL,'4c12f685-7ba2-4a98-85d9-e8c718af019c'),(2657,'TB patients given 2RHZE/2HR weighing 12-15.9kg','TB patients given 2RHZE/2HR weighing 12-15.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing 12-15.9kg\n TB patients given 2RHZE/2HR weighing 12-15.9kg\n \n 2024-02-28 10:10:49 UTC\n \n 2024-02-28 10:11:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2657\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6005 -- 2RHZE/2HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=12 and _weight <=15.9 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:40:49',4,'2024-02-28 15:41:59',4,0,NULL,NULL,NULL,'2da2a070-b7ba-4cd7-90c5-41cddf07a601'),(2658,'TB patients given 2RHZE/2HR weighing 16-24.9kg','TB patients given 2RHZE/2HR weighing 16-24.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing 16-24.9kg\n TB patients given 2RHZE/2HR weighing 16-24.9kg\n \n 2024-02-28 10:12:34 UTC\n \n 2024-02-28 10:13:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2658\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6005 -- 2RHZE/2HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=16 and _weight <=24.9 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:42:34',4,'2024-02-28 15:43:58',4,0,NULL,NULL,NULL,'ecfd9cec-ff1f-4d86-b760-18ee712a0d36'),(2659,'TB patients given 2RHZE/2HR weighing 25-<30kg','TB patients given 2RHZE/2HR weighing 25-<30kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing 25-<30kg\n TB patients given 2RHZE/2HR weighing 25-<30kg\n \n 2024-02-28 10:13:03 UTC\n \n 2024-02-28 10:14:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2659\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6005 -- 2RHZE/2HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=25 and _weight <30 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:43:03',4,'2024-02-28 15:44:18',4,0,NULL,NULL,NULL,'66c43d8e-18e2-41e5-a0b0-501a2b508a22'),(2660,'TB patients given 2RHZE/2HR weighing 30-<35kg','TB patients given 2RHZE/2HR weighing 30-<35kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing 30-<35kg\n TB patients given 2RHZE/2HR weighing 30-<35kg\n \n 2024-02-28 10:13:24 UTC\n \n 2024-02-28 10:14:35 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2660\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6005 -- 2RHZE/2HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=30 and _weight <35 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:43:24',4,'2024-02-28 15:44:35',4,0,NULL,NULL,NULL,'362a2af4-9cdc-4380-8631-4188d1354417'),(2661,'TB patients given 2RHZE/2HR weighing 35-<50kg','TB patients given 2RHZE/2HR weighing 35-<50kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing 35-<50kg\n TB patients given 2RHZE/2HR weighing 35-<50kg\n \n 2024-02-28 10:15:06 UTC\n \n 2024-02-28 10:16:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2661\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6005 -- 2RHZE/2HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=35 and _weight <50 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:45:06',4,'2024-02-28 15:46:29',4,0,NULL,NULL,NULL,'210d7eb7-846b-42fe-a1e5-c47bc1450cb6'),(2662,'TB patients given 2RHZE/2HR weighing 50-<65kg','TB patients given 2RHZE/2HR weighing 50-<65kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing 50-<65kg\n TB patients given 2RHZE/2HR weighing 50-<65kg\n \n 2024-02-28 10:15:34 UTC\n \n 2024-02-28 10:17:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2662\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6005 -- 2RHZE/2HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=50 and _weight <65 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:45:34',4,'2024-02-28 15:47:01',4,0,NULL,NULL,NULL,'8662ce61-9594-487c-9c1c-c683a2f95180'),(2663,'TB patients given 2RHZE/2HR weighing >65kg','TB patients given 2RHZE/2HR weighing >65kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing >65kg\n TB patients given 2RHZE/2HR weighing >65kg\n \n 2024-02-28 10:16:01 UTC\n \n 2024-02-28 10:36:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2663\n select regimen.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4218 and o.value_coded = 6005 -- 2RHZE/2HR \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)regimen \n \ninner join \n \n(SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n AND CAST(oss.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by oss.person_id)AS weight_ \n where _weight>=65 \n)weight__ \nON regimen.Id = weight__.Id\n','2024-02-28 15:46:01',4,'2024-02-28 16:06:50',4,0,NULL,NULL,NULL,'d0c91360-93f7-4b62-a335-38d1f9e8e458'),(2664,'TB patients given 2HPMZ/2HPM weighing 40-50kg','TB patients given 2HPMZ/2HPM weighing 40-50kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HPMZ/2HPM weighing 40-50kg\n TB patients given 2HPMZ/2HPM weighing 40-50kg\n \n 2024-02-28 10:38:37 UTC\n \n 2024-02-28 10:40:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2664\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 16:08:37',4,'2024-02-28 16:10:21',4,0,NULL,NULL,NULL,'267131cd-92f8-4d89-9153-7666479e3d96'),(2665,'TB patients given 2HPMZ/2HPM weighing 50-65kg','TB patients given 2HPMZ/2HPM weighing 50-65kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HPMZ/2HPM weighing 50-65kg\n TB patients given 2HPMZ/2HPM weighing 50-65kg\n \n 2024-02-28 10:40:43 UTC\n \n 2024-02-28 10:42:38 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2665\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 16:10:43',4,'2024-02-28 16:12:38',4,0,NULL,NULL,NULL,'a2cce7b4-84b0-407c-a850-045310956d08'),(2666,'TB patients given 2HPMZ/2HPM weighing > 65kg','TB patients given 2HPMZ/2HPM weighing > 65kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HPMZ/2HPM weighing > 65kg\n TB patients given 2HPMZ/2HPM weighing > 65kg\n \n 2024-02-28 10:41:20 UTC\n \n 2024-02-28 10:43:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2666\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 16:11:20',4,'2024-02-28 16:13:29',4,0,NULL,NULL,NULL,'66aa10a3-2291-4f8a-a710-af0231160982'),(2667,'TB patients given 2RHZE/4RHE weighing 30-39kg','TB patients given 2RHZE/4RHE weighing 30-39kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4RHE weighing 30-39kg\n TB patients given 2RHZE/4RHE weighing 30-39kg\n \n 2024-02-28 10:45:02 UTC\n \n 2024-02-28 10:47:52 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2667\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 16:15:02',4,'2024-02-28 16:17:52',4,0,NULL,NULL,NULL,'507430f5-598c-485d-876a-0e1dbcdaea22'),(2668,'TB patients given 2RHZE/4RHE weighing 40-54kg','TB patients given 2RHZE/4RHE weighing 40-54kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4RHE weighing 40-54kg\n TB patients given 2RHZE/4RHE weighing 40-54kg\n \n 2024-02-28 10:46:01 UTC\n \n 2024-02-28 10:48:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2668\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 16:16:01',4,'2024-02-28 16:18:15',4,0,NULL,NULL,NULL,'2d8b3440-8b64-4836-8097-0ee78b1421f9'),(2669,'TB patients given 2RHZE/4RHE weighing 55-70kg','TB patients given 2RHZE/4RHE weighing 55-70kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4RHE weighing 55-70kg\n TB patients given 2RHZE/4RHE weighing 55-70kg\n \n 2024-02-28 10:47:03 UTC\n \n COUNT\n','2024-02-28 16:17:03',4,NULL,NULL,0,NULL,NULL,NULL,'77aaf4be-b225-465a-b3dc-685757328958'),(2670,'TB patients given 2RHZE/4RHE weighing 55-70kg','TB patients given 2RHZE/4RHE weighing 55-70kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4RHE weighing 55-70kg\n TB patients given 2RHZE/4RHE weighing 55-70kg\n \n 2024-02-28 10:47:06 UTC\n \n 2024-02-28 10:49:09 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2670\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 16:17:06',4,'2024-02-28 16:19:09',4,0,NULL,NULL,NULL,'4ca65f2c-58a1-46f2-be7d-d2e0b8b52eca'),(2671,'TB patients given 2RHZE/4RHE weighing > 70','TB patients given 2RHZE/4RHE weighing > 70','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4RHE weighing > 70\n TB patients given 2RHZE/4RHE weighing > 70\n \n 2024-02-28 10:48:45 UTC\n \n 2024-02-28 10:51:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2671\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 16:18:45',4,'2024-02-28 16:21:07',4,0,NULL,NULL,NULL,'aacf0718-0185-42a7-8e9f-dc32a196d708'),(2672,'TB patients given 2RHZE/4HR weighing <2kg','TB patients given 2RHZE/4HR weighing <2kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing <2kg\n TB patients given 2RHZE/4HR weighing <2kg\n \n 2024-02-28 10:52:59 UTC\n \n 2024-02-28 10:55:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2672\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 16:22:59',4,'2024-02-28 16:25:06',4,0,NULL,NULL,NULL,'fcef6215-4d11-4edb-a132-3a001295eac7'),(2673,'TB patients given 2RHZE/4HR weighing 2-2.9kg','TB patients given 2RHZE/4HR weighing 2-2.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing 2-2.9kg\n TB patients given 2RHZE/4HR weighing 2-2.9kg\n \n 2024-02-28 10:53:34 UTC\n \n COUNT\n','2024-02-28 16:23:34',4,NULL,NULL,0,NULL,NULL,NULL,'a0f2d45a-30f4-4c5f-af64-3a6ccb151c33'),(2674,'TB patients given 2RHZE/4HR weighing 2-2.9kg','TB patients given 2RHZE/4HR weighing 2-2.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing 2-2.9kg\n TB patients given 2RHZE/4HR weighing 2-2.9kg\n \n 2024-02-28 10:53:37 UTC\n \n 2024-02-28 10:57:48 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2674\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 16:23:37',4,'2024-02-28 16:27:48',4,0,NULL,NULL,NULL,'a5aff9a2-2ff6-49ce-a1f9-5b2c07874d5c'),(2675,'TB patients given 2RHZE/4HR weighing 3-3.9kg','TB patients given 2RHZE/4HR weighing 3-3.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing 3-3.9kg\n TB patients given 2RHZE/4HR weighing 3-3.9kg\n \n 2024-02-28 10:56:04 UTC\n \n 2024-02-28 10:58:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2675\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 16:26:04',4,'2024-02-28 16:28:10',4,0,NULL,NULL,NULL,'06a8c0b0-b7a3-4443-b168-9816354d5519'),(2676,'TB patients given 2RHZE/4HR weighing 4-7.9kg','TB patients given 2RHZE/4HR weighing 4-7.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing 4-7.9kg\n TB patients given 2RHZE/4HR weighing 4-7.9kg\n \n 2024-02-28 10:57:21 UTC\n \n 2024-02-28 10:59:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2676\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 16:27:21',4,'2024-02-28 16:29:15',4,0,NULL,NULL,NULL,'fba7f805-6a0e-4a02-89fe-d8fe6491ff51'),(2677,'TB patients given 2RHZE/4HR weighing 8-11.9kg','TB patients given 2RHZE/4HR weighing 8-11.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing 8-11.9kg\n TB patients given 2RHZE/4HR weighing 8-11.9kg\n \n 2024-02-28 10:59:49 UTC\n \n 2024-02-28 11:03:52 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2677\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 16:29:49',4,'2024-02-28 16:33:52',4,0,NULL,NULL,NULL,'acb3c52b-cd20-4b33-8b0e-f8f8865d283c'),(2678,'TB patients given 2RHZE/4HR weighing 12-15.9kg','TB patients given 2RHZE/4HR weighing 12-15.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing 12-15.9kg\n TB patients given 2RHZE/4HR weighing 12-15.9kg\n \n 2024-02-28 11:00:16 UTC\n \n 2024-02-28 11:04:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2678\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 16:30:16',4,'2024-02-28 16:34:11',4,0,NULL,NULL,NULL,'af2dc223-8a19-46b1-b8ae-add6e943f891'),(2679,'TB patients given 2RHZE/4HR weighing 16-24.9kg','TB patients given 2RHZE/4HR weighing 16-24.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing 16-24.9kg\n TB patients given 2RHZE/4HR weighing 16-24.9kg\n \n 2024-02-28 11:00:43 UTC\n \n 2024-02-28 11:04:34 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2679\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 16:30:43',4,'2024-02-28 16:34:34',4,0,NULL,NULL,NULL,'693ddd70-5db7-46ba-8195-670f174b867f'),(2680,'TB patients given 2RHZE/4HR weighing 25-<30kg','TB patients given 2RHZE/4HR weighing 25-<30kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing 25-<30kg\n TB patients given 2RHZE/4HR weighing 25-<30kg\n \n 2024-02-28 11:01:10 UTC\n \n 2024-02-28 11:04:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2680\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 16:31:10',4,'2024-02-28 16:34:58',4,0,NULL,NULL,NULL,'2bd66740-4941-4932-8876-43e12c912ef0'),(2681,'TB patients given 2RHZE/4HR weighing 30-<35kg','TB patients given 2RHZE/4HR weighing 30-<35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing 30-<35kg\n TB patients given 2RHZE/4HR weighing 30-<35kg\n \n 2024-02-28 11:05:44 UTC\n \n 2024-02-28 11:08:52 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2681\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 16:35:44',4,'2024-02-28 16:38:52',4,0,NULL,NULL,NULL,'5201f808-7174-4785-b5a8-fb855cb1bc00'),(2682,'TB patients given 2RHZE/4HR weighing 35-<50kg','TB patients given 2RHZE/4HR weighing 35-<50kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing 35-<50kg\n TB patients given 2RHZE/4HR weighing 35-<50kg\n \n 2024-02-28 11:07:34 UTC\n \n 2024-02-28 11:10:34 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2682\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 16:37:34',4,'2024-02-28 16:40:34',4,0,NULL,NULL,NULL,'663aa7b1-0169-4cd3-aabb-1d33b0a54706'),(2683,'TB patients given 2RHZE/4HR weighing 50-<65kg','TB patients given 2RHZE/4HR weighing 50-<65kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing 50-<65kg\n TB patients given 2RHZE/4HR weighing 50-<65kg\n \n 2024-02-28 11:07:58 UTC\n \n 2024-02-28 11:10:49 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2683\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 16:37:58',4,'2024-02-28 16:40:49',4,0,NULL,NULL,NULL,'a07688e5-85a2-468b-9dc8-13a8c1100b47'),(2684,'TB patients given 2RHZE/4HR weighing >65kg','TB patients given 2RHZE/4HR weighing >65kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/4HR weighing >65kg\n TB patients given 2RHZE/4HR weighing >65kg\n \n 2024-02-28 11:08:27 UTC\n \n 2024-02-28 11:11:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2684\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 16:38:27',4,'2024-02-28 16:41:07',4,0,NULL,NULL,NULL,'70b78a75-3be5-4dc5-a191-21ce2d9621ee'),(2685,'TB patients given 2HRE/10HR weighing < 2kg','TB patients given 2HRE/10HR weighing < 2kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing < 2kg\n TB patients given 2HRE/10HR weighing < 2kg\n \n 2024-02-28 13:08:41 UTC\n \n 2024-02-28 13:14:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2685\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 18:38:41',4,'2024-02-28 18:44:55',4,0,NULL,NULL,NULL,'e8ffcdff-a39c-463b-8da6-a622ef5cefaf'),(2686,'TB patients given 2HRE/10HR weighing 2-2.9kg','TB patients given 2HRE/10HR weighing 2-2.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing 2-2.9kg\n TB patients given 2HRE/10HR weighing 2-2.9kg\n \n 2024-02-28 13:09:10 UTC\n \n 2024-02-28 13:15:22 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2686\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 18:39:10',4,'2024-02-28 18:45:22',4,0,NULL,NULL,NULL,'fd54220d-0eea-4c40-91d3-6842888ba3b5'),(2687,'TB patients given 2HRE/10HR weighing 3-3.9kg','TB patients given 2HRE/10HR weighing 3-3.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing 3-3.9kg\n TB patients given 2HRE/10HR weighing 3-3.9kg\n \n 2024-02-28 13:09:39 UTC\n \n 2024-02-28 13:16:19 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2687\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 18:39:39',4,'2024-02-28 18:46:19',4,0,NULL,NULL,NULL,'be84889c-0395-437b-9400-c2a7e8eb2ccf'),(2688,'TB patients given 2HRE/10HR weighing 4-7.9kg','TB patients given 2HRE/10HR weighing 4-7.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing 4-7.9kg\n TB patients given 2HRE/10HR weighing 4-7.9kg\n \n 2024-02-28 13:10:10 UTC\n \n 2024-02-28 13:16:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2688\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 18:40:10',4,'2024-02-28 18:46:40',4,0,NULL,NULL,NULL,'a204e666-8840-4614-bf83-af7330f68aaa'),(2689,'TB patients given 2HRE/10HR weighing 8-11.9kg','TB patients given 2HRE/10HR weighing 8-11.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing 8-11.9kg\n TB patients given 2HRE/10HR weighing 8-11.9kg\n \n 2024-02-28 13:17:57 UTC\n \n 2024-02-28 13:23:09 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2689\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 18:47:57',4,'2024-02-28 18:53:09',4,0,NULL,NULL,NULL,'139114c2-da7a-4749-89b4-e99e72994d81'),(2690,'TB patients given 2HRE/10HR weighing 12-15.9kg','TB patients given 2HRE/10HR weighing 12-15.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing 12-15.9kg\n TB patients given 2HRE/10HR weighing 12-15.9kg\n \n 2024-02-28 13:19:00 UTC\n \n 2024-02-28 13:23:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2690\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 18:49:00',4,'2024-02-28 18:53:27',4,0,NULL,NULL,NULL,'346da8a7-01a5-4c66-b438-15b66599e85d'),(2691,'TB patients given 2HRE/10HR weighing 16-24.9kg','TB patients given 2HRE/10HR weighing 16-24.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing 16-24.9kg\n TB patients given 2HRE/10HR weighing 16-24.9kg\n \n 2024-02-28 13:19:33 UTC\n \n 2024-02-28 13:23:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2691\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 18:49:33',4,'2024-02-28 18:53:55',4,0,NULL,NULL,NULL,'697a3eab-7fc5-4656-b90c-c8f503ba104e'),(2692,'TB patients given 2HRE/10HR weighing 25-<30kg','TB patients given 2HRE/10HR weighing 25-<30kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing 25-<30kg\n TB patients given 2HRE/10HR weighing 25-<30kg\n \n 2024-02-28 13:20:00 UTC\n \n 2024-02-28 13:24:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2692\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 18:50:00',4,'2024-02-28 18:54:21',4,0,NULL,NULL,NULL,'9aaeb85e-bf5b-4cfd-ac28-53cdb1bd4675'),(2693,'TB patients given 2HRE/10HR weighing 30-<35kg','TB patients given 2HRE/10HR weighing 30-<35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing 30-<35kg\n TB patients given 2HRE/10HR weighing 30-<35kg\n \n 2024-02-28 13:26:24 UTC\n \n 2024-02-28 13:30:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2693\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 18:56:24',4,'2024-02-28 19:00:36',4,0,NULL,NULL,NULL,'614b47d9-f71d-43f7-9f20-348a7341b425'),(2694,'TB patients given 2HRE/10HR weighing 35-<50kg','TB patients given 2HRE/10HR weighing 35-<50kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing 35-<50kg\n TB patients given 2HRE/10HR weighing 35-<50kg\n \n 2024-02-28 13:27:03 UTC\n \n 2024-02-28 13:30:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2694\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 18:57:03',4,'2024-02-28 19:00:58',4,0,NULL,NULL,NULL,'90a894c8-2f13-45b8-a9ff-718cc0b5d958'),(2695,'TB patients given 2HRE/10HR weighing 50-<65kg','TB patients given 2HRE/10HR weighing 50-<65kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing 50-<65kg\n TB patients given 2HRE/10HR weighing 50-<65kg\n \n 2024-02-28 13:27:34 UTC\n \n 2024-02-28 13:31:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2695\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 18:57:34',4,'2024-02-28 19:01:21',4,0,NULL,NULL,NULL,'310e9e3a-ae90-4d16-b876-81d55f05e601'),(2696,'TB patients given 2HRE/10HR weighing > 65kg','TB patients given 2HRE/10HR weighing > 65kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2HRE/10HR weighing > 65kg\n TB patients given 2HRE/10HR weighing > 65kg\n \n 2024-02-28 13:28:06 UTC\n \n 2024-02-28 13:31:54 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2696\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 18:58:06',4,'2024-02-28 19:01:54',4,0,NULL,NULL,NULL,'fb06b275-034c-492c-bb27-10bef23fce0d'),(2697,'TB patients given 2RHZE/2HR weighing 2-2.9kg','TB patients given 2RHZE/2HR weighing 2-2.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing 2-2.9kg\n TB patients given 2RHZE/2HR weighing 2-2.9kg\n \n 2024-02-28 13:38:38 UTC\n \n 2024-02-28 13:43:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2697\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 19:08:38',4,'2024-02-28 19:13:00',4,0,NULL,NULL,NULL,'d5432933-9558-4f54-8f6e-abc5e9a0223b'),(2698,'TB patients given 2RHZE/2HR weighing 3-3.9kg','TB patients given 2RHZE/2HR weighing 3-3.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing 3-3.9kg\n TB patients given 2RHZE/2HR weighing 3-3.9kg\n \n 2024-02-28 13:39:06 UTC\n \n 2024-02-28 13:48:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2698\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 19:09:06',4,'2024-02-28 19:18:32',4,0,NULL,NULL,NULL,'9379b271-3680-47a4-a2be-8145d4e58fa0'),(2699,'TB patients given 2RHZE/2HR weighing 4-7.9kg','TB patients given 2RHZE/2HR weighing 4-7.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing 4-7.9kg\n TB patients given 2RHZE/2HR weighing 4-7.9kg\n \n 2024-02-28 13:40:21 UTC\n \n 2024-02-28 13:48:54 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2699\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 19:10:21',4,'2024-02-28 19:18:54',4,0,NULL,NULL,NULL,'c0729714-b7a1-4c39-b44a-dd01fcb1aecc'),(2700,'TB patients given 2RHZE/2HR weighing 8-11.9kg','TB patients given 2RHZE/2HR weighing 8-11.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing 8-11.9kg\n TB patients given 2RHZE/2HR weighing 8-11.9kg\n \n 2024-02-28 13:42:30 UTC\n \n 2024-02-28 13:51:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2700\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 19:12:30',4,'2024-02-28 19:21:42',4,0,NULL,NULL,NULL,'17375042-6d27-4096-a84b-bbe596fd7580'),(2701,'TB patients given 2RHZE/2HR weighing 12-15.9kg','TB patients given 2RHZE/2HR weighing 12-15.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing 12-15.9kg\n TB patients given 2RHZE/2HR weighing 12-15.9kg\n \n 2024-02-28 14:06:02 UTC\n \n 2024-02-28 14:14:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2701\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 19:36:02',4,'2024-02-28 19:44:26',4,0,NULL,NULL,NULL,'57ab8f00-8036-404f-9365-a541b14bca39'),(2702,'TB patients given 2RHZE/2HR weighing 16-24.9kg','TB patients given 2RHZE/2HR weighing 16-24.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing 16-24.9kg\n TB patients given 2RHZE/2HR weighing 16-24.9kg\n \n 2024-02-28 14:07:12 UTC\n \n 2024-02-28 14:14:09 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2702\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 19:37:12',4,'2024-02-28 19:44:09',4,0,NULL,NULL,NULL,'385c3355-f68b-4e23-9658-503b7056e688'),(2703,'TB patients given 2RHZE/2HR weighing 25-<30kg','TB patients given 2RHZE/2HR weighing 25-<30kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing 25-<30kg\n TB patients given 2RHZE/2HR weighing 25-<30kg\n \n 2024-02-28 14:08:18 UTC\n \n 2024-02-28 14:13:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2703\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 19:38:18',4,'2024-02-28 19:43:50',4,0,NULL,NULL,NULL,'ee38e990-b599-423f-8a88-51ab26f92f1c'),(2704,'TB patients given 2RHZE/2HR weighing < 2kg','TB patients given 2RHZE/2HR weighing < 2kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing < 2kg\n TB patients given 2RHZE/2HR weighing < 2kg\n \n 2024-02-28 14:10:05 UTC\n \n 2024-02-28 14:13:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2704\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 19:40:05',4,'2024-02-28 19:43:31',4,0,NULL,NULL,NULL,'316b34a7-3579-4f2a-9c1e-59ab23cc0188'),(2705,'TB patients given 2RHZE/2HR weighing 30-<35kg','TB patients given 2RHZE/2HR weighing 30-<35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing 30-<35kg\n TB patients given 2RHZE/2HR weighing 30-<35kg\n \n 2024-02-28 14:15:59 UTC\n \n COUNT\n','2024-02-28 19:45:59',4,NULL,NULL,0,NULL,NULL,NULL,'979c7335-0622-4f85-a7cf-2b64b47c7cbf'),(2706,'TB patients given 2RHZE/2HR weighing 30-<35kg','TB patients given 2RHZE/2HR weighing 30-<35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing 30-<35kg\n TB patients given 2RHZE/2HR weighing 30-<35kg\n \n 2024-02-28 14:15:59 UTC\n \n 2024-02-28 14:19:57 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2706\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 19:45:59',4,'2024-02-28 19:49:57',4,0,NULL,NULL,NULL,'db9dc079-bbf6-42dc-958e-c7c002c4e97c'),(2707,'TB patients given 2RHZE/2HR weighing 35-<50kg','TB patients given 2RHZE/2HR weighing 35-<50kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing 35-<50kg\n TB patients given 2RHZE/2HR weighing 35-<50kg\n \n 2024-02-28 14:16:32 UTC\n \n 2024-02-28 14:19:49 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2707\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 19:46:32',4,'2024-02-28 19:49:49',4,0,NULL,NULL,NULL,'cb160b1b-14c9-4b6d-b4f5-b0287f0ee584'),(2708,'TB patients given 2RHZE/2HR weighing 50-<65kg','TB patients given 2RHZE/2HR weighing 50-<65kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing 50-<65kg\n TB patients given 2RHZE/2HR weighing 50-<65kg\n \n 2024-02-28 14:17:00 UTC\n \n 2024-02-28 14:21:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2708\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 19:47:00',4,'2024-02-28 19:51:28',4,0,NULL,NULL,NULL,'a605a26b-e6b2-4e39-8568-adea9afbe93c'),(2709,'TB patients given 2RHZE/2HR weighing >65kg','TB patients given 2RHZE/2HR weighing >65kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients given 2RHZE/2HR weighing >65kg\n TB patients given 2RHZE/2HR weighing >65kg\n \n 2024-02-28 14:17:28 UTC\n \n 2024-02-28 14:21:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2709\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-28 19:47:28',4,'2024-02-28 19:51:11',4,0,NULL,NULL,NULL,'79f70c54-0a3f-456a-bd82-f97868b651e3'),(2710,'TB Case Registration - Block 5','TB Case Registration - Block 5','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Case Registration - Block 5\n TB Case Registration - Block 5\n \n 2024-02-28 14:24:40 UTC\n \n 2024-02-28 14:25:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2710\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2024-02-28 19:54:40',4,'2024-02-28 19:55:12',4,0,NULL,NULL,NULL,'2043afe9-3ece-4901-a898-69be11ff0ac5'),(2711,'TB Case Registration - Block 5 Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Case Registration - Block 5 Data Set\n \n 2024-02-28 14:25:12 UTC\n \n 2024-02-29 09:52:37 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2711\n \n \n \n 2HPMZ_40-5\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n \n \n 2HPMZ_50-6\n \n \n \n \n \n \n \n \n \n 2HPMZ_65\n \n \n \n \n \n \n \n \n \n 2HRE/10H12\n \n \n \n \n \n \n \n \n \n 2HRE/10H16\n \n \n \n \n \n \n \n \n \n 2HRE/10H2-\n \n \n \n \n \n \n \n \n \n 2HRE/10H25\n \n \n \n \n \n \n \n \n \n 2HRE/10H3-\n \n \n \n \n \n \n \n \n \n 2HRE/10H30\n \n \n \n \n \n \n \n \n \n 2HRE/10H35\n \n \n \n \n \n \n \n \n \n 2HRE/10H4-\n \n \n \n \n \n \n \n \n \n 2HRE/10H50\n \n \n \n \n \n \n \n \n \n 2HRE/10H65\n \n \n \n \n \n \n \n \n \n 2HRE/10H8-\n \n \n \n \n \n \n \n \n \n 2HRE/10H<2\n \n \n \n \n \n \n \n \n \n 2RHZE/2H12\n \n \n \n \n \n \n \n \n \n 2RHZE/2H16\n \n \n \n \n \n \n \n \n \n 2RHZE/2H2-\n \n \n \n \n \n \n \n \n \n 2RHZE/2H25\n \n \n \n \n \n \n \n \n \n 2RHZE/2H3-\n \n \n \n \n \n \n \n \n \n 2RHZE/2H30\n \n \n \n \n \n \n \n \n \n 2RHZE/2H35\n \n \n \n \n \n \n \n \n \n 2RHZE/2H4-\n \n \n \n \n \n \n \n \n \n 2RHZE/2H50\n \n \n \n \n \n \n \n \n \n 2RHZE/2H65\n \n \n \n \n \n \n \n \n \n 2RHZE/2H8-\n \n \n \n \n \n \n \n \n \n 2RHZE/2H<2\n \n \n \n \n \n \n \n \n \n 2RHZE/4H12\n \n \n \n \n \n \n \n \n \n 2RHZE/4H16\n \n \n \n \n \n \n \n \n \n 2RHZE/4H2-\n \n \n \n \n \n \n \n \n \n 2RHZE/4H25\n \n \n \n \n \n \n \n \n \n 2RHZE/4H3-\n \n \n \n \n \n \n \n \n \n 2RHZE/4H30\n \n \n \n \n \n \n \n \n \n 2RHZE/4H35\n \n \n \n \n \n \n \n \n \n 2RHZE/4H4-\n \n \n \n \n \n \n \n \n \n 2RHZE/4H50\n \n \n \n \n \n \n \n \n \n 2RHZE/4H65\n \n \n \n \n \n \n \n \n \n 2RHZE/4H8-\n \n \n \n \n \n \n \n \n \n 2RHZE/4H<2\n \n \n \n \n \n \n \n \n \n 2RHZE/4R30\n \n \n \n \n \n \n \n \n \n 2RHZE/4R40\n \n \n \n \n \n \n \n \n \n 2RHZE/4R55\n \n \n \n \n \n \n \n \n \n 2RHZE/4R70\n \n \n \n \n \n \n \n \n \n','2024-02-28 19:55:12',4,'2024-02-29 15:22:37',4,0,NULL,NULL,NULL,'8be20f45-e610-469e-b1ba-5b16a08a151f'),(2712,'TB patients diagnosed with GeneXpert - sputum','TB patients diagnosed with GeneXpert - sputum','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients diagnosed with GeneXpert - sputum\n TB patients diagnosed with GeneXpert - sputum\n \n 2024-02-29 13:40:42 UTC\n \n 2024-02-29 13:41:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2712\n select diagnosis.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_diagnosis \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 3814 and o.value_coded = 3824 -- GeneXpert Sputum \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)diagnosis \n\n','2024-02-29 19:10:42',4,'2024-02-29 19:11:05',4,0,NULL,NULL,NULL,'d8a123a8-d4f2-454d-be8b-bb9ccd11c979'),(2713,'TB patients diagnosed with LPA','TB patients diagnosed with LPA','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients diagnosed with LPA\n TB patients diagnosed with LPA\n \n 2024-02-29 13:42:00 UTC\n \n 2024-02-29 13:42:37 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2713\n select diagnosis.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_diagnosis \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 3814 and o.value_coded = 3825 -- LPA \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)diagnosis\n','2024-02-29 19:12:00',4,'2024-02-29 19:12:37',4,0,NULL,NULL,NULL,'dbc7ab7e-b251-43e3-b9fc-78250f1dc6d2'),(2714,'TB patients diagnosed with smear microscopy','TB patients diagnosed with smear microscopy','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients diagnosed with smear microscopy\n TB patients diagnosed with smear microscopy\n \n 2024-02-29 13:47:25 UTC\n \n 2024-02-29 13:48:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2714\n select diagnosis.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_diagnosis \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 3815 and o.value_coded = 3819 -- Smear microscopy \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)diagnosis\n','2024-02-29 19:17:25',4,'2024-02-29 19:18:20',4,0,NULL,NULL,NULL,'86c13563-ee30-4fbe-9ee2-3ba5baa43b99'),(2715,'TB patients diagnosed with Culture','TB patients diagnosed with Culture','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients diagnosed with Culture\n TB patients diagnosed with Culture\n \n 2024-02-29 13:50:16 UTC\n \n 2024-02-29 13:50:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2715\n select diagnosis.Id \nfrom \n(select distinct o.person_id as Id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS TB_diagnosis \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 3815 and o.value_coded = 3819 -- Smear microscopy \n AND o.voided = 0 \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by person_id)diagnosis\n','2024-02-29 19:20:16',4,'2024-02-29 19:20:55',4,0,NULL,NULL,NULL,'bb273381-7ea5-4c12-83fd-5f6e7e10e853'),(2716,'TB patients diagnosed with Culture','TB patients diagnosed with Culture','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients diagnosed with Culture\n TB patients diagnosed with Culture\n \n 2024-02-29 14:01:00 UTC\n \n 2024-02-29 14:06:16 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2716\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-29 19:31:00',4,'2024-02-29 19:36:16',4,0,NULL,NULL,NULL,'b9218e8a-e0af-48a8-8107-dcc9a9a7a066'),(2717,'TB patients diagnosed with GeneXpert - sputum','TB patients diagnosed with GeneXpert - sputum','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients diagnosed with GeneXpert - sputum\n TB patients diagnosed with GeneXpert - sputum\n \n 2024-02-29 14:10:38 UTC\n \n COUNT\n','2024-02-29 19:40:38',4,NULL,NULL,0,NULL,NULL,NULL,'3a5d9a42-ab26-4205-b5a2-f2f53ea6c5bc'),(2718,'TB patients diagnosed with GeneXpert - sputum','TB patients diagnosed with GeneXpert - sputum','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients diagnosed with GeneXpert - sputum\n TB patients diagnosed with GeneXpert - sputum\n \n 2024-02-29 14:10:40 UTC\n \n 2024-02-29 14:35:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2718\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-29 19:40:40',4,'2024-02-29 20:05:27',4,0,NULL,NULL,NULL,'a9c92543-222b-490d-bfa3-d2bcb6825eec'),(2719,'TB patients diagnosed with LPA','TB patients diagnosed with LPA','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients diagnosed with LPA\n TB patients diagnosed with LPA\n \n 2024-02-29 14:36:14 UTC\n \n 2024-02-29 14:38:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2719\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-29 20:06:14',4,'2024-02-29 20:08:26',4,0,NULL,NULL,NULL,'7b6eb2f0-56a4-4c91-81c2-1e4abb4e98d2'),(2720,'TB patients diagnosed with smear microscopy','TB patients diagnosed with smear microscopy','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB patients diagnosed with smear microscopy\n TB patients diagnosed with smear microscopy\n \n 2024-02-29 14:37:25 UTC\n \n 2024-02-29 14:39:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2720\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2024-02-29 20:07:25',4,'2024-02-29 20:09:11',4,0,NULL,NULL,NULL,'a27eacbd-b0a6-446f-950f-0402e720c4bb'),(2721,'TB Case Registration - Block 6','TB Case Registration - Block 6','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Case Registration - Block 6\n TB Case Registration - Block 6\n \n 2024-02-29 14:51:54 UTC\n \n 2024-02-29 14:52:47 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2721\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2024-02-29 20:21:54',4,'2024-02-29 20:22:47',4,0,NULL,NULL,NULL,'aeb7f90e-d61b-49b3-ae0f-6940f6d50c47'),(2724,'TB Case Registration - Block 6 Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Case Registration - Block 6 Data Set\n \n 2024-02-29 14:52:47 UTC\n \n 2024-02-29 15:07:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2724\n \n \n \n Culture\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n \n \n GeneX_sput\n \n \n \n \n \n \n \n \n \n LPA\n \n \n \n \n \n \n \n \n \n Smear_micr\n \n \n \n \n \n \n \n \n \n','2024-02-29 20:22:47',4,'2024-02-29 20:37:45',4,0,NULL,NULL,NULL,'7db12160-92c5-4680-8972-988b5bdd2157'),(2725,'TB Case Registration - Block 6 Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Case Registration - Block 6 Data Set\n \n 2024-02-29 14:54:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n \n \n','2024-02-29 20:24:55',4,NULL,NULL,0,NULL,NULL,NULL,'dcdae370-ec79-44e6-9231-e5ab06942acf'),(2726,'TB Case Registration - Block 6 Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Case Registration - Block 6 Data Set\n \n 2024-02-29 14:55:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n \n \n','2024-02-29 20:25:05',4,NULL,NULL,0,NULL,NULL,NULL,'0613568a-14f8-488c-9721-431f1ab21e93'); /*!40000 ALTER TABLE `serialized_object` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; @@ -84,4 +84,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2024-02-29 20:10:22 +-- Dump completed on 2024-02-29 20:43:32 From 0cbea9fb4ac2bb7f0ba86ec717b42caae1faf728 Mon Sep 17 00:00:00 2001 From: seapehim Date: Fri, 1 Mar 2024 10:37:29 +0200 Subject: [PATCH 3/3] Renamed Block 1 indicators --- Serialized_Object.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Serialized_Object.sql b/Serialized_Object.sql index c5a85ef..e3a3184 100644 --- a/Serialized_Object.sql +++ b/Serialized_Object.sql @@ -67,7 +67,7 @@ INSERT INTO `serialized_object` VALUES (1157,'VL-24 Detectable VL test results', INSERT INTO `serialized_object` VALUES (1302,'PITC_HTS_Outreach Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_HTS_Outreach Data Set\n \n 2021-09-30 13:53:05 UTC\n \n 2021-09-30 14:40:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1302\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Finer_Age\n \n \n \n \n \n \n \n \n NNegF1-4\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 01-04yrs\n \n \n \n \n \n NNegF10-14\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 10-14yrs\n \n \n \n \n \n NNegF15-19\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 15-19yrs\n \n \n \n \n \n NNegF20-24\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 20-24yrs\n \n \n \n \n \n NNegF25-29\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 25-29yrs\n \n \n \n \n \n NNegF30-34\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 30-34yrs\n \n \n \n \n \n NNegF35-39\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 35-39yrs\n \n \n \n \n \n NNegF40-44\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 40-44yrs\n \n \n \n \n \n NNegF45-49\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 45-49yrs\n \n \n \n \n \n NNegF5-9\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 05-09yrs\n \n \n \n \n \n NNegF50Plu\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 50Plus\n \n \n \n \n \n NNegF<1\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n Under1yr\n \n \n \n \n \n NNegM1-4\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 01-04yrs\n \n \n \n \n \n NNegM10-14\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 10-14yrs\n \n \n \n \n \n NNegM15-19\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 15-19yrs\n \n \n \n \n \n NNegM20-24\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 20-24yrs\n \n \n \n \n \n NNegM25-29\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 25-29yrs\n \n \n \n \n \n NNegM30-34\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 30-34yrs\n \n \n \n \n \n NNegM35-39\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 35-39yrs\n \n \n \n \n \n NNegM40-44\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 40-44yrs\n \n \n \n \n \n NNegM45-49\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 45-49yrs\n \n \n \n \n \n NNegM5-9\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 05-09yrs\n \n \n \n \n \n NNegM50Plu\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 50Plus\n \n \n \n \n \n NNegM<1\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n Under1yr\n \n \n \n \n \n NPosF1-4\n \n \n \n \n \n \n \n \n \n NPosF10-14\n \n \n \n \n \n \n NPosF15-19\n \n \n \n \n \n \n NPosF20-24\n \n \n \n \n \n \n NPosF25-29\n \n \n \n \n \n \n NPosF30-34\n \n \n \n \n \n \n NPosF35-39\n \n \n \n \n \n \n NPosF40-44\n \n \n \n \n \n \n NPosF45-49\n \n \n \n \n \n \n NPosF5-9\n \n \n \n \n \n \n NPosF50Plu\n \n \n \n \n \n \n NPosF<1\n \n \n \n \n \n \n NPosM1-4\n \n \n \n \n \n \n NPosM10-14\n \n \n \n \n \n \n NPosM15-19\n \n \n \n \n \n \n NPosM20-24\n \n \n \n \n \n \n NPosM25-29\n \n \n \n \n \n \n NPosM30-34\n \n \n \n \n \n \n NPosM35-39\n \n \n \n \n \n \n NPosM40-44\n \n \n \n \n \n \n NPosM45-49\n \n \n \n \n \n \n NPosM5-9\n \n \n \n \n \n \n NPosM50Plu\n \n \n \n \n \n \n NPosM<1\n \n \n \n \n \n \n RNegF1-4\n \n \n \n \n \n \n \n \n \n RNegF10-14\n \n \n \n \n \n \n RNegF15-19\n \n \n \n \n \n \n RNegF20-24\n \n \n \n \n \n \n RNegF25-29\n \n \n \n \n \n \n RNegF30-34\n \n \n \n \n \n \n RNegF35-39\n \n \n \n \n \n \n RNegF40-44\n \n \n \n \n \n \n RNegF45-49\n \n \n \n \n \n \n RNegF5-9\n \n \n \n \n \n \n RNegF50Plu\n \n \n \n \n \n \n RNegF<1\n \n \n \n \n \n \n RNegM1-4\n \n \n \n \n \n \n RNegM10-14\n \n \n \n \n \n \n RNegM15-19\n \n \n \n \n \n \n RNegM20-24\n \n \n \n \n \n \n RNegM25-29\n \n \n \n \n \n \n RNegM30-34\n \n \n \n \n \n \n RNegM35-39\n \n \n \n \n \n \n RNegM40-44\n \n \n \n \n \n \n RNegM45-49\n \n \n \n \n \n \n RNegM5-9\n \n \n \n \n \n \n RNegM50Plu\n \n \n \n \n \n \n RNegM<1\n \n \n \n \n \n \n RPosF1-4\n \n \n \n \n \n \n \n \n \n RPosF10-14\n \n \n \n \n \n \n RPosF15-19\n \n \n \n \n \n \n RPosF20-24\n \n \n \n \n \n \n RPosF25-29\n \n \n \n \n \n \n RPosF30-34\n \n \n \n \n \n \n RPosF35-39\n \n \n \n \n \n \n RPosF40-44\n \n \n \n \n \n \n RPosF45-49\n \n \n \n \n \n \n RPosF5-9\n \n \n \n \n \n \n RPosF50Plu\n \n \n \n \n \n \n RPosF<1\n \n \n \n \n \n \n RPosM1-4\n \n \n \n \n \n \n RPosM10-14\n \n \n \n \n \n \n RPosM15-19\n \n \n \n \n \n \n RPosM20-24\n \n \n \n \n \n \n RPosM25-29\n \n \n \n \n \n \n RPosM30-34\n \n \n \n \n \n \n RPosM35-39\n \n \n \n \n \n \n RPosM40-44\n \n \n \n \n \n \n RPosM45\n \n \n \n \n \n \n RPosM5-9\n \n \n \n \n \n \n RPosM50Plu\n \n \n \n \n \n \n RPosM<1\n \n \n \n \n \n \n','2021-09-30 15:53:05',4,'2021-09-30 16:40:26',4,0,NULL,NULL,NULL,'617f0c89-e7d6-4e28-b9d0-77c22b59c8e8'),(1303,'CITC_New_Neg_Outreach','CITC_New_Neg_Outreach','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_New_Neg_Outreach\n CITC_New_Neg_Outreach\n \n 2021-09-30 19:52:49 UTC\n \n 2021-09-30 19:59:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1303\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-09-30 21:52:49',4,'2021-09-30 21:59:14',4,0,NULL,NULL,NULL,'d55affa6-233e-42b7-b781-2d35bcb11d20'),(1304,'CITC_New_Pos_Outreach','CITC_New_Pos_Outreach','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_New_Pos_Outreach\n CITC_New_Pos_Outreach\n \n 2021-09-30 19:53:13 UTC\n \n 2021-09-30 20:04:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1304\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-09-30 21:53:13',4,'2021-09-30 22:04:23',4,0,NULL,NULL,NULL,'70d48a98-c83c-4d92-83eb-ecbb22050996'),(1305,'CITC_Repeat_Neg_Outreach','CITC_Repeat_Neg_Outreach','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_Repeat_Neg_Outreach\n CITC_Repeat_Neg_Outreach\n \n 2021-09-30 19:54:25 UTC\n \n 2021-09-30 20:06:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1305\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-09-30 21:54:25',4,'2021-09-30 22:06:45',4,0,NULL,NULL,NULL,'dcd9c782-fff7-4481-9f61-958f8484b9a0'),(1306,'CITC_Repeat_Pos_Outreach','CITC_Repeat_Pos_Outreach','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_Repeat_Pos_Outreach\n CITC_Repeat_Pos_Outreach\n \n 2021-09-30 19:55:31 UTC\n \n 2021-09-30 20:06:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1306\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-09-30 21:55:31',4,'2021-09-30 22:06:31',4,0,NULL,NULL,NULL,'37c3dd42-9503-4957-a234-d18cdd62a67a'),(1307,'CITC_HTS_Outreach','CITC_HTS_Outreach','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_HTS_Outreach\n CITC_HTS_Outreach\n \n 2021-09-30 20:03:27 UTC\n \n 2021-09-30 20:04:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1307\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2021-09-30 22:03:27',4,'2021-09-30 22:04:04',4,0,NULL,NULL,NULL,'6e3130f4-4993-4e26-adce-598c242565e9'),(1308,'CITC_HTS_Outreach Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_HTS_Outreach Data Set\n \n 2021-09-30 20:04:04 UTC\n \n 2021-09-30 22:06:25 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1308\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Finer_Age\n \n \n \n \n \n \n \n \n NNegF1-4\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 01-04yrs\n \n \n \n \n \n NNegF10\n \n \n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 10-14yrs\n \n \n \n \n \n NNegF15-19\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 15-19yrs\n \n \n \n \n \n NNegF20-24\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 20-24yrs\n \n \n \n \n \n NNegF25-29\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 25-29yrs\n \n \n \n \n \n NNegF30-34\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 30-34yrs\n \n \n \n \n \n NNegF35-39\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 35-39yrs\n \n \n \n \n \n NNegF40-44\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 40-44yrs\n \n \n \n \n \n NNegF45-49\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 45-49yrs\n \n \n \n \n \n NNegF5-9\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 05-09yrs\n \n \n \n \n \n NNegF50Plu\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 50Plus\n \n \n \n \n \n NNegF<1\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n Under1yr\n \n \n \n \n \n NNegM1-4\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 01-04yrs\n \n \n \n \n \n NNegM10-14\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 10-14yrs\n \n \n \n \n \n NNegM15-19\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 15-19yrs\n \n \n \n \n \n NNegM20-24\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 20-24yrs\n \n \n \n \n \n NNegM25-29\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 25-29yrs\n \n \n \n \n \n NNegM30-34\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 30-34yrs\n \n \n \n \n \n NNegM35-39\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 35-39yrs\n \n \n \n \n \n NNegM40-44\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 40-44yrs\n \n \n \n \n \n NNegM45-49\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 45-49yrs\n \n \n \n \n \n NNegM5-9\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 05-09yrs\n \n \n \n \n \n NNegM50Plu\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 50Plus\n \n \n \n \n \n NNegM<1\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n Under1yr\n \n \n \n \n \n NPosF1-4\n \n \n \n \n \n \n NPosF10-14\n \n \n \n \n \n \n NPosF15-19\n \n \n \n \n \n \n NPosF20-24\n \n \n \n \n \n \n NPosF25-29\n \n \n \n \n \n \n NPosF30-34\n \n \n \n \n \n \n NPosF35-39\n \n \n \n \n \n \n NPosF40-44\n \n \n \n \n \n \n NPosF45-49\n \n \n \n \n \n \n NPosF5-9\n \n \n \n \n \n \n NPosF50Plu\n \n \n \n \n \n \n NPosF<1\n \n \n \n \n \n \n NPosM1-4\n \n \n \n \n \n \n NPosM10-14\n \n \n \n \n \n \n NPosM15-19\n \n \n \n \n \n \n NPosM20-24\n \n \n \n \n \n \n NPosM25-29\n \n \n \n \n \n \n NPosM30-34\n \n \n \n \n \n \n NPosM35-39\n \n \n \n \n \n \n NPosM40-44\n \n \n \n \n \n \n NPosM45-49\n \n \n \n \n \n \n NPosM5-9\n \n \n \n \n \n \n NPosM50Plu\n \n \n \n \n \n \n NPosM<1\n \n \n \n \n \n \n RNegF1-4\n \n \n \n \n \n \n \n \n \n RNegF10-14\n \n \n \n \n \n \n RNegF15-19\n \n \n \n \n \n \n RNegF20-24\n \n \n \n \n \n \n RNegF25-29\n \n \n \n \n \n \n RNegF30-34\n \n \n \n \n \n \n RNegF35-39\n \n \n \n \n \n \n RNegF40-44\n \n \n \n \n \n \n RNegF45-49\n \n \n \n \n \n \n RNegF5-9\n \n \n \n \n \n \n RNegF50Plu\n \n \n \n \n \n \n RNegF<1\n \n \n \n \n \n \n RNegM1-4\n \n \n \n \n \n \n RNegM10-14\n \n \n \n \n \n \n RNegM15-19\n \n \n \n \n \n \n RNegM20-24\n \n \n \n \n \n \n RNegM25-29\n \n \n \n \n \n \n RNegM30-34\n \n \n \n \n \n \n RNegM35-39\n \n \n \n \n \n \n RNegM40-44\n \n \n \n \n \n \n RNegM45-49\n \n \n \n \n \n \n RNegM5-9\n \n \n \n \n \n \n RNegM50Plu\n \n \n \n \n \n \n RNegM<1\n \n \n \n \n \n \n RPosF1-4\n \n \n \n \n \n \n \n \n \n RPosF10-14\n \n \n \n \n \n \n RPosF15-19\n \n \n \n \n \n \n RPosF20-24\n \n \n \n \n \n \n RPosF25-29\n \n \n \n \n \n \n RPosF30-34\n \n \n \n \n \n \n RPosF35-39\n \n \n \n \n \n \n RPosF40-44\n \n \n \n \n \n \n RPosF45-49\n \n \n \n \n \n \n RPosF5-9\n \n \n \n \n \n \n RPosF50Plu\n \n \n \n \n \n \n RPosF<1\n \n \n \n \n \n \n RPosM1-4\n \n \n \n \n \n \n RPosM10-14\n \n \n \n \n \n \n RPosM15-19\n \n \n \n \n \n \n RPosM20-24\n \n \n \n \n \n \n RPosM25-29\n \n \n \n \n \n \n RPosM30-34\n \n \n \n \n \n \n RPosM35-39\n \n \n \n \n \n \n RPosM40-44\n \n \n \n \n \n \n RPosM45-49\n \n \n \n \n \n \n RPosM5-9\n \n \n \n \n \n \n RPosM50Plu\n \n \n \n \n \n \n RPosM<1\n \n \n \n \n \n \n','2021-09-30 22:04:04',4,'2021-10-01 00:06:25',4,0,NULL,NULL,NULL,'ac8c58c1-770c-4770-8418-4597c8b55c15'),(1309,' PITC_New_Neg_Adolescent',' PITC_New_Neg_Adolescent','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_New_Neg_Adolescent\n PITC_New_Neg_Adolescent\n \n 2021-10-05 20:43:32 UTC\n \n 2021-10-05 20:48:56 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1309\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-05 22:43:32',4,'2021-10-05 22:48:56',4,0,NULL,NULL,NULL,'6aa142db-2786-4b21-beba-0ec77f22b523'),(1310,' PITC_New_Pos_Adolescent',' PITC_New_Pos_Adolescent','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_New_Pos_Adolescent\n PITC_New_Pos_Adolescent\n \n 2021-10-05 20:45:02 UTC\n \n 2021-10-05 20:49:16 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1310\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-05 22:45:02',4,'2021-10-05 22:49:16',4,0,NULL,NULL,NULL,'8da0c564-e37c-447a-bb9c-81f65a635eae'),(1311,' PITC_Repeat_Neg_Adolescent',' PITC_Repeat_Neg_Adolescent','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_Repeat_Neg_Adolescent\n PITC_Repeat_Neg_Adolescent\n \n 2021-10-05 20:46:27 UTC\n \n 2021-10-05 20:50:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1311\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-05 22:46:27',4,'2021-10-05 22:50:02',4,0,NULL,NULL,NULL,'80d3e806-5077-42e0-9e5d-a89bd8579e73'),(1312,' PITC_Repeat_Pos_Adolescent',' PITC_Repeat_Pos_Adolescent','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_Repeat_Pos_Adolescent\n PITC_Repeat_Pos_Adolescent\n \n 2021-10-05 20:47:22 UTC\n \n 2021-10-05 20:50:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1312\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-05 22:47:22',4,'2021-10-05 22:50:21',4,0,NULL,NULL,NULL,'7ed0ead3-64c7-4529-9b3e-c82025462bb6'),(1313,'PITC_HTS_Adolescent','HTS Report for Adolescent location','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_HTS_Adolescent\n HTS Report for Adolescent location\n \n 2021-10-05 20:54:10 UTC\n \n 2021-10-05 20:54:35 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1313\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2021-10-05 22:54:10',4,'2021-10-05 22:54:35',4,0,NULL,NULL,NULL,'7f017fec-79d5-4ea6-87ba-be936e919d6b'),(1314,'PITC_HTS_Adolescent Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_HTS_Adolescent Data Set\n \n 2021-10-05 20:54:35 UTC\n \n 2021-10-06 06:00:38 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1314\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Finer_Age\n \n \n \n \n \n \n \n \n NNegF1-4\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 01-04yrs\n \n \n \n \n \n NNegF10-14\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 10-14yrs\n \n \n \n \n \n NNegF15-19\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 15-19yrs\n \n \n \n \n \n NNegF20-24\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 20-24yrs\n \n \n \n \n \n NNegF25-29\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 25-29yrs\n \n \n \n \n \n NNegF30-34\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 30-34yrs\n \n \n \n \n \n NNegF35-39\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 35-39yrs\n \n \n \n \n \n NNegF40-44\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 40-44yrs\n \n \n \n \n \n NNegF45-49\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 45-49yrs\n \n \n \n \n \n NNegF5-9\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 05-09yrs\n \n \n \n \n \n NNegF50Plu\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 50Plus\n \n \n \n \n \n NNegF<1\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n Under1yr\n \n \n \n \n \n NNegM1-4\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 01-04yrs\n \n \n \n \n \n NNegM10-14\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 10-14yrs\n \n \n \n \n \n NNegM15-19\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 15-19yrs\n \n \n \n \n \n NNegM20-24\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 20-24yrs\n \n \n \n \n \n NNegM25-29\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 25-29yrs\n \n \n \n \n \n NNegM30-34\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 30-34yrs\n \n \n \n \n \n NNegM35-39\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 35-39yrs\n \n \n \n \n \n NNegM40-44\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 40-44yrs\n \n \n \n \n \n NNegM45-49\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 45-49yrs\n \n \n \n \n \n NNegM5-9\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 05-09yrs\n \n \n \n \n \n NNegM50Plu\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 50Plus\n \n \n \n \n \n NNegM<1\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n Under1yr\n \n \n \n \n \n NPosF1-4\n \n \n \n \n \n \n \n \n \n NPosF10-14\n \n \n \n \n \n \n NPosF15-19\n \n \n \n \n \n \n NPosF20-24\n \n \n \n \n \n \n NPosF25-29\n \n \n \n \n \n \n NPosF30-34\n \n \n \n \n \n \n NPosF35-39\n \n \n \n \n \n \n NPosF40-44\n \n \n \n \n \n \n NPosF45-49\n \n \n \n \n \n \n NPosF5-9\n \n \n \n \n \n \n NPosF50Plu\n \n \n \n \n \n \n NPosF<1\n \n \n \n \n \n \n NPosM1-4\n \n \n \n \n \n \n NPosM10-14\n \n \n \n \n \n \n NPosM15-19\n \n \n \n \n \n \n NPosM20-24\n \n \n \n \n \n \n NPosM25-29\n \n \n \n \n \n \n NPosM30-34\n \n \n \n \n \n \n NPosM35-39\n \n \n \n \n \n \n NPosM40-44\n \n \n \n \n \n \n NPosM45-49\n \n \n \n \n \n \n NPosM5-9\n \n \n \n \n \n \n NPosM50Plu\n \n \n \n \n \n \n NPosM<1\n \n \n \n \n \n \n RNegF1-4\n \n \n \n \n \n \n \n \n \n RNegF10-14\n \n \n \n \n \n \n RNegF15-19\n \n \n \n \n \n \n RNegF20-24\n \n \n \n \n \n \n RNegF25-29\n \n \n \n \n \n \n RNegF30-34\n \n \n \n \n \n \n RNegF35-39\n \n \n \n \n \n \n RNegF40-44\n \n \n \n \n \n \n RNegF45-49\n \n \n \n \n \n \n RNegF5-9\n \n \n \n \n \n \n RNegF50\n \n \n \n \n \n \n RNegF<1\n \n \n \n \n \n \n RNegM1-4\n \n \n \n \n \n \n RNegM10-14\n \n \n \n \n \n \n RNegM15-19\n \n \n \n \n \n \n RNegM20-24\n \n \n \n \n \n \n RNegM25-29\n \n \n \n \n \n \n RNegM30-34\n \n \n \n \n \n \n RNegM35-39\n \n \n \n \n \n \n RNegM40-44\n \n \n \n \n \n \n RNegM45-49\n \n \n \n \n \n \n RNegM5-9\n \n \n \n \n \n \n RNegM50Plu\n \n \n \n \n \n \n RNegM<1\n \n \n \n \n \n \n RPosF1-4\n \n \n \n \n \n \n \n \n \n RPosF10-14\n \n \n \n \n \n \n RPosF15-19\n \n \n \n \n \n \n RPosF20-24\n \n \n \n \n \n \n RPosF25-29\n \n \n \n \n \n \n RPosF30-34\n \n \n \n \n \n \n RPosF35-39\n \n \n \n \n \n \n RPosF40-44\n \n \n \n \n \n \n RPosF45-49\n \n \n \n \n \n \n RPosF5-9\n \n \n \n \n \n \n RPosF50Plu\n \n \n \n \n \n \n RPosF<1\n \n \n \n \n \n \n RPosM1-4\n \n \n \n \n \n \n RPosM10-14\n \n \n \n \n \n \n RPosM15-19\n \n \n \n \n \n \n RPosM20-24\n \n \n \n \n \n \n RPosM25-29\n \n \n \n \n \n \n RPosM30-34\n \n \n \n \n \n \n RPosM35-39\n \n \n \n \n \n \n RPosM40-44\n \n \n \n \n \n \n RPosM45-49\n \n \n \n \n \n \n RPosM5-9\n \n \n \n \n \n \n RPosM50Plu\n \n \n \n \n \n \n RPosM<1\n \n \n \n \n \n \n','2021-10-05 22:54:35',4,'2021-10-06 08:00:38',4,0,NULL,NULL,NULL,'3559e185-9b49-4159-a276-bee817744132'),(1315,'CITC_New_Neg_Adolescent','CITC_New_Neg_Adolescent','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_New_Neg_Adolescent\n CITC_New_Neg_Adolescent\n \n 2021-10-06 09:39:49 UTC\n \n 2021-10-06 09:44:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1315\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-06 11:39:49',4,'2021-10-06 11:44:29',4,0,NULL,NULL,NULL,'eb91b86e-c2db-4d3b-8a67-7dc511379d4a'),(1316,'CITC_New_Pos_Adolescent','CITC_New_Pos_Adolescent','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_New_Pos_Adolescent\n CITC_New_Pos_Adolescent\n \n 2021-10-06 09:40:53 UTC\n \n 2021-10-06 09:44:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1316\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-06 11:40:53',4,'2021-10-06 11:44:45',4,0,NULL,NULL,NULL,'53065d6f-4498-41e0-92f5-907e584e85fa'),(1317,'CITC_Repeat_Neg_Adolescent','CITC_Repeat_Neg_Adolescent','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_Repeat_Neg_Adolescent\n CITC_Repeat_Neg_Adolescent\n \n 2021-10-06 09:41:27 UTC\n \n 2021-10-06 09:45:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1317\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-06 11:41:27',4,'2021-10-06 11:45:02',4,0,NULL,NULL,NULL,'787ad098-ef27-4117-9acf-28781458e03e'),(1318,'CITC_Repeat_Pos_Adolescent','CITC_Repeat_Pos_Adolescent','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_Repeat_Pos_Adolescent\n CITC_Repeat_Pos_Adolescent\n \n 2021-10-06 09:41:52 UTC\n \n 2021-10-06 09:45:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1318\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-06 11:41:52',4,'2021-10-06 11:45:17',4,0,NULL,NULL,NULL,'67dbab08-8fee-479d-a0af-ff4ac7dc8648'),(1319,'CITC_HTS_Adolescent','CITC_HTS_Adolescent','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_HTS_Adolescent\n CITC_HTS_Adolescent\n \n 2021-10-06 09:46:57 UTC\n \n 2021-10-06 09:47:25 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1319\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2021-10-06 11:46:57',4,'2021-10-06 11:47:25',4,0,NULL,NULL,NULL,'6992581e-4161-4f22-b90a-36dc1965ccfd'),(1320,'CITC_HTS_Adolescent Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_HTS_Adolescent Data Set\n \n 2021-10-06 09:47:25 UTC\n \n 2021-10-06 15:27:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1320\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Finer_Age\n \n \n \n \n \n \n \n \n NNegF1-4\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 01-04yrs\n \n \n \n \n \n NNegF10-14\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 10-14yrs\n \n \n \n \n \n NNegF15-19\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 15-19yrs\n \n \n \n \n \n NNegF20-24\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 20-24yrs\n \n \n \n \n \n NNegF25-29\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 25-29yrs\n \n \n \n \n \n NNegF30-34\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 30-34yrs\n \n \n \n \n \n NNegF35-39\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 35-39yrs\n \n \n \n \n \n NNegF40-44\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 40-44yrs\n \n \n \n \n \n NNegF45-49\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 45-49yrs\n \n \n \n \n \n NNegF5-9\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 05-09yrs\n \n \n \n \n \n NNegF50Plu\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 50Plus\n \n \n \n \n \n NNegF<1\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n Under1yr\n \n \n \n \n \n NNegM1-4\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 01-04yrs\n \n \n \n \n \n NNegM10-14\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 10-14yrs\n \n \n \n \n \n NNegM15-19\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 15-19yrs\n \n \n \n \n \n NNegM20-24\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 20-24yrs\n \n \n \n \n \n NNegM25-29\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 25-29yrs\n \n \n \n \n \n NNegM30-34\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 30-34yrs\n \n \n \n \n \n NNegM35-39\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 35-39yrs\n \n \n \n \n \n NNegM40-44\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 40-44yrs\n \n \n \n \n \n NNegM45-49\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 45-49yrs\n \n \n \n \n \n NNegM5-9\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 05-09yrs\n \n \n \n \n \n NNegM50Plu\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 50Plus\n \n \n \n \n \n NNegM<1\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n Under1yr\n \n \n \n \n \n NPosF1-4\n \n \n \n \n \n \n \n \n \n NPosF10-14\n \n \n \n \n \n \n NPosF15-19\n \n \n \n \n \n \n NPosF20-24\n \n \n \n \n \n \n NPosF25-29\n \n \n \n \n \n \n NPosF30-34\n \n \n \n \n \n \n NPosF35-39\n \n \n \n \n \n \n NPosF40-44\n \n \n \n \n \n \n NPosF45-49\n \n \n \n \n \n \n NPosF5-9\n \n \n \n \n \n \n NPosF50Plu\n \n \n \n \n \n \n NPosF<1\n \n \n \n \n \n \n NPosM1-4\n \n \n \n \n \n \n NPosM10-14\n \n \n \n \n \n \n NPosM15-19\n \n \n \n \n \n \n NPosM20-24\n \n \n \n \n \n \n NPosM25-29\n \n \n \n \n \n \n NPosM30-34\n \n \n \n \n \n \n NPosM35-39\n \n \n \n \n \n \n NPosM40-44\n \n \n \n \n \n \n NPosM45-49\n \n \n \n \n \n \n NPosM5-9\n \n \n \n \n \n \n NPosM50Plu\n \n \n \n \n \n \n NPosM<1\n \n \n \n \n \n \n RNegF1-4\n \n \n \n \n \n \n \n \n \n RNegF10-14\n \n \n \n \n \n \n RNegF15-19\n \n \n \n \n \n \n RNegF20-24\n \n \n \n \n \n \n RNegF25-29\n \n \n \n \n \n \n RNegF30-34\n \n \n \n \n \n \n RNegF35-39\n \n \n \n \n \n \n RNegF40-44\n \n \n \n \n \n \n RNegF45-49\n \n \n \n \n \n \n RNegF5-9\n \n \n \n \n \n \n RNegF50Plu\n \n \n \n \n \n \n RNegF<1\n \n \n \n \n \n \n RNegM1-4\n \n \n \n \n \n \n RNegM10-14\n \n \n \n \n \n \n RNegM15-19\n \n \n \n \n \n \n RNegM20-24\n \n \n \n \n \n \n RNegM25-29\n \n \n \n \n \n \n RNegM30-34\n \n \n \n \n \n \n RNegM35-39\n \n \n \n \n \n \n RNegM40-44\n \n \n \n \n \n \n RNegM45-49\n \n \n \n \n \n \n RNegM5-9\n \n \n \n \n \n \n RNegM50Plu\n \n \n \n \n \n \n RNegM<1\n \n \n \n \n \n \n RPosF1-4\n \n \n \n \n \n \n \n \n \n RPosF10-14\n \n \n \n \n \n \n RPosF15-19\n \n \n \n \n \n \n RPosF20-24\n \n \n \n \n \n \n RPosF25-29\n \n \n \n \n \n \n RPosF30-34\n \n \n \n \n \n \n RPosF35-39\n \n \n \n \n \n \n RPosF40-44\n \n \n \n \n \n \n RPosF45-49\n \n \n \n \n \n \n RPosF5-9\n \n \n \n \n \n \n RPosF50Plu\n \n \n \n \n \n \n RPosF<1\n \n \n \n \n \n \n RPosM1-4\n \n \n \n \n \n \n RPosM10-14\n \n \n \n \n \n \n RPosM15-19\n \n \n \n \n \n \n RPosM20-24\n \n \n \n \n \n \n RPosM25-29\n \n \n \n \n \n \n RPosM30-34\n \n \n \n \n \n \n RPosM35-39\n \n \n \n \n \n \n RPosM40-44\n \n \n \n \n \n \n RPosM45-49\n \n \n \n \n \n \n RPosM5-9\n \n \n \n \n \n \n RPosM50Plu\n \n \n \n \n \n \n RPosM<1\n \n \n \n \n \n \n','2021-10-06 11:47:25',4,'2021-10-06 17:27:43',4,0,NULL,NULL,NULL,'4a64819c-e83a-4486-bc35-3b94e45e6285'),(1321,' PITC_New_Neg_MCH',' PITC_New_Neg_MCH','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_New_Neg_MCH\n PITC_New_Neg_MCH\n \n 2021-10-06 15:32:10 UTC\n \n 2021-10-06 15:35:35 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1321\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-06 17:32:10',4,'2021-10-06 17:35:35',4,0,NULL,NULL,NULL,'da4ee526-eb6c-475d-925c-ab56da241de3'),(1322,' PITC_New_Pos_MCH',' PITC_New_Pos_MCH','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_New_Pos_MCH\n PITC_New_Pos_MCH\n \n 2021-10-06 15:32:39 UTC\n \n 2021-10-06 15:35:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1322\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-06 17:32:39',4,'2021-10-06 17:35:50',4,0,NULL,NULL,NULL,'b3e9452d-7a33-4d06-ae8c-5e730923eb7b'),(1323,' PITC_Repeat_Neg_MCH',' PITC_Repeat_Neg_MCH','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_Repeat_Neg_MCH\n PITC_Repeat_Neg_MCH\n \n 2021-10-06 15:33:14 UTC\n \n 2021-10-06 15:36:49 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1323\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-06 17:33:14',4,'2021-10-06 17:36:49',4,0,NULL,NULL,NULL,'168f838a-8ac0-43f1-a178-bb24cff130f1'),(1324,' PITC_Repeat_Pos_MCH',' PITC_Repeat_Pos_MCH','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_Repeat_Pos_MCH\n PITC_Repeat_Pos_MCH\n \n 2021-10-06 15:33:43 UTC\n \n 2021-10-06 15:37:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1324\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-06 17:33:43',4,'2021-10-06 17:37:03',4,0,NULL,NULL,NULL,'49998468-941c-4817-b3e7-ada1ea8862cc'),(1325,'PITC_HTS_MCH','HTS Report for MCH location','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_HTS_MCH\n HTS Report for MCH location\n \n 2021-10-06 15:39:51 UTC\n \n 2021-10-07 04:34:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1325\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2021-10-06 17:39:51',4,'2021-10-07 06:34:03',4,0,NULL,NULL,NULL,'d946548e-a7f9-4115-bcd3-f78afdab092d'),(1326,'PITC_HTS_MCH Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_HTS_MCH Data Set\n \n 2021-10-06 15:40:13 UTC\n \n 2021-10-06 21:25:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1326\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Finer_Age\n \n \n \n \n \n \n \n \n NNegF1-4\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 01-04yrs\n \n \n \n \n \n NNegF10-14\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 10-14yrs\n \n \n \n \n \n NNegF15-19\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 15-19yrs\n \n \n \n \n \n NNegF20-24\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 20-24yrs\n \n \n \n \n \n NNegF25-29\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 25-29yrs\n \n \n \n \n \n NNegF30-34\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 30-34yrs\n \n \n \n \n \n NNegF35-39\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 35-39yrs\n \n \n \n \n \n NNegF40-44\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 40-44yrs\n \n \n \n \n \n NNegF45-49\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 45-49yrs\n \n \n \n \n \n NNegF5-9\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 05-09yrs\n \n \n \n \n \n NNegF50Plu\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 50Plus\n \n \n \n \n \n NNegF<1\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n Under1yr\n \n \n \n \n \n NNegM1-4\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 01-04yrs\n \n \n \n \n \n NNegM10-14\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 10-14yrs\n \n \n \n \n \n NNegM15-19\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 15-19yrs\n \n \n \n \n \n NNegM20-24\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 20-24yrs\n \n \n \n \n \n NNegM25-29\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 25-29yrs\n \n \n \n \n \n NNegM30-34\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 30-34yrs\n \n \n \n \n \n NNegM35-39\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 35-39yrs\n \n \n \n \n \n NNegM40-44\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 40-44yrs\n \n \n \n \n \n NNegM45-49\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 45-49yrs\n \n \n \n \n \n NNegM5-9\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 05-09yrs\n \n \n \n \n \n NNegM50Plu\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 50Plus\n \n \n \n \n \n NNegM<1\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n Under1yr\n \n \n \n \n \n NPosF1-4\n \n \n \n \n \n \n \n \n \n NPosF10-14\n \n \n \n \n \n \n NPosF15-19\n \n \n \n \n \n \n NPosF20-24\n \n \n \n \n \n \n NPosF25-29\n \n \n \n \n \n \n NPosF30-34\n \n \n \n \n \n \n NPosF35-39\n \n \n \n \n \n \n NPosF40-44\n \n \n \n \n \n \n NPosF45-49\n \n \n \n \n \n \n NPosF5-9\n \n \n \n \n \n \n NPosF50Plu\n \n \n \n \n \n \n NPosF<1\n \n \n \n \n \n \n NPosM1-4\n \n \n \n \n \n \n NPosM10-14\n \n \n \n \n \n \n NPosM15-19\n \n \n \n \n \n \n NPosM20-24\n \n \n \n \n \n \n NPosM25-29\n \n \n \n \n \n \n NPosM30-34\n \n \n \n \n \n \n NPosM35-39\n \n \n \n \n \n \n NPosM40-44\n \n \n \n \n \n \n NPosM45-49\n \n \n \n \n \n \n NPosM5-9\n \n \n \n \n \n \n NPosM50Plu\n \n \n \n \n \n \n NPosM<1\n \n \n \n \n \n \n RNegF1-4\n \n \n \n \n \n \n \n \n \n RNegF10-14\n \n \n \n \n \n \n RNegF15-19\n \n \n \n \n \n \n RNegF20-24\n \n \n \n \n \n \n RNegF25-29\n \n \n \n \n \n \n RNegF30-34\n \n \n \n \n \n \n RNegF35-39\n \n \n \n \n \n \n RNegF40-44\n \n \n \n \n \n \n RNegF45-49\n \n \n \n \n \n \n RNegF5-9\n \n \n \n \n \n \n RNegF50Plu\n \n \n \n \n \n \n RNegF<1\n \n \n \n \n \n \n RNegM1-4\n \n \n \n \n \n \n RNegM10-14\n \n \n \n \n \n \n RNegM15-19\n \n \n \n \n \n \n RNegM20-24\n \n \n \n \n \n \n RNegM25-29\n \n \n \n \n \n \n RNegM30-34\n \n \n \n \n \n \n RNegM35-39\n \n \n \n \n \n \n RNegM40-44\n \n \n \n \n \n \n RNegM45-49\n \n \n \n \n \n \n RNegM5-9\n \n \n \n \n \n \n RNegM50Plu\n \n \n \n \n \n \n RNegM<1\n \n \n \n \n \n \n RPosF1-4\n \n \n \n \n \n \n \n \n \n RPosF10-14\n \n \n \n \n \n \n RPosF15-19\n \n \n \n \n \n \n RPosF20-24\n \n \n \n \n \n \n RPosF25-29\n \n \n \n \n \n \n RPosF30-34\n \n \n \n \n \n \n RPosF35-39\n \n \n \n \n \n \n RPosF40-44\n \n \n \n \n \n \n RPosF45-49\n \n \n \n \n \n \n RPosF5-9\n \n \n \n \n \n \n RPosF50Plu\n \n \n \n \n \n \n RPosF<1\n \n \n \n \n \n \n RPosM1-4\n \n \n \n \n \n \n RPosM10-14\n \n \n \n \n \n \n RPosM15-19\n \n \n \n \n \n \n RPosM20-24\n \n \n \n \n \n \n RPosM25-29\n \n \n \n \n \n \n RPosM30-34\n \n \n \n \n \n \n RPosM35-39\n \n \n \n \n \n \n RPosM40-44\n \n \n \n \n \n \n RPosM45-49\n \n \n \n \n \n \n RPosM5-9\n \n \n \n \n \n \n RPosM50Plu\n \n \n \n \n \n \n RPosM<1\n \n \n \n \n \n \n','2021-10-06 17:40:13',4,'2021-10-06 23:25:14',4,0,NULL,NULL,NULL,'e7bbe762-47b2-4ca9-adcb-64e8b0cd50e1'),(1327,'CITC_New_Pos_MCH','CITC_New_Pos_MCH','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_New_Pos_MCH\n CITC_New_Pos_MCH\n \n 2021-10-06 21:29:56 UTC\n \n 2021-10-06 21:33:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1327\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-06 23:29:56',4,'2021-10-06 23:33:10',4,0,NULL,NULL,NULL,'ca78fdaa-e5f6-498e-9781-9cf1f8366220'),(1328,'CITC_New_Neg_MCH','CITC_New_Neg_MCH','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_New_Neg_MCH\n CITC_New_Neg_MCH\n \n 2021-10-06 21:30:12 UTC\n \n 2021-10-06 21:32:49 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1328\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-06 23:30:12',4,'2021-10-06 23:32:49',4,0,NULL,NULL,NULL,'32c4681d-fbde-4aa3-b10c-bf6393b39a4b'),(1329,'CITC_Repeat_Neg_MCH','CITC_Repeat_Neg_MCH','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_Repeat_Neg_MCH\n CITC_Repeat_Neg_MCH\n \n 2021-10-06 21:30:32 UTC\n \n 2021-10-06 21:33:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1329\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-06 23:30:32',4,'2021-10-06 23:33:53',4,0,NULL,NULL,NULL,'51f2438c-b8a5-47c2-8703-c04885de774e'),(1330,'CITC_Repeat_Pos_MCH','CITC_Repeat_Pos_MCH','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_Repeat_Pos_MCH\n CITC_Repeat_Pos_MCH\n \n 2021-10-06 21:30:46 UTC\n \n 2021-10-06 21:34:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1330\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-06 23:30:46',4,'2021-10-06 23:34:06',4,0,NULL,NULL,NULL,'50a98d1c-3cc7-43e9-824b-dde34f55e120'),(1331,'CITC_HTS_MCH','CITC_HTS_MCH','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_HTS_MCH\n CITC_HTS_MCH\n \n 2021-10-06 21:36:13 UTC\n \n 2021-10-06 21:36:35 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1331\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2021-10-06 23:36:13',4,'2021-10-06 23:36:35',4,0,NULL,NULL,NULL,'65873a4c-f706-4491-afc1-1a6ee9f18a35'),(1332,'CITC_HTS_MCH Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_HTS_MCH Data Set\n \n 2021-10-06 21:36:35 UTC\n \n 2021-10-06 23:12:16 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1332\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Finer_Age\n \n \n \n \n \n \n \n \n NNegF1-4\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 01-04yrs\n \n \n \n \n \n NNegF10-14\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 10-14yrs\n \n \n \n \n \n NNegF15-19\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 15-19yrs\n \n \n \n \n \n NNegF20-24\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 20-24yrs\n \n \n \n \n \n NNegF25-29\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 25-29yrs\n \n \n \n \n \n NNegF30-34\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 30-34yrs\n \n \n \n \n \n NNegF35-39\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 35-39yrs\n \n \n \n \n \n NNegF40-44\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 40-44yrs\n \n \n \n \n \n NNegF45-49\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 45-49yrs\n \n \n \n \n \n NNegF5-9\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 05-09yrs\n \n \n \n \n \n NNegF50Plu\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 50Plus\n \n \n \n \n \n NNegF<1\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n Under1yr\n \n \n \n \n \n NNegM1-4\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 01-04yrs\n \n \n \n \n \n NNegM10-14\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 10-14yrs\n \n \n \n \n \n NNegM15-19\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 15-19yrs\n \n \n \n \n \n NNegM20-24\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 20-24yrs\n \n \n \n \n \n NNegM25-29\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 25-29yrs\n \n \n \n \n \n NNegM30-34\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 30-34yrs\n \n \n \n \n \n NNegM35-39\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 35-39yrs\n \n \n \n \n \n NNegM40-44\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 40-44yrs\n \n \n \n \n \n NNegM45-49\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 45-49yrs\n \n \n \n \n \n NNegM5-9\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 05-09yrs\n \n \n \n \n \n NNegM50Plu\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 50Plus\n \n \n \n \n \n NNegM<1\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n Under1yr\n \n \n \n \n \n NPosF1-4\n \n \n \n \n \n \n \n \n \n NPosF10-14\n \n \n \n \n \n \n NPosF15-19\n \n \n \n \n \n \n NPosF20-24\n \n \n \n \n \n \n NPosF25-29\n \n \n \n \n \n \n NPosF30-34\n \n \n \n \n \n \n NPosF35-39\n \n \n \n \n \n \n NPosF40-44\n \n \n \n \n \n \n NPosF45-49\n \n \n \n \n \n \n NPosF5-9\n \n \n \n \n \n \n NPosF50Plu\n \n \n \n \n \n \n NPosF<1\n \n \n \n \n \n \n NPosM1-4\n \n \n \n \n \n \n NPosM10-14\n \n \n \n \n \n \n NPosM15-19\n \n \n \n \n \n \n NPosM20-24\n \n \n \n \n \n \n NPosM25-29\n \n \n \n \n \n \n NPosM30-34\n \n \n \n \n \n \n NPosM35-39\n \n \n \n \n \n \n NPosM40-44\n \n \n \n \n \n \n NPosM45-49\n \n \n \n \n \n \n NPosM5-9\n \n \n \n \n \n \n NPosM50Plu\n \n \n \n \n \n \n NPosM<1\n \n \n \n \n \n \n RNegF1-4\n \n \n \n \n \n \n \n \n \n RNegF10-14\n \n \n \n \n \n \n RNegF15-19\n \n \n \n \n \n \n RNegF20-24\n \n \n \n \n \n \n RNegF25-29\n \n \n \n \n \n \n RNegF30-34\n \n \n \n \n \n \n RNegF35-39\n \n \n \n \n \n \n RNegF40-44\n \n \n \n \n \n \n RNegF45-49\n \n \n \n \n \n \n RNegF5-9\n \n \n \n \n \n \n RNegF50Plu\n \n \n \n \n \n \n RNegF<1\n \n \n \n \n \n \n RNegM1-4\n \n \n \n \n \n \n RNegM10-14\n \n \n \n \n \n \n RNegM15-19\n \n \n \n \n \n \n RNegM20-24\n \n \n \n \n \n \n RNegM25-29\n \n \n \n \n \n \n RNegM30-34\n \n \n \n \n \n \n RNegM35-39\n \n \n \n \n \n \n RNegM40\n \n \n \n \n \n \n RNegM45-49\n \n \n \n \n \n \n RNegM5-9\n \n \n \n \n \n \n RNegM50Plu\n \n \n \n \n \n \n RNegM<1\n \n \n \n \n \n \n RPosF1-4\n \n \n \n \n \n \n \n \n \n RPosF10-14\n \n \n \n \n \n \n RPosF15-19\n \n \n \n \n \n \n RPosF20-24\n \n \n \n \n \n \n RPosF25-29\n \n \n \n \n \n \n RPosF30-34\n \n \n \n \n \n \n RPosF35-39\n \n \n \n \n \n \n RPosF40-44\n \n \n \n \n \n \n RPosF45-49\n \n \n \n \n \n \n RPosF5-9\n \n \n \n \n \n \n RPosF50Plu\n \n \n \n \n \n \n RPosF<1\n \n \n \n \n \n \n RPosM1-4\n \n \n \n \n \n \n RPosM10-14\n \n \n \n \n \n \n RPosM15-19\n \n \n \n \n \n \n RPosM20-24\n \n \n \n \n \n \n RPosM25-29\n \n \n \n \n \n \n RPosM30-34\n \n \n \n \n \n \n RPosM35-39\n \n \n \n \n \n \n RPosM40-44\n \n \n \n \n \n \n RPosM45-49\n \n \n \n \n \n \n RPosM5-9\n \n \n \n \n \n \n RPosM50Plu\n \n \n \n \n \n \n RPosM<1\n \n \n \n \n \n \n','2021-10-06 23:36:35',4,'2021-10-07 01:12:16',4,0,NULL,NULL,NULL,'545ac344-383c-40fb-b248-f42915e427f5'),(1333,'PITC_New_Neg_Index','PITC_New_Neg_Index','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_New_Neg_Index\n PITC_New_Neg_Index\n \n 2021-10-07 04:25:39 UTC\n \n 2021-10-07 04:29:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1333\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-07 06:25:39',4,'2021-10-07 06:29:23',4,0,NULL,NULL,NULL,'4c7fd830-a0c3-4e72-950c-05b972769d55'),(1334,'PITC_New_Pos_Index','PITC_New_Pos_Index','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_New_Pos_Index\n PITC_New_Pos_Index\n \n 2021-10-07 04:25:56 UTC\n \n 2021-10-07 04:29:46 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1334\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-07 06:25:56',4,'2021-10-07 06:29:46',4,0,NULL,NULL,NULL,'a4977c25-a493-47af-a8c9-7add78c9adf9'),(1335,'PITC_Repeat_Neg_Index','PITC_Repeat_Neg_Index','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_Repeat_Neg_Index\n PITC_Repeat_Neg_Index\n \n 2021-10-07 04:26:41 UTC\n \n 2021-10-07 04:30:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1335\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-07 06:26:41',4,'2021-10-07 06:30:04',4,0,NULL,NULL,NULL,'e3e5f2be-eb19-4c33-8b0c-72d67e791ab4'),(1336,'PITC_Repeat_Pos_Index','PITC_Repeat_Pos_Index','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_Repeat_Pos_Index\n PITC_Repeat_Pos_Index\n \n 2021-10-07 04:26:54 UTC\n \n 2021-10-07 04:30:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1336\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-07 06:26:54',4,'2021-10-07 06:30:41',4,0,NULL,NULL,NULL,'dbb343c4-6946-4a13-b6dc-e2a2e77dfaed'),(1337,'PITC_HTS_Index','HTS Report for Index Clients','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_HTS_Index\n HTS Report for Index Clients\n \n 2021-10-07 04:33:41 UTC\n \n 2021-10-07 04:34:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1337\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2021-10-07 06:33:41',4,'2021-10-07 06:34:05',4,0,NULL,NULL,NULL,'ce0ad8fd-bde8-4fce-be69-23e238f249bb'),(1338,'PITC_HTS_Index Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_HTS_Index Data Set\n \n 2021-10-07 04:34:04 UTC\n \n 2021-10-07 06:43:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1338\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Finer_Age\n \n \n \n \n \n \n \n \n NNegF1-4\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 01-04yrs\n \n \n \n \n \n NNegF10-14\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 10-14yrs\n \n \n \n \n \n NNegF15-19\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 15-19yrs\n \n \n \n \n \n NNegF20-24\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 20-24yrs\n \n \n \n \n \n NNegF25-29\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 25-29yrs\n \n \n \n \n \n NNegF30-34\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 30-34yrs\n \n \n \n \n \n NNegF35-39\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 35-39yrs\n \n \n \n \n \n NNegF40-44\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 40-44yrs\n \n \n \n \n \n NNegF45-49\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 45-49yrs\n \n \n \n \n \n NNegF5-9\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 05-09yrs\n \n \n \n \n \n NNegF50Plu\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 50Plus\n \n \n \n \n \n NNegF<1\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n Under1yr\n \n \n \n \n \n NNegM1-4\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 01-04yrs\n \n \n \n \n \n NNegM10-14\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 10-14yrs\n \n \n \n \n \n NNegM15-19\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 15-19yrs\n \n \n \n \n \n NNegM20-24\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 20-24yrs\n \n \n \n \n \n NNegM25-29\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 25-29yrs\n \n \n \n \n \n NNegM30-34\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 30-34yrs\n \n \n \n \n \n NNegM35-39\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 35-39yrs\n \n \n \n \n \n NNegM40-44\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 40-44yrs\n \n \n \n \n \n NNegM45-49\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 45-49yrs\n \n \n \n \n \n NNegM5-9\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 05-09yrs\n \n \n \n \n \n NNegM50Plu\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 50Plus\n \n \n \n \n \n NNegM<1\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n Under1yr\n \n \n \n \n \n NPosF1-4\n \n \n \n \n \n \n \n \n \n NPosF10-14\n \n \n \n \n \n \n NPosF15-19\n \n \n \n \n \n \n NPosF20-24\n \n \n \n \n \n \n NPosF25-29\n \n \n \n \n \n \n NPosF30-34\n \n \n \n \n \n \n NPosF35-39\n \n \n \n \n \n \n NPosF40-44\n \n \n \n \n \n \n NPosF45-49\n \n \n \n \n \n \n NPosF5-9\n \n \n \n \n \n \n NPosF50Plu\n \n \n \n \n \n \n NPosF<1\n \n \n \n \n \n \n NPosM1-4\n \n \n \n \n \n \n NPosM10-14\n \n \n \n \n \n \n NPosM15-19\n \n \n \n \n \n \n NPosM20-24\n \n \n \n \n \n \n NPosM25-29\n \n \n \n \n \n \n NPosM30-34\n \n \n \n \n \n \n NPosM35-39\n \n \n \n \n \n \n NPosM40-44\n \n \n \n \n \n \n NPosM45-49\n \n \n \n \n \n \n NPosM5-9\n \n \n \n \n \n \n NPosM50Plu\n \n \n \n \n \n \n NPosM<1\n \n \n \n \n \n \n RNegF1-4\n \n \n \n \n \n \n \n \n \n RNegF10-14\n \n \n \n \n \n \n RNegF15-19\n \n \n \n \n \n \n RNegF20-24\n \n \n \n \n \n \n RNegF25-29\n \n \n \n \n \n \n RNegF30-34\n \n \n \n \n \n \n RNegF35-39\n \n \n \n \n \n \n RNegF40-44\n \n \n \n \n \n \n RNegF45-49\n \n \n \n \n \n \n RNegF5-9\n \n \n \n \n \n \n RNegF50Plu\n \n \n \n \n \n \n RNegF<1\n \n \n \n \n \n \n RNegM1-4\n \n \n \n \n \n \n RNegM10-14\n \n \n \n \n \n \n RNegM15-19\n \n \n \n \n \n \n RNegM20-24\n \n \n \n \n \n \n RNegM25-29\n \n \n \n \n \n \n RNegM30-34\n \n \n \n \n \n \n RNegM35-39\n \n \n \n \n \n \n RNegM40-44\n \n \n \n \n \n \n RNegM45-49\n \n \n \n \n \n \n RNegM5-9\n \n \n \n \n \n \n RNegM50Plu\n \n \n \n \n \n \n RNegM<1\n \n \n \n \n \n \n RPosF1-4\n \n \n \n \n \n \n \n \n \n RPosF10-14\n \n \n \n \n \n \n RPosF15-19\n \n \n \n \n \n \n RPosF20-24\n \n \n \n \n \n \n RPosF25-29\n \n \n \n \n \n \n RPosF30-34\n \n \n \n \n \n \n RPosF35\n \n \n \n \n \n \n RPosF40-44\n \n \n \n \n \n \n RPosF45-49\n \n \n \n \n \n \n RPosF5-9\n \n \n \n \n \n \n RPosF50Plu\n \n \n \n \n \n \n RPosF<1\n \n \n \n \n \n \n RPosM1-4\n \n \n \n \n \n \n RPosM10-14\n \n \n \n \n \n \n RPosM15-19\n \n \n \n \n \n \n RPosM20-24\n \n \n \n \n \n \n RPosM25-29\n \n \n \n \n \n \n RPosM30\n \n \n \n \n \n \n RPosM35-39\n \n \n \n \n \n \n RPosM40-44\n \n \n \n \n \n \n RPosM45-49\n \n \n \n \n \n \n RPosM5-9\n \n \n \n \n \n \n RPosM50Plu\n \n \n \n \n \n \n RPosM<1\n \n \n \n \n \n \n','2021-10-07 06:34:04',4,'2021-10-07 08:43:10',4,0,NULL,NULL,NULL,'6425e4dd-681d-43a9-912b-3b0b6367a969'),(1339,'CITC_New_Neg_Index','CITC_New_Neg_Index','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_New_Neg_Index\n CITC_New_Neg_Index\n \n 2021-10-07 07:25:59 UTC\n \n 2021-10-07 07:31:52 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1339\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-07 09:25:59',4,'2021-10-07 09:31:52',4,0,NULL,NULL,NULL,'976b5e87-e40a-4e5f-822b-2b41ae0f7ecc'),(1340,'CITC_New_Pos_Index','CITC_New_Pos_Index','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_New_Pos_Index\n CITC_New_Pos_Index\n \n 2021-10-07 07:26:54 UTC\n \n 2021-10-07 07:30:52 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1340\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-07 09:26:54',4,'2021-10-07 09:30:52',4,0,NULL,NULL,NULL,'5286eeaa-dfe4-4d69-ba48-8931a03a1a8d'),(1341,'CITC_Repeat_Neg_Index','CITC_Repeat_Neg_Index','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_Repeat_Neg_Index\n CITC_Repeat_Neg_Index\n \n 2021-10-07 07:27:26 UTC\n \n 2021-10-07 07:31:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1341\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-07 09:27:26',4,'2021-10-07 09:31:17',4,0,NULL,NULL,NULL,'ad69563a-424d-4772-8869-d366a9d92307'),(1342,'CITC_Repeat_Pos_Index','CITC_Repeat_Pos_Index','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_Repeat_Pos_Index\n CITC_Repeat_Pos_Index\n \n 2021-10-07 07:28:27 UTC\n \n 2021-10-07 07:31:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1342\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-07 09:28:27',4,'2021-10-07 09:31:36',4,0,NULL,NULL,NULL,'e1cc0a62-96a8-4f4c-9d05-49e3ccd97fed'),(1343,'CITC_HTS_Index','CITC_HTS_Index','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_HTS_Index\n CITC_HTS_Index\n \n 2021-10-07 07:33:43 UTC\n \n 2021-10-07 07:34:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1343\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2021-10-07 09:33:43',4,'2021-10-07 09:34:04',4,0,NULL,NULL,NULL,'dce22475-86fa-436c-9e0c-d1af120f9cf2'),(1344,'CITC_HTS_Index Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_HTS_Index Data Set\n \n 2021-10-07 07:34:04 UTC\n \n 2021-10-07 09:01:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1344\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Finer_Age\n \n \n \n \n \n \n \n \n NNegF1-4\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 01-04yrs\n \n \n \n \n \n NNegF10-14\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 10-14yrs\n \n \n \n \n \n NNegF15-19\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 15-19yrs\n \n \n \n \n \n NNegF20-24\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 20-24yrs\n \n \n \n \n \n NNegF25-29\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 25-29yrs\n \n \n \n \n \n NNegF30-34\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 30-34yrs\n \n \n \n \n \n NNegF35-39\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 35-39yrs\n \n \n \n \n \n NNegF40-44\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 40-44yrs\n \n \n \n \n \n NNegF45-49\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 45-49yrs\n \n \n \n \n \n NNegF5-9\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 05-09yrs\n \n \n \n \n \n NNegF50Plu\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 50Plus\n \n \n \n \n \n NNegF<1\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n Under1yr\n \n \n \n \n \n NNegM1-4\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 01-04yrs\n \n \n \n \n \n NNegM10-14\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 10-14yrs\n \n \n \n \n \n NNegM15-19\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 15-19yrs\n \n \n \n \n \n NNegM20-24\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 20-24yrs\n \n \n \n \n \n NNegM25-29\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 25-29yrs\n \n \n \n \n \n NNegM30-34\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 30-34yrs\n \n \n \n \n \n NNegM35-39\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 35-39yrs\n \n \n \n \n \n NNegM40-44\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 40-44yrs\n \n \n \n \n \n NNegM45-49\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 45-49yrs\n \n \n \n \n \n NNegM5-9\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 05-09yrs\n \n \n \n \n \n NNegM50Plu\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 50Plus\n \n \n \n \n \n NNegM<1\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n Under1yr\n \n \n \n \n \n NPosF1-4\n \n \n \n \n \n \n \n \n \n NPosF10-14\n \n \n \n \n \n \n NPosF15-19\n \n \n \n \n \n \n NPosF20-24\n \n \n \n \n \n \n NPosF25-29\n \n \n \n \n \n \n NPosF30-34\n \n \n \n \n \n \n NPosF35-39\n \n \n \n \n \n \n NPosF40-44\n \n \n \n \n \n \n NPosF45-49\n \n \n \n \n \n \n NPosF5-9\n \n \n \n \n \n \n NPosF50Plu\n \n \n \n \n \n \n NPosF<1\n \n \n \n \n \n \n NPosM1-4\n \n \n \n \n \n \n NPosM10-14\n \n \n \n \n \n \n NPosM15-19\n \n \n \n \n \n \n NPosM20-24\n \n \n \n \n \n \n NPosM25-29\n \n \n \n \n \n \n NPosM30-34\n \n \n \n \n \n \n NPosM35-39\n \n \n \n \n \n \n NPosM40-44\n \n \n \n \n \n \n NPosM45-49\n \n \n \n \n \n \n NPosM5-9\n \n \n \n \n \n \n NPosM50Plu\n \n \n \n \n \n \n NPosM<1\n \n \n \n \n \n \n RNegF1-4\n \n \n \n \n \n \n \n \n \n RNegF10-14\n \n \n \n \n \n \n RNegF15-19\n \n \n \n \n \n \n RNegF20-24\n \n \n \n \n \n \n RNegF25-29\n \n \n \n \n \n \n RNegF30-34\n \n \n \n \n \n \n RNegF35-39\n \n \n \n \n \n \n RNegF40-44\n \n \n \n \n \n \n RNegF45-49\n \n \n \n \n \n \n RNegF5-9\n \n \n \n \n \n \n RNegF50Plu\n \n \n \n \n \n \n RNegF<1\n \n \n \n \n \n \n RNegM1-4\n \n \n \n \n \n \n RNegM10-14\n \n \n \n \n \n \n RNegM15-19\n \n \n \n \n \n \n RNegM20-24\n \n \n \n \n \n \n RNegM25-29\n \n \n \n \n \n \n RNegM30-34\n \n \n \n \n \n \n RNegM35-39\n \n \n \n \n \n \n RNegM40-44\n \n \n \n \n \n \n RNegM45-49\n \n \n \n \n \n \n RNegM5-9\n \n \n \n \n \n \n RNegM50Plu\n \n \n \n \n \n \n RNegM<1\n \n \n \n \n \n \n RPosF1-4\n \n \n \n \n \n \n \n \n \n RPosF10-14\n \n \n \n \n \n \n RPosF15-19\n \n \n \n \n \n \n RPosF20-24\n \n \n \n \n \n \n RPosF25-29\n \n \n \n \n \n \n RPosF30-34\n \n \n \n \n \n \n RPosF35-39\n \n \n \n \n \n \n RPosF40-44\n \n \n \n \n \n \n RPosF45-49\n \n \n \n \n \n \n RPosF5-9\n \n \n \n \n \n \n RPosF50Plu\n \n \n \n \n \n \n RPosF<1\n \n \n \n \n \n \n RPosM1-4\n \n \n \n \n \n \n RPosM10-14\n \n \n \n \n \n \n RPosM15-19\n \n \n \n \n \n \n RPosM20-24\n \n \n \n \n \n \n RPosM25-29\n \n \n \n \n \n \n RPosM30-34\n \n \n \n \n \n \n RPosM35-39\n \n \n \n \n \n \n RPosM40-44\n \n \n \n \n \n \n RPosM45-49\n \n \n \n \n \n \n RPosM5-9\n \n \n \n \n \n \n RPosM50Plu\n \n \n \n \n \n \n RPosM<1\n \n \n \n \n \n \n','2021-10-07 09:34:04',4,'2021-10-07 11:01:32',4,0,NULL,NULL,NULL,'5618efc3-69e9-4c64-adaa-741ed768cbd3'),(1345,'PITC_New_Neg_ART','PITC_New_Neg_ART','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_New_Neg_ART\n PITC_New_Neg_ART\n \n 2021-10-07 10:13:58 UTC\n \n 2021-10-07 10:16:09 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1345\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-07 12:13:58',4,'2021-10-07 12:16:09',4,0,NULL,NULL,NULL,'6d5bf688-5a2f-4616-82e2-c01a54f14722'),(1346,'PITC_New_Pos_ART','PITC_New_Pos_ART','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_New_Pos_ART\n PITC_New_Pos_ART\n \n 2021-10-07 10:14:22 UTC\n \n 2021-10-07 10:16:24 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1346\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-07 12:14:22',4,'2021-10-07 12:16:24',4,0,NULL,NULL,NULL,'ea06ed88-160a-467d-9417-76fdb0d46941'),(1347,'PITC_Repeat_Neg_ART','PITC_Repeat_Neg_ART','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_Repeat_Neg_ART\n PITC_Repeat_Neg_ART\n \n 2021-10-07 10:14:49 UTC\n \n 2021-10-07 10:17:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1347\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-07 12:14:49',4,'2021-10-07 12:17:02',4,0,NULL,NULL,NULL,'44e7f485-5997-4262-8fad-c7e92dc4fba5'),(1348,'PITC_Repeat_Pos_ART','PITC_Repeat_Pos_ART','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_Repeat_Pos_ART\n PITC_Repeat_Pos_ART\n \n 2021-10-07 10:15:14 UTC\n \n 2021-10-07 10:17:16 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1348\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-07 12:15:14',4,'2021-10-07 12:17:16',4,0,NULL,NULL,NULL,'7b43f84d-eb38-48ea-a8c4-7600c51472bf'),(1349,'PITC_HTS_ART','HTS Report for ART Location Clients','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_HTS_ART\n HTS Report for ART Location Clients\n \n 2021-10-07 10:26:07 UTC\n \n 2021-10-07 10:26:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1349\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2021-10-07 12:26:07',4,'2021-10-07 12:26:32',4,0,NULL,NULL,NULL,'f75d35bb-2331-4d53-9b78-4caa525d469d'),(1350,'PITC_HTS_ART Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_HTS_ART Data Set\n \n 2021-10-07 10:26:32 UTC\n \n 2021-10-07 11:44:24 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1350\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Finer_Age\n \n \n \n \n \n \n \n \n NNegF1-4\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 01-04yrs\n \n \n \n \n \n NNegF10-14\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 10-14yrs\n \n \n \n \n \n NNegF15-19\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 15-19yrs\n \n \n \n \n \n NNegF20-24\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 20-24yrs\n \n \n \n \n \n NNegF25-29\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 25-29yrs\n \n \n \n \n \n NNegF30-34\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 30-34yrs\n \n \n \n \n \n NNegF35-39\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 35-39yrs\n \n \n \n \n \n NNegF40-44\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 40-44yrs\n \n \n \n \n \n NNegF45-49\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 45-49yrs\n \n \n \n \n \n NNegF5-9\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 05-09yrs\n \n \n \n \n \n NNegF50Plu\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 50Plus\n \n \n \n \n \n NNegF<1\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n Under1yr\n \n \n \n \n \n NNegM1-4\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 01-04yrs\n \n \n \n \n \n NNegM10-14\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 10-14yrs\n \n \n \n \n \n NNegM15-19\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 15-19yrs\n \n \n \n \n \n NNegM20-24\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 20-24yrs\n \n \n \n \n \n NNegM25-29\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 25-29yrs\n \n \n \n \n \n NNegM30-34\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 30-34yrs\n \n \n \n \n \n NNegM35-39\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 35-39yrs\n \n \n \n \n \n NNegM40-44\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 40-44yrs\n \n \n \n \n \n NNegM45-49\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 45-49yrs\n \n \n \n \n \n NNegM5-9\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 05-09yrs\n \n \n \n \n \n NNegM50Plu\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 50Plus\n \n \n \n \n \n NNegM<1\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n Under1yr\n \n \n \n \n \n NPosF1-4\n \n \n \n \n \n \n \n \n \n NPosF10-14\n \n \n \n \n \n \n NPosF15-19\n \n \n \n \n \n \n NPosF20-24\n \n \n \n \n \n \n NPosF25-29\n \n \n \n \n \n \n NPosF30-34\n \n \n \n \n \n \n NPosF35-39\n \n \n \n \n \n \n NPosF40-44\n \n \n \n \n \n \n NPosF45-49\n \n \n \n \n \n \n NPosF5-9\n \n \n \n \n \n \n NPosF50Plu\n \n \n \n \n \n \n NPosF<1\n \n \n \n \n \n \n NPosM1-4\n \n \n \n \n \n \n NPosM10-14\n \n \n \n \n \n \n NPosM15-19\n \n \n \n \n \n \n NPosM20-24\n \n \n \n \n \n \n NPosM25-29\n \n \n \n \n \n \n NPosM30-34\n \n \n \n \n \n \n NPosM35-39\n \n \n \n \n \n \n NPosM40-44\n \n \n \n \n \n \n NPosM45-49\n \n \n \n \n \n \n NPosM5-9\n \n \n \n \n \n \n NPosM50Plu\n \n \n \n \n \n \n NPosM<1\n \n \n \n \n \n \n RNegF1-4\n \n \n \n \n \n \n \n \n \n RNegF10-14\n \n \n \n \n \n \n RNegF15-19\n \n \n \n \n \n \n RNegF20-24\n \n \n \n \n \n \n RNegF25-29\n \n \n \n \n \n \n RNegF30-34\n \n \n \n \n \n \n RNegF35-39\n \n \n \n \n \n \n RNegF40-44\n \n \n \n \n \n \n RNegF45-49\n \n \n \n \n \n \n RNegF5-9\n \n \n \n \n \n \n RNegF50Plu\n \n \n \n \n \n \n RNegF<1\n \n \n \n \n \n \n RNegM1-4\n \n \n \n \n \n \n RNegM10-14\n \n \n \n \n \n \n RNegM15-19\n \n \n \n \n \n \n RNegM20-24\n \n \n \n \n \n \n RNegM25-29\n \n \n \n \n \n \n RNegM30-34\n \n \n \n \n \n \n RNegM35-39\n \n \n \n \n \n \n RNegM40-44\n \n \n \n \n \n \n RNegM45-49\n \n \n \n \n \n \n RNegM5-9\n \n \n \n \n \n \n RNegM50Plu\n \n \n \n \n \n \n RNegM<1\n \n \n \n \n \n \n RPosF1-4\n \n \n \n \n \n \n \n \n \n RPosF10-14\n \n \n \n \n \n \n RPosF15-19\n \n \n \n \n \n \n RPosF20-24\n \n \n \n \n \n \n RPosF25-29\n \n \n \n \n \n \n RPosF30-34\n \n \n \n \n \n \n RPosF35-39\n \n \n \n \n \n \n RPosF40-44\n \n \n \n \n \n \n RPosF45-49\n \n \n \n \n \n \n RPosF5-9\n \n \n \n \n \n \n RPosF50Plu\n \n \n \n \n \n \n RPosF<1\n \n \n \n \n \n \n RPosM1-4\n \n \n \n \n \n \n RPosM10-14\n \n \n \n \n \n \n RPosM15-19\n \n \n \n \n \n \n RPosM20-24\n \n \n \n \n \n \n RPosM25-29\n \n \n \n \n \n \n RPosM30-34\n \n \n \n \n \n \n RPosM35-39\n \n \n \n \n \n \n RPosM40-44\n \n \n \n \n \n \n RPosM45-49\n \n \n \n \n \n \n RPosM5-9\n \n \n \n \n \n \n RPosM50Plu\n \n \n \n \n \n \n RPosM<1\n \n \n \n \n \n \n','2021-10-07 12:26:32',4,'2021-10-07 13:44:24',4,0,NULL,NULL,NULL,'48195b40-79bc-4e0e-8157-9001e4389381'),(1351,'CITC_HTS_ART','CITC_HTS_ART','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_HTS_ART\n CITC_HTS_ART\n \n 2021-10-07 13:58:15 UTC\n \n 2021-10-07 13:58:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1351\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2021-10-07 15:58:15',4,'2021-10-07 15:58:32',4,0,NULL,NULL,NULL,'9ee564ea-f127-40f9-89f3-e6d25a9382a2'),(1352,'CITC_HTS_ART Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_HTS_ART Data Set\n \n 2021-10-07 13:58:32 UTC\n \n 2021-10-07 20:54:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1352\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Finer_Age\n \n \n \n \n \n \n \n \n NNegF1-4\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 01-04yrs\n \n \n \n \n \n NNegF10-14\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 10-14yrs\n \n \n \n \n \n NNegF15-19\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 15-19yrs\n \n \n \n \n \n NNegF20-24\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 20-24yrs\n \n \n \n \n \n NNegF25-29\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 25-29yrs\n \n \n \n \n \n NNegF30-34\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 30-34yrs\n \n \n \n \n \n NNegF35-39\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 35-39yrs\n \n \n \n \n \n NNegF40-44\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 40-44yrs\n \n \n \n \n \n NNegF45-49\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 45-49yrs\n \n \n \n \n \n NNegF5-9\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 05-09yrs\n \n \n \n \n \n NNegF50Plu\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 50Plus\n \n \n \n \n \n NNegF<1\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n Under1yr\n \n \n \n \n \n NNegM1-4\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 01-04yrs\n \n \n \n \n \n NNegM10-14\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 10-14yrs\n \n \n \n \n \n NNegM15-19\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 15-19yrs\n \n \n \n \n \n NNegM20-24\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 20-24yrs\n \n \n \n \n \n NNegM25-29\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 25-29yrs\n \n \n \n \n \n NNegM30-34\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 30-34yrs\n \n \n \n \n \n NNegM35-39\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 35-39yrs\n \n \n \n \n \n NNegM40-44\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 40-44yrs\n \n \n \n \n \n NNegM45-49\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 45-49yrs\n \n \n \n \n \n NNegM5-9\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 05-09yrs\n \n \n \n \n \n NNegM50Plu\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 50Plus\n \n \n \n \n \n NNegM<1\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n Under1yr\n \n \n \n \n \n NPosF1-4\n \n \n \n \n \n \n \n \n \n NPosF10-14\n \n \n \n \n \n \n NPosF15-19\n \n \n \n \n \n \n NPosF20-24\n \n \n \n \n \n \n NPosF25-29\n \n \n \n \n \n \n NPosF30-34\n \n \n \n \n \n \n NPosF35-39\n \n \n \n \n \n \n NPosF40-44\n \n \n \n \n \n \n NPosF45-49\n \n \n \n \n \n \n NPosF5-9\n \n \n \n \n \n \n NPosF50Plu\n \n \n \n \n \n \n NPosF<1\n \n \n \n \n \n \n NPosM1-4\n \n \n \n \n \n \n NPosM10-14\n \n \n \n \n \n \n NPosM15-19\n \n \n \n \n \n \n NPosM20-24\n \n \n \n \n \n \n NPosM25-29\n \n \n \n \n \n \n NPosM30-34\n \n \n \n \n \n \n NPosM35-39\n \n \n \n \n \n \n NPosM40-44\n \n \n \n \n \n \n NPosM45-49\n \n \n \n \n \n \n NPosM5-9\n \n \n \n \n \n \n NPosM50Plu\n \n \n \n \n \n \n NPosM<1\n \n \n \n \n \n \n RNegF1-4\n \n \n \n \n \n \n \n \n \n RNegF10-14\n \n \n \n \n \n \n RNegF15-19\n \n \n \n \n \n \n RNegF20-24\n \n \n \n \n \n \n RNegF25-29\n \n \n \n \n \n \n RNegF30-34\n \n \n \n \n \n \n RNegF35-39\n \n \n \n \n \n \n RNegF40-44\n \n \n \n \n \n \n RNegF45-49\n \n \n \n \n \n \n RNegF5-9\n \n \n \n \n \n \n RNegF50Plu\n \n \n \n \n \n \n RNegF<1\n \n \n \n \n \n \n \n \n \n RNegM1-4\n \n \n \n \n \n \n RNegM10-14\n \n \n \n \n \n \n RNegM15-19\n \n \n \n \n \n \n RNegM20-24\n \n \n \n \n \n \n RNegM25-29\n \n \n \n \n \n \n RNegM30-34\n \n \n \n \n \n \n RNegM35-39\n \n \n \n \n \n \n RNegM40-44\n \n \n \n \n \n \n RNegM45-49\n \n \n \n \n \n \n RNegM5-9\n \n \n \n \n \n \n RNegM50Plu\n \n \n \n \n \n \n RNegM<1\n \n \n \n \n \n \n RPosF1-4\n \n \n \n \n \n \n RPosF10-14\n \n \n \n \n \n \n RPosF15-19\n \n \n \n \n \n \n RPosF20-24\n \n \n \n \n \n \n RPosF25-29\n \n \n \n \n \n \n RPosF30-34\n \n \n \n \n \n \n RPosF35-39\n \n \n \n \n \n \n RPosF40-44\n \n \n \n \n \n \n RPosF45-49\n \n \n \n \n \n \n RPosF5-9\n \n \n \n \n \n \n RPosF50Plu\n \n \n \n \n \n \n RPosF<1\n \n \n \n \n \n \n RPosM1-4\n \n \n \n \n \n \n RPosM10-14\n \n \n \n \n \n \n RPosM15-19\n \n \n \n \n \n \n RPosM20-24\n \n \n \n \n \n \n RPosM25-29\n \n \n \n \n \n \n RPosM30-34\n \n \n \n \n \n \n RPosM35-39\n \n \n \n \n \n \n RPosM40-44\n \n \n \n \n \n \n RPosM45-49\n \n \n \n \n \n \n RPosM5-9\n \n \n \n \n \n \n RPosM50Plu\n \n \n \n \n \n \n RPosM<1\n \n \n \n \n \n \n','2021-10-07 15:58:32',4,'2021-10-07 22:54:11',4,0,NULL,NULL,NULL,'068e94f1-8873-42de-a660-d8f239c4858c'),(1353,'CITC_New_Neg_ART','CITC_New_Neg_ART','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_New_Neg_ART\n CITC_New_Neg_ART\n \n 2021-10-07 13:59:29 UTC\n \n 2021-10-07 14:02:13 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1353\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-07 15:59:29',4,'2021-10-07 16:02:13',4,0,NULL,NULL,NULL,'8d97fedb-8b2e-4a68-8adb-82f0f4a9add9'),(1354,'CITC_New_Pos_ART','CITC_New_Pos_ART','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_New_Pos_ART\n CITC_New_Pos_ART\n \n 2021-10-07 13:59:52 UTC\n \n 2021-10-07 14:02:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1354\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-07 15:59:52',4,'2021-10-07 16:02:30',4,0,NULL,NULL,NULL,'dacc0b51-b2c6-42c8-a9d8-22751d857b0f'),(1355,'CITC_Repeat_Pos_ART','CITC_Repeat_Pos_ART','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_Repeat_Pos_ART\n CITC_Repeat_Pos_ART\n \n 2021-10-07 14:00:29 UTC\n \n 2021-10-07 14:03:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1355\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-07 16:00:29',4,'2021-10-07 16:03:06',4,0,NULL,NULL,NULL,'0e5f59f7-089a-4da2-9592-fd5d7b2e3160'),(1356,'CITC_Repeat_Neg_ART','CITC_Repeat_Neg_ART','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_Repeat_Neg_ART\n CITC_Repeat_Neg_ART\n \n 2021-10-07 14:01:00 UTC\n \n 2021-10-07 14:02:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1356\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-07 16:01:00',4,'2021-10-07 16:02:53',4,0,NULL,NULL,NULL,'df3ebc14-329c-41a7-b8d7-e2be98f7ce77'),(1357,'PITC_New_Neg_SelfTest','PITC_New_Neg_SelfTest','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_New_Neg_SelfTest\n PITC_New_Neg_SelfTest\n \n 2021-10-07 20:57:55 UTC\n \n 2021-10-07 21:01:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1357\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-07 22:57:55',4,'2021-10-07 23:01:55',4,0,NULL,NULL,NULL,'69df4bb7-ba58-44b6-ba62-5a4f7890b8f1'),(1358,'PITC_New_Pos_SelfTest','PITC_New_Pos_SelfTest','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_New_Pos_SelfTest\n PITC_New_Pos_SelfTest\n \n 2021-10-07 20:58:22 UTC\n \n 2021-10-07 21:02:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1358\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-07 22:58:22',4,'2021-10-07 23:02:12',4,0,NULL,NULL,NULL,'e826a2b0-18e7-4996-8f74-1db38549a861'),(1359,'PITC_Repeat_Neg_SelfTest','PITC_Repeat_Neg_SelfTest','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_Repeat_Neg_SelfTest\n PITC_Repeat_Neg_SelfTest\n \n 2021-10-07 20:59:27 UTC\n \n 2021-10-07 21:02:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1359\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-07 22:59:27',4,'2021-10-07 23:02:31',4,0,NULL,NULL,NULL,'0db20958-582a-4b50-ba86-49b9ef0f64e7'),(1360,'PITC_Repeat_Pos_SelfTest','PITC_Repeat_Pos_SelfTest','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_Repeat_Pos_SelfTest\n PITC_Repeat_Pos_SelfTest\n \n 2021-10-07 20:59:42 UTC\n \n 2021-10-07 21:02:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1360\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-07 22:59:42',4,'2021-10-07 23:02:45',4,0,NULL,NULL,NULL,'3708255a-1b1a-421d-a0f1-838a320fa6f4'),(1361,'PITC_HTS_SelfTest','HTS Report for Self Test Clients','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_HTS_SelfTest\n HTS Report for Self Test Clients\n \n 2021-10-07 21:05:37 UTC\n \n 2021-10-07 21:05:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1361\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2021-10-07 23:05:37',4,'2021-10-07 23:05:45',4,0,NULL,NULL,NULL,'b61f2060-1d4b-4bd7-af32-67db98d50032'),(1362,'PITC_HTS_SelfTest Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_HTS_SelfTest Data Set\n \n 2021-10-07 21:05:45 UTC\n \n 2021-10-11 20:55:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1362\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Finer_Age\n \n \n \n \n \n \n \n \n NNegF1-4\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 01-04yrs\n \n \n \n \n \n NNegF10-14\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 10-14yrs\n \n \n \n \n \n NNegF15-19\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 15-19yrs\n \n \n \n \n \n NNegF20-24\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 20-24yrs\n \n \n \n \n \n NNegF25-29\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 25-29yrs\n \n \n \n \n \n NNegF30-34\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 30-34yrs\n \n \n \n \n \n NNegF35-39\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 35-39yrs\n \n \n \n \n \n NNegF40-44\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 40-44yrs\n \n \n \n \n \n NNegF45-49\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 45-49yrs\n \n \n \n \n \n NNegF5-9\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 05-09yrs\n \n \n \n \n \n NNegF50Plu\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 50Plus\n \n \n \n \n \n NNegF<1\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n Under1yr\n \n \n \n \n \n NNegM1-4\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 01-04yrs\n \n \n \n \n \n NNegM10-14\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 10-14yrs\n \n \n \n \n \n NNegM15-19\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 15-19yrs\n \n \n \n \n \n NNegM20-24\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 20-24yrs\n \n \n \n \n \n NNegM25-29\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 25-29yrs\n \n \n \n \n \n NNegM30-34\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 30-34yrs\n \n \n \n \n \n NNegM35-39\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 35-39yrs\n \n \n \n \n \n NNegM40-44\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 40-44yrs\n \n \n \n \n \n NNegM45-49\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 45-49yrs\n \n \n \n \n \n NNegM5-9\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 05-09yrs\n \n \n \n \n \n NNegM50Plu\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 50Plus\n \n \n \n \n \n NNegM<1\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n Under1yr\n \n \n \n \n \n NPosF1-4\n \n \n \n \n \n \n \n \n \n NPosF10-14\n \n \n \n \n \n \n NPosF15-19\n \n \n \n \n \n \n NPosF20-24\n \n \n \n \n \n \n NPosF25-29\n \n \n \n \n \n \n NPosF30-34\n \n \n \n \n \n \n NPosF35-39\n \n \n \n \n \n \n NPosF40-44\n \n \n \n \n \n \n NPosF45-49\n \n \n \n \n \n \n NPosF5-9\n \n \n \n \n \n \n NPosF50Plu\n \n \n \n \n \n \n NPosF<1\n \n \n \n \n \n \n NPosM1-4\n \n \n \n \n \n \n NPosM10-14\n \n \n \n \n \n \n NPosM15-19\n \n \n \n \n \n \n NPosM20-24\n \n \n \n \n \n \n NPosM25-29\n \n \n \n \n \n \n NPosM30-34\n \n \n \n \n \n \n NPosM35-39\n \n \n \n \n \n \n NPosM40-44\n \n \n \n \n \n \n NPosM45-49\n \n \n \n \n \n \n NPosM5-9\n \n \n \n \n \n \n NPosM50Plu\n \n \n \n \n \n \n NPosM<1\n \n \n \n \n \n \n RNegF1-4\n \n \n \n \n \n \n \n \n \n RNegF10-14\n \n \n \n \n \n \n RNegF15-19\n \n \n \n \n \n \n RNegF20-24\n \n \n \n \n \n \n RNegF25-29\n \n \n \n \n \n \n RNegF30-34\n \n \n \n \n \n \n RNegF35-39\n \n \n \n \n \n \n RNegF40-44\n \n \n \n \n \n \n RNegF45-49\n \n \n \n \n \n \n RNegF5-9\n \n \n \n \n \n \n RNegF50Plu\n \n \n \n \n \n \n RNegF<1\n \n \n \n \n \n \n RNegM1-4\n \n \n \n \n \n \n RNegM10-14\n \n \n \n \n \n \n RNegM15-19\n \n \n \n \n \n \n RNegM20-24\n \n \n \n \n \n \n RNegM25-29\n \n \n \n \n \n \n RNegM30-34\n \n \n \n \n \n \n RNegM35-39\n \n \n \n \n \n \n RNegM40-44\n \n \n \n \n \n \n RNegM45-49\n \n \n \n \n \n \n RNegM5-9\n \n \n \n \n \n \n RNegM50Plu\n \n \n \n \n \n \n RNegM<1\n \n \n \n \n \n \n RPosF1-4\n \n \n \n \n \n \n \n \n \n RPosF10-14\n \n \n \n \n \n \n RPosF15-19\n \n \n \n \n \n \n RPosF20-24\n \n \n \n \n \n \n RPosF25-29\n \n \n \n \n \n \n RPosF30-34\n \n \n \n \n \n \n RPosF35-39\n \n \n \n \n \n \n RPosF40-44\n \n \n \n \n \n \n RPosF45-49\n \n \n \n \n \n \n RPosF5-9\n \n \n \n \n \n \n RPosF50Plu\n \n \n \n \n \n \n RPosF<1\n \n \n \n \n \n \n RPosM1-4\n \n \n \n \n \n \n RPosM10-14\n \n \n \n \n \n \n RPosM15-19\n \n \n \n \n \n \n RPosM20-24\n \n \n \n \n \n \n RPosM25-29\n \n \n \n \n \n \n RPosM30-34\n \n \n \n \n \n \n RPosM35-39\n \n \n \n \n \n \n RPosM40-44\n \n \n \n \n \n \n RPosM45-49\n \n \n \n \n \n \n RPosM5-9\n \n \n \n \n \n \n RPosM50Plu\n \n \n \n \n \n \n RPosM<1\n \n \n \n \n \n \n','2021-10-07 23:05:45',4,'2021-10-11 22:55:42',4,0,NULL,NULL,NULL,'8e37cf0b-426f-41d1-b2f6-c2a2fc4ca11b'),(1363,' CITC_New_Neg_SelfTest',' CITC_New_Neg_SelfTest','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_New_Neg_SelfTest\n CITC_New_Neg_SelfTest\n \n 2021-10-07 21:50:17 UTC\n \n 2021-10-07 21:53:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1363\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-07 23:50:17',4,'2021-10-07 23:53:11',4,0,NULL,NULL,NULL,'4f421a8f-f47c-4c7c-b9ee-645c7598c190'),(1364,' CITC_New_Pos_SelfTest',' CITC_New_Pos_SelfTest','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_New_Pos_SelfTest\n CITC_New_Pos_SelfTest\n \n 2021-10-07 21:50:51 UTC\n \n 2021-10-07 21:53:24 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1364\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-07 23:50:51',4,'2021-10-07 23:53:24',4,0,NULL,NULL,NULL,'b0c652de-795a-49ea-8174-ad6f6876657d'),(1365,' CITC_Repeat_Neg_SelfTest',' CITC_Repeat_Neg_SelfTest','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_Repeat_Neg_SelfTest\n CITC_Repeat_Neg_SelfTest\n \n 2021-10-07 21:51:38 UTC\n \n 2021-10-07 21:53:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1365\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-07 23:51:38',4,'2021-10-07 23:53:44',4,0,NULL,NULL,NULL,'e2d26faf-850c-47a9-929d-2d083f7e8493'),(1366,' CITC_Repeat_Pos_SelfTest',' CITC_Repeat_Pos_SelfTest','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_Repeat_Pos_SelfTest\n CITC_Repeat_Pos_SelfTest\n \n 2021-10-07 21:51:56 UTC\n \n 2021-10-07 21:56:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1366\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-07 23:51:56',4,'2021-10-07 23:56:36',4,0,NULL,NULL,NULL,'8a73a6fd-b0fe-47f7-b291-63dd42af9ada'),(1367,'CITC_HTS_SelfTest','CITC_HTS_SelfTest','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_HTS_SelfTest\n CITC_HTS_SelfTest\n \n 2021-10-07 21:57:35 UTC\n \n 2021-10-07 21:57:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1367\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2021-10-07 23:57:35',4,'2021-10-07 23:57:43',4,0,NULL,NULL,NULL,'bebe6363-836b-48d2-9803-c0e626cb50aa'),(1368,'CITC_HTS_SelfTest Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_HTS_SelfTest Data Set\n \n 2021-10-07 21:57:43 UTC\n \n 2021-10-08 12:58:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1368\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Finer_Age\n \n \n \n \n \n \n \n \n NNegF1-4\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 01-04yrs\n \n \n \n \n \n NNegF10-14\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 10-14yrs\n \n \n \n \n \n NNegF15-19\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 15-19yrs\n \n \n \n \n \n NNegF20-24\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 20-24yrs\n \n \n \n \n \n NNegF25-29\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 25-29yrs\n \n \n \n \n \n NNegF30-34\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 30-34yrs\n \n \n \n \n \n NNegF35-39\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 35-39yrs\n \n \n \n \n \n NNegF40-44\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 40-44yrs\n \n \n \n \n \n NNegF45-49\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 45-49yrs\n \n \n \n \n \n NNegF5-9\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 05-09yrs\n \n \n \n \n \n NNegF50Plu\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 50Plus\n \n \n \n \n \n NNegF<1\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n Under1yr\n \n \n \n \n \n NNegM1-4\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 01-04yrs\n \n \n \n \n \n NNegM10-14\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 10-14yrs\n \n \n \n \n \n NNegM15-19\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 15-19yrs\n \n \n \n \n \n NNegM20-24\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 20-24yrs\n \n \n \n \n \n NNegM25-29\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 25-29yrs\n \n \n \n \n \n NNegM30-34\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 30-34yrs\n \n \n \n \n \n NNegM35-39\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 35-39yrs\n \n \n \n \n \n NNegM40-44\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 40-44yrs\n \n \n \n \n \n NNegM45-49\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 45-49yrs\n \n \n \n \n \n NNegM5-9\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 05-09yrs\n \n \n \n \n \n NNegM50Plu\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 50Plus\n \n \n \n \n \n NNegM<1\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n Under1yr\n \n \n \n \n \n NPosF1-4\n \n \n \n \n \n \n \n \n \n NPosF10-14\n \n \n \n \n \n \n NPosF15-19\n \n \n \n \n \n \n NPosF20-24\n \n \n \n \n \n \n NPosF25-29\n \n \n \n \n \n \n NPosF30-34\n \n \n \n \n \n \n NPosF35-39\n \n \n \n \n \n \n NPosF40-44\n \n \n \n \n \n \n NPosF45-49\n \n \n \n \n \n \n NPosF5-9\n \n \n \n \n \n \n NPosF50Plu\n \n \n \n \n \n \n NPosF<1\n \n \n \n \n \n \n NPosM1-4\n \n \n \n \n \n \n NPosM10-14\n \n \n \n \n \n \n NPosM15-19\n \n \n \n \n \n \n NPosM20-24\n \n \n \n \n \n \n NPosM25-29\n \n \n \n \n \n \n NPosM30-34\n \n \n \n \n \n \n NPosM35-39\n \n \n \n \n \n \n NPosM40-44\n \n \n \n \n \n \n NPosM45-49\n \n \n \n \n \n \n NPosM5-9\n \n \n \n \n \n \n NPosM50Plu\n \n \n \n \n \n \n NPosM<1\n \n \n \n \n \n \n RNegF1-4\n \n \n \n \n \n \n \n \n \n RNegF10-14\n \n \n \n \n \n \n RNegF15-19\n \n \n \n \n \n \n RNegF20\n \n \n \n \n \n \n RNegF25-29\n \n \n \n \n \n \n RNegF30-34\n \n \n \n \n \n \n RNegF35-39\n \n \n \n \n \n \n RNegF40-44\n \n \n \n \n \n \n RNegF45-49\n \n \n \n \n \n \n RNegF5-9\n \n \n \n \n \n \n RNegF50Plu\n \n \n \n \n \n \n RNegF<1\n \n \n \n \n \n \n RNegM1-4\n \n \n \n \n \n \n RNegM10-14\n \n \n \n \n \n \n RNegM15-19\n \n \n \n \n \n \n RNegM20-24\n \n \n \n \n \n \n RNegM25-29\n \n \n \n \n \n \n RNegM30-34\n \n \n \n \n \n \n RNegM35-39\n \n \n \n \n \n \n RNegM40-44\n \n \n \n \n \n \n RNegM45-49\n \n \n \n \n \n \n RNegM5-9\n \n \n \n \n \n \n RNegM50Plu\n \n \n \n \n \n \n RNegM<1\n \n \n \n \n \n \n RPosF1-4\n \n \n \n \n \n \n \n \n \n RPosF10-14\n \n \n \n \n \n \n RPosF15-19\n \n \n \n \n \n \n RPosF20-24\n \n \n \n \n \n \n RPosF25-29\n \n \n \n \n \n \n RPosF30-34\n \n \n \n \n \n \n RPosF35-39\n \n \n \n \n \n \n RPosF40-44\n \n \n \n \n \n \n RPosF45-49\n \n \n \n \n \n \n RPosF5-9\n \n \n \n \n \n \n RPosF50Plu\n \n \n \n \n \n \n RPosF<1\n \n \n \n \n \n \n RPosM1-4\n \n \n \n \n \n \n RPosM10-14\n \n \n \n \n \n \n RPosM15-19\n \n \n \n \n \n \n RPosM20-24\n \n \n \n \n \n \n RPosM25-29\n \n \n \n \n \n \n RPosM30-34\n \n \n \n \n \n \n RPosM35-39\n \n \n \n \n \n \n RPosM40-44\n \n \n \n \n \n \n RPosM45-49\n \n \n \n \n \n \n RPosM5-9\n \n \n \n \n \n \n RPosM50Plu\n \n \n \n \n \n \n RPosM<1\n \n \n \n \n \n \n','2021-10-07 23:57:43',4,'2021-10-08 14:58:31',4,0,NULL,NULL,NULL,'a4a5bca8-1758-4080-a156-a84df7a62c29'),(1369,'PITC_New_Neg_VMMC','PITC_New_Neg_VMMC','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_New_Neg_VMMC\n PITC_New_Neg_VMMC\n \n 2021-10-08 13:02:52 UTC\n \n 2021-10-08 13:05:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1369\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-08 15:02:52',4,'2021-10-08 15:05:39',4,0,NULL,NULL,NULL,'d7fc1236-45c7-43d2-9333-bf39b31047a6'),(1370,'PITC_New_Pos_VMMC','PITC_New_Pos_VMMC','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_New_Pos_VMMC\n PITC_New_Pos_VMMC\n \n 2021-10-08 13:03:05 UTC\n \n 2021-10-08 13:06:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1370\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-08 15:03:05',4,'2021-10-08 15:06:03',4,0,NULL,NULL,NULL,'82030723-8eb6-48ab-aaaf-0b747daaff1c'),(1371,'PITC_Repeat_Pos_VMMC','PITC_Repeat_Pos_VMMC','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_Repeat_Pos_VMMC\n PITC_Repeat_Pos_VMMC\n \n 2021-10-08 13:03:43 UTC\n \n 2021-10-08 13:06:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1371\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-08 15:03:43',4,'2021-10-08 15:06:32',4,0,NULL,NULL,NULL,'ab25dc35-65f6-444d-82a0-71167a014c3b'),(1372,'PITC_Repeat_Neg_VMMC','PITC_Repeat_Neg_VMMC','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_Repeat_Neg_VMMC\n PITC_Repeat_Neg_VMMC\n \n 2021-10-08 13:04:03 UTC\n \n 2021-10-08 13:06:22 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1372\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-08 15:04:03',4,'2021-10-08 15:06:22',4,0,NULL,NULL,NULL,'236df974-039e-411b-9ce8-09e74f743950'),(1373,'PITC_HTS_VMMC','PITC_HTS_VMMC','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_HTS_VMMC\n PITC_HTS_VMMC\n \n 2021-10-08 13:07:49 UTC\n \n 2021-10-08 13:08:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1373\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2021-10-08 15:07:49',4,'2021-10-08 15:08:14',4,0,NULL,NULL,NULL,'a58c74c3-1edc-4d4b-8ac2-0ce3e4839c7d'),(1374,'PITC_HTS_VMMC Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n PITC_HTS_VMMC Data Set\n \n 2021-10-08 13:08:14 UTC\n \n 2021-10-09 23:08:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1374\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Finer_Age\n \n \n \n \n \n \n \n \n NNegF1-4\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 01-04yrs\n \n \n \n \n \n NNegF10-14\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 10-14yrs\n \n \n \n \n \n NNegF15-19\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 15-19yrs\n \n \n \n \n \n NNegF20-24\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 20-24yrs\n \n \n \n \n \n NNegF25-29\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 25-29yrs\n \n \n \n \n \n NNegF30-34\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 30-34yrs\n \n \n \n \n \n NNegF35-39\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 35-39yrs\n \n \n \n \n \n NNegF40-44\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 40-44yrs\n \n \n \n \n \n NNegF45-49\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 45-49yrs\n \n \n \n \n \n NNegF5-9\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 05-09yrs\n \n \n \n \n \n NNegF50Plu\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 50Plus\n \n \n \n \n \n NNegF<1\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n Under1yr\n \n \n \n \n \n NNegM1-4\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 01-04yrs\n \n \n \n \n \n NNegM10-14\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 10-14yrs\n \n \n \n \n \n NNegM15-19\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 15-19yrs\n \n \n \n \n \n NNegM20-24\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 20-24yrs\n \n \n \n \n \n NNegM25-29\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 25-29yrs\n \n \n \n \n \n NNegM30-34\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 30-34yrs\n \n \n \n \n \n NNegM35-39\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 35-39yrs\n \n \n \n \n \n NNegM40-44\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 40-44yrs\n \n \n \n \n \n NNegM45-49\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 45-49yrs\n \n \n \n \n \n NNegM5-9\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 05-09yrs\n \n \n \n \n \n NNegM50Plu\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 50Plus\n \n \n \n \n \n NNegM<1\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n Under1yr\n \n \n \n \n \n NPosF1-4\n \n \n \n \n \n \n \n \n \n NPosF10-14\n \n \n \n \n \n \n NPosF15-19\n \n \n \n \n \n \n NPosF20-24\n \n \n \n \n \n \n NPosF25-29\n \n \n \n \n \n \n NPosF30-34\n \n \n \n \n \n \n NPosF35-39\n \n \n \n \n \n \n NPosF40-44\n \n \n \n \n \n \n NPosF45-49\n \n \n \n \n \n \n NPosF5-9\n \n \n \n \n \n \n NPosF50Plu\n \n \n \n \n \n \n NPosF<1\n \n \n \n \n \n \n NPosM1-4\n \n \n \n \n \n \n NPosM10-14\n \n \n \n \n \n \n NPosM15-19\n \n \n \n \n \n \n NPosM20-24\n \n \n \n \n \n \n NPosM25-29\n \n \n \n \n \n \n NPosM30-34\n \n \n \n \n \n \n NPosM35-39\n \n \n \n \n \n \n NPosM40-44\n \n \n \n \n \n \n NPosM45-49\n \n \n \n \n \n \n NPosM5-9\n \n \n \n \n \n \n NPosM50Plu\n \n \n \n \n \n \n NPosM<1\n \n \n \n \n \n \n RNegF1-4\n \n \n \n \n \n \n \n \n \n RNegF10-14\n \n \n \n \n \n \n RNegF15-19\n \n \n \n \n \n \n RNegF20-24\n \n \n \n \n \n \n RNegF25-29\n \n \n \n \n \n \n RNegF30-34\n \n \n \n \n \n \n RNegF35-39\n \n \n \n \n \n \n RNegF40-44\n \n \n \n \n \n \n RNegF45-49\n \n \n \n \n \n \n RNegF5-9\n \n \n \n \n \n \n RNegF50Plu\n \n \n \n \n \n \n RNegF<1\n \n \n \n \n \n \n RNegM1-4\n \n \n \n \n \n \n RNegM10-14\n \n \n \n \n \n \n RNegM15-19\n \n \n \n \n \n \n RNegM20-24\n \n \n \n \n \n \n RNegM25-29\n \n \n \n \n \n \n RNegM30-34\n \n \n \n \n \n \n RNegM35-39\n \n \n \n \n \n \n RNegM40-44\n \n \n \n \n \n \n RNegM45-49\n \n \n \n \n \n \n RNegM5-9\n \n \n \n \n \n \n RNegM50Plu\n \n \n \n \n \n \n RNegM<1\n \n \n \n \n \n \n RPosF1-4\n \n \n \n \n \n \n \n \n \n RPosF10-14\n \n \n \n \n \n \n RPosF15-19\n \n \n \n \n \n \n RPosF20-24\n \n \n \n \n \n \n RPosF25-29\n \n \n \n \n \n \n RPosF30-34\n \n \n \n \n \n \n RPosF35-39\n \n \n \n \n \n \n RPosF40-44\n \n \n \n \n \n \n RPosF45-49\n \n \n \n \n \n \n RPosF5-9\n \n \n \n \n \n \n RPosF50Plu\n \n \n \n \n \n \n RPosF<1\n \n \n \n \n \n \n RPosM1-4\n \n \n \n \n \n \n RPosM10-14\n \n \n \n \n \n \n RPosM15-19\n \n \n \n \n \n \n RPosM20-24\n \n \n \n \n \n \n RPosM25-29\n \n \n \n \n \n \n RPosM30-34\n \n \n \n \n \n \n RPosM35-39\n \n \n \n \n \n \n RPosM40-44\n \n \n \n \n \n \n RPosM45-49\n \n \n \n \n \n \n RPosM5-9\n \n \n \n \n \n \n RPosM50Plu\n \n \n \n \n \n \n RPosM<1\n \n \n \n \n \n \n','2021-10-08 15:08:14',4,'2021-10-10 01:08:00',4,0,NULL,NULL,NULL,'43f1ef2d-1b0d-46cf-96d3-f357f2d893ab'),(1375,'CITC_New_Neg_VMMC','CITC_New_Neg_VMMC','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_New_Neg_VMMC\n CITC_New_Neg_VMMC\n \n 2021-10-09 22:54:44 UTC\n \n 2021-10-09 22:59:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1375\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-10 00:54:44',4,'2021-10-10 00:59:55',4,0,NULL,NULL,NULL,'e735dc8b-4e55-46b0-98be-9d35609cdcd1'),(1376,'CITC_New_Pos_VMMC','CITC_New_Pos_VMMC','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_New_Pos_VMMC\n CITC_New_Pos_VMMC\n \n 2021-10-09 22:54:57 UTC\n \n 2021-10-09 23:00:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1376\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-10 00:54:57',4,'2021-10-10 01:00:23',4,0,NULL,NULL,NULL,'33e10e5c-b210-4364-bb0a-834ef9fef156'),(1377,'CITC_Repeat_Neg_VMMC','CITC_Repeat_Neg_VMMC','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_Repeat_Neg_VMMC\n CITC_Repeat_Neg_VMMC\n \n 2021-10-09 22:55:46 UTC\n \n 2021-10-09 23:00:47 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1377\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-10 00:55:46',4,'2021-10-10 01:00:47',4,0,NULL,NULL,NULL,'787c96e2-053c-4c5a-bac9-e6b2cdc11b3b'),(1378,'CITC_Repeat_Pos_VMMC','CITC_Repeat_Pos_VMMC','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_Repeat_Pos_VMMC\n CITC_Repeat_Pos_VMMC\n \n 2021-10-09 22:56:57 UTC\n \n 2021-10-09 23:02:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1378\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-10-10 00:56:57',4,'2021-10-10 01:02:21',4,0,NULL,NULL,NULL,'abbf2da2-d3f1-4ec4-bcf6-bc4f172771c2'),(1379,'CITC_HTS_VMMC','CITC_HTS_VMMC','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_HTS_VMMC\n CITC_HTS_VMMC\n \n 2021-10-09 23:06:10 UTC\n \n 2021-10-09 23:06:57 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1379\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2021-10-10 01:06:10',4,'2021-10-10 01:06:57',4,0,NULL,NULL,NULL,'893154ae-6213-4759-aaad-6662e595eabe'),(1380,'CITC_HTS_VMMC Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CITC_HTS_VMMC Data Set\n \n 2021-10-09 23:06:57 UTC\n \n 2021-10-10 22:32:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1380\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Finer_Age\n \n \n \n \n \n \n \n \n NNegF1-4\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 01-04yrs\n \n \n \n \n \n NNegF10-14\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 10-14yrs\n \n \n \n \n \n NNegF15-19\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 15-19yrs\n \n \n \n \n \n NNegF20-24\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 20-24yrs\n \n \n \n \n \n NNegF25-29\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 25-29yrs\n \n \n \n \n \n NNegF30-34\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 30-34yrs\n \n \n \n \n \n NNegF35-39\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 35-39yrs\n \n \n \n \n \n NNegF40-44\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 40-44yrs\n \n \n \n \n \n NNegF45-49\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 45-49yrs\n \n \n \n \n \n NNegF5-9\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 05-09yrs\n \n \n \n \n \n NNegF50Plu\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 50Plus\n \n \n \n \n \n NNegF<1\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n Under1yr\n \n \n \n \n \n NNegM1-4\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 01-04yrs\n \n \n \n \n \n NNegM10-14\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 10-14yrs\n \n \n \n \n \n NNegM15-19\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 15-19yrs\n \n \n \n \n \n NNegM20-24\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 20-24yrs\n \n \n \n \n \n NNegM25-29\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 25-29yrs\n \n \n \n \n \n NNegM30-34\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 30-34yrs\n \n \n \n \n \n NNegM35-39\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 35-39yrs\n \n \n \n \n \n NNegM40-44\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 40-44yrs\n \n \n \n \n \n NNegM45-49\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 45-49yrs\n \n \n \n \n \n NNegM5-9\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 05-09yrs\n \n \n \n \n \n NNegM50Plu\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 50Plus\n \n \n \n \n \n NNegM<1\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n Under1yr\n \n \n \n \n \n NPosF1-4\n \n \n \n \n \n \n \n \n \n NPosF10-14\n \n \n \n \n \n \n NPosF15-19\n \n \n \n \n \n \n NPosF20-24\n \n \n \n \n \n \n NPosF25-29\n \n \n \n \n \n \n NPosF30-34\n \n \n \n \n \n \n NPosF35-39\n \n \n \n \n \n \n NPosF40-44\n \n \n \n \n \n \n NPosF45-49\n \n \n \n \n \n \n NPosF5-9\n \n \n \n \n \n \n NPosF50Plu\n \n \n \n \n \n \n NPosF<1\n \n \n \n \n \n \n NPosM1-4\n \n \n \n \n \n \n NPosM10-14\n \n \n \n \n \n \n NPosM15-19\n \n \n \n \n \n \n NPosM20-24\n \n \n \n \n \n \n NPosM25-29\n \n \n \n \n \n \n NPosM30-34\n \n \n \n \n \n \n NPosM35-39\n \n \n \n \n \n \n NPosM40-44\n \n \n \n \n \n \n NPosM45-49\n \n \n \n \n \n \n NPosM5-9\n \n \n \n \n \n \n NPosM50Plu\n \n \n \n \n \n \n NPosM<1\n \n \n \n \n \n \n RNegF1-4\n \n \n \n \n \n \n \n \n \n RNegF10-14\n \n \n \n \n \n \n RNegF15-19\n \n \n \n \n \n \n RNegF20-24\n \n \n \n \n \n \n RNegF25-29\n \n \n \n \n \n \n RNegF30-34\n \n \n \n \n \n \n RNegF35-39\n \n \n \n \n \n \n RNegF40-44\n \n \n \n \n \n \n RNegF45-49\n \n \n \n \n \n \n RNegF5-9\n \n \n \n \n \n \n RNegF50Plu\n \n \n \n \n \n \n RNegF<1\n \n \n \n \n \n \n RNegM1-4\n \n \n \n \n \n \n RNegM10-14\n \n \n \n \n \n \n RNegM15-19\n \n \n \n \n \n \n RNegM20-24\n \n \n \n \n \n \n RNegM25-29\n \n \n \n \n \n \n RNegM30-34\n \n \n \n \n \n \n RNegM35-39\n \n \n \n \n \n \n RNegM40-44\n \n \n \n \n \n \n RNegM45-49\n \n \n \n \n \n \n RNegM5-9\n \n \n \n \n \n \n RNegM50Plu\n \n \n \n \n \n \n RNegM<1\n \n \n \n \n \n \n RPosF1-4\n \n \n \n \n \n \n \n \n \n RPosF10-14\n \n \n \n \n \n \n RPosF15-19\n \n \n \n \n \n \n RPosF20-24\n \n \n \n \n \n \n RPosF25-29\n \n \n \n \n \n \n RPosF30-34\n \n \n \n \n \n \n RPosF35-39\n \n \n \n \n \n \n RPosF40-44\n \n \n \n \n \n \n RPosF45-49\n \n \n \n \n \n \n RPosF5-9\n \n \n \n \n \n \n RPosF50Plu\n \n \n \n \n \n \n RPosF<1\n \n \n \n \n \n \n RPosM1-4\n \n \n \n \n \n \n RPosM10-14\n \n \n \n \n \n \n RPosM15-19\n \n \n \n \n \n \n RPosM20-24\n \n \n \n \n \n \n RPosM25-29\n \n \n \n \n \n \n RPosM30-34\n \n \n \n \n \n \n RPosM35-39\n \n \n \n \n \n \n RPosM40-44\n \n \n \n \n \n \n RPosM45-49\n \n \n \n \n \n \n RPosM5-9\n \n \n \n \n \n \n RPosM50Plu\n \n \n \n \n \n \n RPosM<1\n \n \n \n \n \n \n','2021-10-10 01:06:57',4,'2021-10-11 00:32:14',4,0,NULL,NULL,NULL,'03501008-0bd0-444d-9563-ccbc878fa540'),(1381,'Missed Appointments Under 28 Days Quarterly','Missed Appointments Under 28 Days for quarterly reporting','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Missed Appointments Under 28 Days Quarterly\n Missed Appointments Under 28 Days for quarterly reporting\n \n 2021-11-24 11:15:40 UTC\n \n 2021-11-24 12:16:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1381\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2021-11-24 13:15:40',4,'2021-11-24 14:16:41',4,0,NULL,NULL,NULL,'a8c08a78-5ad7-47d0-a164-32023f01d8c3'),(1382,'Missed Under 28 Days Quarterly Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Missed Under 28 Days Quarterly Data Set\n \n 2021-11-24 11:15:50 UTC\n \n 2021-11-24 11:36:46 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1382\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Finer_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n MissedF1-4\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 01-04yrs\n \n \n \n \n \n MissedF10-\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 10-14yrs\n \n \n \n \n \n MissedF15-\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 15-19yrs\n \n \n \n \n \n MissedF20-\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 20-24yrs\n \n \n \n \n \n MissedF25-\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 25-29yrs\n \n \n \n \n \n MissedF30-\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 30-34yrs\n \n \n \n \n \n MissedF35-\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 35-39yrs\n \n \n \n \n \n MissedF40-\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 40-44yrs\n \n \n \n \n \n MissedF45-\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 45-49yrs\n \n \n \n \n \n MissedF5-9\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 05-09yrs\n \n \n \n \n \n MissedF50P\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n 50Plus\n \n \n \n \n \n MissedF<1\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Finer_Age\n Under1yr\n \n \n \n \n \n MissedM1-4\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 01-04yrs\n \n \n \n \n \n MissedM10-\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 10-14yrs\n \n \n \n \n \n MissedM15-\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 15-19yrs\n \n \n \n \n \n MissedM20-\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 20-24yrs\n \n \n \n \n \n MissedM25-\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 25-29yrs\n \n \n \n \n \n MissedM30-\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 30-34yrs\n \n \n \n \n \n MissedM35-\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 35-39yrs\n \n \n \n \n \n MissedM40-\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 40-44yrs\n \n \n \n \n \n MissedM45-\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 45-49yrs\n \n \n \n \n \n MissedM5-9\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 05-09yrs\n \n \n \n \n \n MissedM50P\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n 50Plus\n \n \n \n \n \n MissedM<1\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Finer_Age\n Under1yr\n \n \n \n \n \n','2021-11-24 13:15:50',4,'2021-11-24 13:36:46',4,0,NULL,NULL,NULL,'d465ee4d-712a-468a-afbb-69a049e009c5'),(1383,'Test - Intakes Percentage','Test - Intakes Percentage','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Test - Intakes Percentage\n Test - Intakes Percentage\n \n 2021-12-08 11:44:27 UTC\n \n 2021-12-08 11:45:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1383\n','2021-12-08 13:44:27',4,'2021-12-08 13:45:08',4,0,NULL,NULL,NULL,'25bec7c7-30cd-49dd-9995-73b72f766ab7'),(1384,'TPT Started eRegister Process Report Weekly','TPT Started for eRegister Process Report','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TPT Started eRegister Process Report Weekly\n TPT Started for eRegister Process Report\n \n 2021-12-08 14:52:04 UTC\n \n 2021-12-08 16:16:37 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1384\n Select Id \nfrom \n(select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier \n from obs o \n -- CLIENTS SEEN FOR ART \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND (o.concept_id = 3843 AND o.value_coded = 3841 OR o.value_coded = 3842) \n AND MONTH(o.obs_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(o.obs_datetime) = YEAR(CAST(:endDate AS DATE)) \n AND patient.voided = 0 AND o.voided = 0 \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n )as A \n \n where Id in ( \n select distinct patient.patient_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n where concept_id = 2227 and value_coded = 2146 \n AND o.obs_datetime >=:startDate and o.obs_datetime <=:endDate \n \n )\n','2021-12-08 16:52:04',4,'2021-12-08 18:16:37',4,0,NULL,NULL,NULL,'90367439-c46f-4021-9858-29280bb738c7'),(1385,'TPT Started this Month','TPT Started this Month','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TPT Started this Month\n TPT Started this Month\n \n 2021-12-08 16:20:18 UTC\n \n 2021-12-08 16:20:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1385\n Select Id \nfrom \n(select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier \n from obs o \n -- CLIENTS SEEN FOR ART \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND (o.concept_id = 3843 AND o.value_coded = 3841 OR o.value_coded = 3842) \n AND MONTH(o.obs_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(o.obs_datetime) = YEAR(CAST(:endDate AS DATE)) \n AND patient.voided = 0 AND o.voided = 0 \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n )as A \n \n where Id in ( \n select distinct patient.patient_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n where concept_id = 2227 and value_coded = 2146 \n AND MONTH(o.obs_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(o.obs_datetime) = YEAR(CAST(:endDate AS DATE)) \n \n )\n','2021-12-08 18:20:18',4,'2021-12-08 18:20:42',4,0,NULL,NULL,NULL,'62e8947b-9360-430f-9708-f61d0adb8cf8'),(1386,'TPT Completed this Month','TPT Completed this Month','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TPT Completed this Month\n TPT Completed this Month\n \n 2021-12-13 12:12:58 UTC\n \n 2021-12-13 12:13:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1386\n Select Id \nfrom \n(select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier \n from obs o \n -- CLIENTS SEEN FOR ART \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND (o.concept_id = 3843 AND o.value_coded = 3841 OR o.value_coded = 3842) \n AND MONTH(o.obs_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(o.obs_datetime) = YEAR(CAST(:endDate AS DATE)) \n AND patient.voided = 0 AND o.voided = 0 \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n )as A \n \n where Id in ( \n select distinct os.person_id \n from obs os \n where concept_id = 4821 \n AND MONTH(os.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n \n )\n','2021-12-13 14:12:58',4,'2021-12-13 14:13:15',4,0,NULL,NULL,NULL,'05b50fa0-aa34-4c91-b02e-cd4e159533f1'),(1387,'TPT Completed eRegister Process Report Weekly','TPT Completed eRegister Process Report Weekly','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TPT Completed eRegister Process Report Weekly\n TPT Completed eRegister Process Report Weekly\n \n 2021-12-13 12:22:47 UTC\n \n 2021-12-13 12:23:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1387\n Select Id \nfrom \n(select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier \n from obs o \n -- CLIENTS SEEN FOR ART \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND (o.concept_id = 3843 AND o.value_coded = 3841 OR o.value_coded = 3842) \n AND MONTH(o.obs_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(o.obs_datetime) = YEAR(CAST(:endDate AS DATE)) \n AND patient.voided = 0 AND o.voided = 0 \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n )as A \n \n where Id in ( \n select distinct patient.patient_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n where concept_id = 4821 \n AND o.obs_datetime >=:startDate and o.obs_datetime <=:endDate \n \n )\n','2021-12-13 14:22:47',4,'2021-12-13 14:23:06',4,0,NULL,NULL,NULL,'3bc4a33c-71d7-483f-8c8e-db247e44e2bc'),(1388,'VL-04 VL tests performed_recent_3months','VL-04 VL tests performed in the recent 3 months','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n VL-04 VL tests performed_recent_3months\n VL-04 VL tests performed in the recent 3 months\n \n 2021-12-15 13:35:47 UTC\n \n 2021-12-16 09:05:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1388\n Select person_id \nFROM \n(select oss.person_id, MAX(oss.obs_datetime) as max_observation,CAST(Max(oss.value_datetime) as DATE) as Blood_Drawn_Date \n from obs oss \n where oss.concept_id = 4267 and oss.voided=0 \n and oss.value_datetime BETWEEN DATE(DATE_ADD(CAST(:endDate AS DATE), INTERVAL -3 MONTH)) AND date_add(cast(:endDate as datetime), interval 1 day) \n group by oss.person_id) as vl_tests_preformed\n','2021-12-15 15:35:47',4,'2021-12-16 11:05:21',4,0,NULL,NULL,NULL,'04eb3953-22d9-4733-aa50-4a8ed4742edf'),(1389,'TPT Continued eRegister Process Report Weekly','Clients Currently on TPT - eRegister Process Report Weekly','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TPT Continued eRegister Process Report Weekly\n Clients Currently on TPT - eRegister Process Report Weekly\n \n 2021-12-16 10:37:22 UTC\n \n 2021-12-16 10:51:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1389\n Select Id \nfrom \n(select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier \n from obs o \n -- CLIENTS SEEN FOR ART \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND (o.concept_id = 3843 AND o.value_coded = 3841 OR o.value_coded = 3842) \n AND MONTH(o.obs_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(o.obs_datetime) = YEAR(CAST(:endDate AS DATE)) \n AND patient.voided = 0 AND o.voided = 0 \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n )as A \n \n where Id in ( \n select distinct patient.patient_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n where concept_id = 2227 -- and value_coded = 2146 \n AND o.obs_datetime >=:startDate and o.obs_datetime <=:endDate \n \n )\n','2021-12-16 12:37:22',4,'2021-12-16 12:51:15',4,0,NULL,NULL,NULL,'2a45ccbb-5d49-46a5-9c14-86a68c658c0f'),(1390,'TPT Continuing this Month','Clients Continuing TPT this month','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TPT Continuing this Month\n Clients Continuing TPT this month\n \n 2021-12-16 10:50:30 UTC\n \n 2021-12-16 10:52:57 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1390\n Select Id \nfrom \n(select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier \n from obs o \n -- CLIENTS SEEN FOR ART \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND (o.concept_id = 3843 AND o.value_coded = 3841 OR o.value_coded = 3842) \n AND MONTH(o.obs_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(o.obs_datetime) = YEAR(CAST(:endDate AS DATE)) \n AND patient.voided = 0 AND o.voided = 0 \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n )as A \n \n where Id in ( \n select distinct os.person_id \n from obs os \n where concept_id = 4821 \n AND MONTH(os.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n \n )\n','2021-12-16 12:50:30',4,'2021-12-16 12:52:57',4,0,NULL,NULL,NULL,'8b56b3a8-d45a-413e-81d9-b47db2336814'),(1391,'CI54:TPT Started_Weekly','CI54:TPT Started','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CI54:TPT Started_Weekly\n CI54:TPT Started\n \n 2021-12-16 11:02:11 UTC\n \n 2021-12-16 11:04:49 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1391\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-12-16 13:02:11',4,'2021-12-16 13:04:49',4,0,NULL,NULL,NULL,'d12bddcf-0bfa-4c0b-96d4-fed20d3251d4'),(1392,'CI55:TPT Continued Weekly','CI55:TPT Continued Weekly','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CI55:TPT Continued Weekly\n CI55:TPT Continued Weekly\n \n 2021-12-16 11:06:12 UTC\n \n 2021-12-16 11:07:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1392\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-12-16 13:06:12',4,'2021-12-16 13:07:06',4,0,NULL,NULL,NULL,'6444a6c5-e484-4a40-911e-98ed6c43112d'),(1393,'CI56:TPT Completed Weekly','CI56:TPT Completed Weekly','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CI56:TPT Completed Weekly\n CI56:TPT Completed Weekly\n \n 2021-12-16 11:08:33 UTC\n \n 2021-12-16 11:17:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1393\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-12-16 13:08:33',4,'2021-12-16 13:17:21',4,0,NULL,NULL,NULL,'b78d514c-0203-44a4-8bc2-e04e521d3eff'),(1394,'CI57:VL Blood Draws in recent 3 months','CI57:VL Blood Draws recent 3 months','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CI57:VL Blood Draws in recent 3 months\n CI57:VL Blood Draws recent 3 months\n \n 2021-12-16 11:20:31 UTC\n \n 2021-12-16 11:22:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1394\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-12-16 13:20:31',4,'2021-12-16 13:22:32',4,0,NULL,NULL,NULL,'db80bf53-873d-4c0c-8847-726847b0c417'),(1395,'CI58:VL Results received within 3 months','CI58:VL Results received within 3 months','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CI58:VL Results received within 3 months\n CI58:VL Results received within 3 months\n \n 2021-12-16 11:24:28 UTC\n \n 2021-12-16 11:25:37 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1395\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-12-16 13:24:28',4,'2021-12-16 13:25:37',4,0,NULL,NULL,NULL,'5b8fbea7-884a-4e64-ae29-48732ba65c3a'),(1396,'CI59:VL Results received this month','CI59:VL Results received this month','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CI59:VL Results received this month\n CI59:VL Results received this month\n \n 2021-12-16 11:28:21 UTC\n \n 2021-12-16 11:29:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1396\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-12-16 13:28:21',4,'2021-12-16 13:29:17',4,0,NULL,NULL,NULL,'019b40c1-d072-414e-9ffd-a6f00f6eab86'),(1397,'CI60:Pending Results within 3 months','CI60:Pending Results within 3 months','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CI60:Pending Results within 3 months\n CI60:Pending Results within 3 months\n \n 2021-12-16 12:02:36 UTC\n \n 2021-12-16 12:03:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1397\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-12-16 14:02:36',4,'2021-12-16 14:03:44',4,0,NULL,NULL,NULL,'3f59f3a6-d116-4fce-ac20-e739c9cfefa6'),(1398,'CI61:Pending Results within 2 months','CI61:Pending Results within 2 months','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CI61:Pending Results within 2 months\n CI61:Pending Results within 2 months\n \n 2021-12-16 12:05:54 UTC\n \n 2021-12-16 12:06:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1398\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-12-16 14:05:54',4,'2021-12-16 14:06:36',4,0,NULL,NULL,NULL,'a8dcaa40-a96f-4714-a161-c9493a75ba91'),(1399,'CI62:Pending Results within 1 month','CI62:Pending Results within 1 month','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CI62:Pending Results within 1 month\n CI62:Pending Results within 1 month\n \n 2021-12-16 12:07:27 UTC\n \n 2021-12-16 12:08:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1399\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2021-12-16 14:07:27',4,'2021-12-16 14:08:04',4,0,NULL,NULL,NULL,'cb06df8b-0d0f-415c-ad52-322786e3e3fc'),(1401,'Discordant Couple','Couple discordant results','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Discordant Couple\n Couple discordant results\n \n 2022-02-16 18:59:38 UTC\n \n 2022-02-17 18:55:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1401\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in \n (select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND \n patient_identifier.identifier_type IN (3,5) AND patient_identifier.preferred=1 \n \n AND o.voided=0 \n AND MONTH(o.obs_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(o.obs_datetime) = YEAR(CAST(:endDate AS DATE)) \n \n where concept_id in (4225) and value_coded in (2146) \n Group by o.person_id \n)\n','2022-02-17 00:29:38',4,'2022-02-18 00:25:55',4,0,NULL,NULL,NULL,'09606416-9fdb-404a-a23f-2670030a98c2'),(1402,'Indeterminate results','indeterminate and inconclusive test results','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Indeterminate results\n indeterminate and inconclusive test results\n \n 2022-02-17 03:45:12 UTC\n \n 2022-02-17 03:57:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1402\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in \n (select o.person_id as Id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND \n patient_identifier.identifier_type IN (3,5) AND patient_identifier.preferred=1 \n \n AND o.voided=0 \n AND MONTH(o.obs_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(o.obs_datetime) = YEAR(CAST(:endDate AS DATE)) \n \n where concept_id in (4223) and value_coded in (4220) \n Group by o.person_id)\n','2022-02-17 09:15:12',4,'2022-02-17 09:27:02',4,0,NULL,NULL,NULL,'91361707-3e26-4592-b606-0d5b76fed7f5'),(1403,'Couples Only','HTS Clients Tested as Couple','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Couples Only\n HTS Clients Tested as Couple\n \n 2022-02-17 03:58:23 UTC\n \n 2022-02-24 07:00:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1403\n select distinct o.person_id \n from obs o inner join location l on o.location_id = l.location_id \n where (o.location_id =:location or parent_location =:location) \n and o.person_id in \n (select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND \n patient_identifier.identifier_type IN (3,5) AND patient_identifier.preferred=1 \n \n AND o.voided=0 \n AND MONTH(o.obs_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(o.obs_datetime) = YEAR(CAST(:endDate AS DATE)) \n \n where concept_id in (2166) and value_coded in (2146) \n Group by o.person_id)\n','2022-02-17 09:28:23',4,'2022-02-24 12:30:31',4,0,NULL,NULL,NULL,'7a60cfbe-7e8b-49bb-8f69-bf04e37c37e9'),(1404,'HTS Clients Screened ','Number of HTS Clients Screened for TB','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HTS Clients Screened \n Number of HTS Clients Screened for TB\n \n 2022-02-17 04:07:32 UTC\n \n 2022-03-17 10:26:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1404\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in \n (select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND \n patient_identifier.identifier_type IN (3) AND patient_identifier.preferred=1 \n \n AND o.voided=0 \n AND MONTH(o.obs_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(o.obs_datetime) = YEAR(CAST(:endDate AS DATE)) \n \n where concept_id in (2294) and value_coded in (2146) \n Group by o.person_id)\n','2022-02-17 04:07:32',4,'2022-03-17 10:26:05',4,0,NULL,NULL,NULL,'5a029d5e-f4ba-4e2c-8dc6-ba01d0ca45af'),(1405,'Confirmed Negative','HTS Confirmed Negative Clients','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Confirmed Negative\n HTS Confirmed Negative Clients\n \n 2022-02-17 12:05:47 UTC\n \n 2022-02-17 12:14:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1405\n select distinct o.person_id \n from obs o inner join location l on o.location_id = l.location_id \n where (o.location_id =:location or parent_location =:location) \n and o.person_id in \n (select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND \n patient_identifier.identifier_type IN (3,5) AND patient_identifier.preferred=1 \n \n AND o.voided=0 \n AND MONTH(o.obs_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(o.obs_datetime) = YEAR(CAST(:endDate AS DATE)) \n \n where concept_id in (2165) and value_coded in (1016) \n Group by o.person_id)\n','2022-02-17 17:35:47',4,'2022-02-17 17:44:51',4,0,NULL,NULL,NULL,'c9c50904-153c-4517-b462-5df83b4fd9b9'),(1406,'Confirmed Positives','HTS Confirmed Positive Clients','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Confirmed Positives\n HTS Confirmed Positive Clients\n \n 2022-02-17 12:17:04 UTC\n \n 2022-02-17 12:19:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1406\n select distinct o.person_id \n from obs o inner join location l on o.location_id = l.location_id \n where (o.location_id =:location or parent_location =:location) \n and o.person_id in \n (select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND \n patient_identifier.identifier_type IN (3,5) AND patient_identifier.preferred=1 \n \n AND o.voided=0 \n AND MONTH(o.obs_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(o.obs_datetime) = YEAR(CAST(:endDate AS DATE)) \n \n where concept_id in (2165) and value_coded in (1738) \n Group by o.person_id)\n','2022-02-17 17:47:04',4,'2022-02-17 17:49:20',4,0,NULL,NULL,NULL,'44a79d1e-c5ea-44ab-b6df-0c21abaa9a38'),(1407,'Indeterminate results','Total Indeterminate results','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.SqlIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Indeterminate results\n Total Indeterminate results\n \n 2022-02-17 17:40:50 UTC\n \n','2022-02-17 23:10:50',4,NULL,NULL,0,NULL,NULL,NULL,'13337249-1e1c-42a4-9f3e-edacbb906e5d'),(1408,'Indeterminate results','Total Indeterminate results','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Indeterminate results\n Total Indeterminate results\n \n 2022-02-17 17:42:25 UTC\n \n 2022-02-17 17:46:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1408\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-02-17 23:12:25',4,'2022-02-17 23:16:50',4,0,NULL,NULL,NULL,'e4e5a5d1-5d70-4a2e-83fb-902c382967d5'),(1409,'HTS Screened','Number of HTS Clients screened for TB','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HTS Screened\n Number of HTS Clients screened for TB\n \n 2022-02-17 17:49:05 UTC\n \n 2022-02-17 17:55:54 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1409\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-02-17 23:19:05',4,'2022-02-17 23:25:54',4,0,NULL,NULL,NULL,'5abf9b9c-5225-4470-a455-bcc7ca6addca'),(1411,'HTS Clients Screened for TB Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HTS Clients Screened for TB Data Set\n \n 2022-02-17 17:59:08 UTC\n \n 2022-02-17 18:30:56 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1411\n \n \n DM_Sex\n \n \n \n \n \n \n \n \n HTS_Female\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n \n \n \n HTS_Males\n \n \n \n \n DM_Sex\n Males\n \n \n \n \n \n','2022-02-17 23:29:08',4,'2022-02-18 00:00:56',4,0,NULL,NULL,NULL,'86204394-0168-468b-b3d8-0de0beb04bc2'),(1412,'Couples Only','HTS Clients tested as couples','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Couples Only\n HTS Clients tested as couples\n \n 2022-02-17 18:39:17 UTC\n \n 2022-02-17 18:41:37 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1412\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-02-18 00:09:17',4,'2022-02-18 00:11:37',4,0,NULL,NULL,NULL,'fa71acc6-bc29-4927-bbc4-d49906763b94'),(1413,'Discordant Results','Discordant Test Resultes','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Discordant Results\n Discordant Test Resultes\n \n 2022-02-17 18:53:30 UTC\n \n 2022-02-17 18:57:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1413\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-02-18 00:23:30',4,'2022-02-18 00:27:04',4,0,NULL,NULL,NULL,'73ea8489-1fa9-46ab-a2ce-6b6b2d73a33e'),(1414,'Confirmed Negatives','Number of Confirmed Negative Results','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Confirmed Negatives\n Number of Confirmed Negative Results\n \n 2022-02-17 18:59:07 UTC\n \n 2022-02-17 19:05:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1414\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-02-18 00:29:07',4,'2022-02-18 00:35:44',4,0,NULL,NULL,NULL,'e78ac003-c014-430b-806c-8f71e0b33164'),(1415,'Confirmed Positives','Number of confirmed positive results','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Confirmed Positives\n Number of confirmed positive results\n \n 2022-02-17 19:07:25 UTC\n \n 2022-02-17 19:08:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1415\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-02-18 00:37:25',4,'2022-02-18 00:38:40',4,0,NULL,NULL,NULL,'c43780c6-a70b-4cca-9821-af8fac2e5b75'),(1417,'Total Indeterminate Results Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Total Indeterminate Results Data Set\n \n 2022-02-17 19:12:45 UTC\n \n 2022-02-17 19:19:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1417\n \n \n \n \n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n \n \n','2022-02-18 00:42:45',4,'2022-02-18 00:49:17',4,0,NULL,NULL,NULL,'d8134c4d-7b2d-4421-93b5-986cf5263b17'),(1419,'Couples Only Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Couples Only Data Set\n \n 2022-02-17 19:22:38 UTC\n \n 2022-02-17 19:23:37 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1419\n \n \n \n \n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n \n \n','2022-02-18 00:52:38',4,'2022-02-18 00:53:37',4,0,NULL,NULL,NULL,'5f221d24-9b0f-4b56-8659-2262fa6383ca'),(1421,'Discordant Test Results Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Discordant Test Results Data Set\n \n 2022-02-17 19:25:59 UTC\n \n 2022-02-17 19:26:57 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1421\n \n \n \n \n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n \n \n','2022-02-18 00:55:59',4,'2022-02-18 00:56:57',4,0,NULL,NULL,NULL,'fe57a3d6-6ea3-4878-ab19-d3b2bc676b18'),(1422,'HTS_Post_Test_Counseling','HTS_Post_Test_Counseling','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HTS_Post_Test_Counseling\n HTS_Post_Test_Counseling\n \n 2022-02-17 19:30:06 UTC\n \n 2022-02-17 19:54:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1422\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2022-02-18 01:00:06',4,'2022-02-18 01:24:15',4,0,NULL,NULL,NULL,'a37e3f91-87d6-4126-b164-4888fa187f93'),(1423,'Number of Confirmatory Test Results Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Number of Confirmatory Test Results Data Set\n \n 2022-02-17 19:30:22 UTC\n \n 2022-02-24 18:31:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1423\n \n \n DM_Sex\n \n \n \n \n \n \n \n \n Couples\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n \n \n Distri_Kit\n \n \n \n \n \n \n \n \n \n HTS_Female\n \n \n \n \n \n \n \n DM_Sex\n Females\n \n \n \n \n \n HTS_Males\n \n \n \n \n DM_Sex\n Males\n \n \n \n \n \n Ind_Res\n \n \n \n \n \n \n \n \n \n Retur_Kits\n \n \n \n \n \n \n \n \n \n con_neg\n \n \n \n \n \n \n \n \n \n con_pos\n \n \n \n \n \n \n \n \n \n disc_res\n \n \n \n \n \n \n \n \n \n','2022-02-18 01:00:22',4,'2022-02-25 00:01:20',4,0,NULL,NULL,NULL,'e3eaeee4-8afa-4090-a2c5-72662d743f68'),(1425,'Distributed Self test Kits','Total HTS Self Test Distributed Kits','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Distributed Self test Kits\n Total HTS Self Test Distributed Kits\n \n 2022-02-24 13:03:04 UTC\n \n 2024-01-31 15:47:34 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1425\n select distinct o.obs_id \n from obs o \n where o.obs_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND \n patient_identifier.identifier_type IN (3,5) AND patient_identifier.preferred=1 \n INNER JOIN location l on o.location_id = l.location_id and l.retired=0 \n AND o.voided=0 \n AND MONTH(o.obs_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(o.obs_datetime) = YEAR(CAST(:endDate AS DATE)) \n where concept_id in (4968) \n and (o.location_id = :location or parent_location = :location) \n Union All \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND \n patient_identifier.identifier_type IN (3,5) AND patient_identifier.preferred=1 \n INNER JOIN location l on o.location_id = l.location_id and l.retired=0 \n AND o.voided=0 \n AND MONTH(o.obs_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(o.obs_datetime) = YEAR(CAST(:endDate AS DATE)) \n where concept_id in (4845) and value_coded in (4822) \n and (o.location_id = :location or parent_location = :location) \n )\n','2022-02-24 18:33:04',4,'2024-01-31 21:17:34',4,0,NULL,NULL,NULL,'7fb1f754-6cb8-4d98-bbeb-49a931f97994'); INSERT INTO `serialized_object` VALUES (1426,'Distributed Self Test Kits','Total Distributed Self Test Kits','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Distributed Self Test Kits\n Total Distributed Self Test Kits\n \n 2022-02-24 13:33:06 UTC\n \n 2022-02-24 18:11:54 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1426\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-02-24 19:03:06',4,'2022-02-24 23:41:54',4,0,NULL,NULL,NULL,'45e24163-6e6a-44a8-a168-1960f92e6664'),(1427,'HTS Self Test Kits Returned','Total HTS Self Test Kits Returned','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HTS Self Test Kits Returned\n Total HTS Self Test Kits Returned\n \n 2022-02-24 18:14:58 UTC\n \n 2022-02-24 18:25:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1427\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-02-24 23:44:58',4,'2022-02-24 23:55:27',4,0,NULL,NULL,NULL,'e448334c-d0c9-46cd-8041-45a9492aecb7'),(1428,'Returned Self Test Kits','Total Returned Self Test Kits','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Returned Self Test Kits\n Total Returned Self Test Kits\n \n 2022-02-24 18:19:33 UTC\n \n 2024-01-31 15:51:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1428\n select distinct o.obs_id \n from obs o \n where o.obs_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND \n patient_identifier.identifier_type IN (3,5) AND patient_identifier.preferred=1 \n INNER JOIN location l on o.location_id = l.location_id and l.retired=0 \n AND o.voided=0 \n AND MONTH(o.obs_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(o.obs_datetime) = YEAR(CAST(:endDate AS DATE)) \n \n where concept_id in (4844) and value_coded not in (2148) \n and (o.location_id = :location or parent_location = :location) \n Group by o.person_id \n )\n','2022-02-24 23:49:33',4,'2024-01-31 21:21:23',4,0,NULL,NULL,NULL,'fbebdef1-7e03-4061-b525-95f86632ab49'),(1429,'ART Clients Stopped','ART Clients who stopped treatment in that month','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n ART Clients Stopped\n ART Clients who stopped treatment in that month\n \n 2022-04-28 08:52:48 UTC\n \n 2022-04-28 08:54:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1429\n select os.person_id \n from obs os \n inner join location l on os.location_id = l.location_id \n where os.concept_id = 3701 and os.voided = 0 \n and MONTH(os.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n AND os.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3767 and o.value_coded = 2297 \n and o.voided = 0 \n \n )\n','2022-04-28 08:52:48',4,'2022-04-28 08:54:53',4,0,NULL,NULL,NULL,'2ea61d1f-e032-452e-bc0c-5ffb80c1a256'),(1430,'Clients given 4L weighing 0-3.9kg','Clients given 4L weighing 0-3.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L weighing 0-3.9kg\n Clients given 4L weighing 0-3.9kg\n \n 2022-06-30 09:34:15 UTC\n \n 2023-08-03 10:37:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1430\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4L \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4688)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight <=3.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 11:34:15',4,'2023-08-03 12:37:31',4,0,NULL,NULL,NULL,'1cbd9712-0dde-45fa-977c-98e3fd65681b'),(1431,'Clients given 4C weighing 0-3.9kg','Clients given 4C weighing 0-3.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C weighing 0-3.9kg\n Clients given 4C weighing 0-3.9kg\n \n 2022-06-30 09:37:12 UTC\n \n 2023-07-27 10:09:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1431\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2202)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight <=3.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 11:37:12',4,'2023-07-27 12:09:00',4,0,NULL,NULL,NULL,'9cd0146e-b566-4e02-9d37-da46810c833e'),(1432,'Clients given 4L weighing 4-5.9kg','Clients given 4L weighing 4-5.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L weighing 4-5.9kg\n Clients given 4L weighing 4-5.9kg\n \n 2022-06-30 09:37:43 UTC\n \n 2023-08-03 10:43:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1432\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4L \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4688)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=4 and _weight <=5.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 11:37:43',4,'2023-08-03 12:43:41',4,0,NULL,NULL,NULL,'aecca82d-d3c2-429d-acb2-56e1657ce6db'),(1433,'Clients given 4L weighing 6-9.9kg','Clients given 4L weighing 6-9.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L weighing 6-9.9kg\n Clients given 4L weighing 6-9.9kg\n \n 2022-06-30 09:39:53 UTC\n \n 2023-08-03 10:44:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1433\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4L \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4688)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=6 and _weight <=9.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 11:39:53',4,'2023-08-03 12:44:44',4,0,NULL,NULL,NULL,'1758b50a-2a2c-4b2c-b795-355255878304'),(1434,'Clients given 4L weighing 10-13.9kg','Clients given 4L weighing 10-13.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L weighing 10-13.9kg\n Clients given 4L weighing 10-13.9kg\n \n 2022-06-30 09:42:34 UTC\n \n 2023-08-03 10:40:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1434\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4L \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4688)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=10 and _weight <=13.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 11:42:34',4,'2023-08-03 12:40:14',4,0,NULL,NULL,NULL,'2c470abf-a5dc-4c5e-a1f0-dc85cc66b111'),(1435,'Clients given 4C weighing 4-5.9kg','Clients given 4C weighing 4-5.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C weighing 4-5.9kg\n Clients given 4C weighing 4-5.9kg\n \n 2022-06-30 09:43:58 UTC\n \n 2023-07-27 10:06:25 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1435\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2202)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=4 and _weight <=5.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 11:43:58',4,'2023-07-27 12:06:25',4,0,NULL,NULL,NULL,'ae72a1f2-5b35-4736-8a3d-d09eeaafaaf1'),(1436,'Clients given 4L weighing 14-19.9kg','Clients given 4L weighing 14-19.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L weighing 14-19.9kg\n Clients given 4L weighing 14-19.9kg\n \n 2022-06-30 09:44:49 UTC\n \n 2023-08-03 10:41:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1436\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4L \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4688)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=14 and _weight <=19.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 11:44:49',4,'2023-08-03 12:41:10',4,0,NULL,NULL,NULL,'c0c8885b-814c-4cb2-8c23-c10871a2b76d'),(1437,'Clients given 4L weighing 20-24.9kg','Clients given 4L weighing 20-24.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L weighing 20-24.9kg\n Clients given 4L weighing 20-24.9kg\n \n 2022-06-30 09:45:58 UTC\n \n 2023-08-03 10:41:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1437\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4L \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4688)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=20 and _weight <=24.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 11:45:58',4,'2023-08-03 12:41:51',4,0,NULL,NULL,NULL,'889cb817-6500-4ae1-9f84-e1ec42b46c00'),(1438,'Clients given 4L weighing 25-34.9kg','Clients given 4L weighing 25-34.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L weighing 25-34.9kg\n Clients given 4L weighing 25-34.9kg\n \n 2022-06-30 09:47:36 UTC\n \n 2023-08-03 10:42:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1438\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4L \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4688)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=25 and _weight <=34.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 11:47:36',4,'2023-08-03 12:42:36',4,0,NULL,NULL,NULL,'51076831-4759-4f7d-8d57-47fb8862e61c'),(1439,'Clients given 4L weighing >=35','Clients given 4L weighing >=35','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L weighing >=35\n Clients given 4L weighing >=35\n \n 2022-06-30 09:48:54 UTC\n \n 2023-08-03 10:36:25 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1439\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4L \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4688)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=35)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 11:48:54',4,'2023-08-03 12:36:25',4,0,NULL,NULL,NULL,'3ba57d29-931d-454e-916c-9e0c0e90d805'),(1440,'Clients given 4C weighing 6-9.9kg','Clients given 4C weighing 6-9.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C weighing 6-9.9kg\n Clients given 4C weighing 6-9.9kg\n \n 2022-06-30 09:49:04 UTC\n \n 2023-07-27 10:06:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1440\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2202)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=6 and _weight <=9.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 11:49:04',4,'2023-07-27 12:06:55',4,0,NULL,NULL,NULL,'d3d16a07-4319-4d63-82a2-4f47f7928a00'),(1441,'Clients given 4C weighing 10-13.9kg','Clients given 4C weighing 10-13.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C weighing 10-13.9kg\n Clients given 4C weighing 10-13.9kg\n \n 2022-06-30 09:50:51 UTC\n \n 2023-07-27 10:01:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1441\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2202)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=10 and _weight <=13.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 11:50:51',4,'2023-07-27 12:01:01',4,0,NULL,NULL,NULL,'09622f4b-49d5-4214-9eb4-7de4cae57a9d'),(1442,'Clients given 4K weighing 0-3.9kg','Clients given 4K weighing 0-3.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K weighing 0-3.9kg\n Clients given 4K weighing 0-3.9kg\n \n 2022-06-30 09:52:14 UTC\n \n 2023-07-27 12:56:47 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1442\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4K \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight <=3.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 11:52:14',4,'2023-07-27 14:56:47',4,0,NULL,NULL,NULL,'0f76ed94-e4f8-4f94-9bc4-4adbba1c66c1'),(1443,'Clients given 4C weighing 14-19.9kg','Clients given 4C weighing 14-19.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C weighing 14-19.9kg\n Clients given 4C weighing 14-19.9kg\n \n 2022-06-30 09:53:51 UTC\n \n 2023-08-15 13:35:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1443\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2202)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=14 and _weight <=19.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 11:53:51',4,'2023-08-15 15:35:14',4,0,NULL,NULL,NULL,'034244be-ee9b-4c5f-9c05-b69eefad3051'),(1444,'Clients given 4K weighing 4-5.9kg','Clients given 4K weighing 4-5.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K weighing 4-5.9kg\n Clients given 4K weighing 4-5.9kg\n \n 2022-06-30 09:53:56 UTC\n \n 2023-07-27 12:58:37 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1444\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4K \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=4 and _weight <=5.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 11:53:56',4,'2023-07-27 14:58:37',4,0,NULL,NULL,NULL,'fe700a2f-6c6b-4ab5-8692-4171cb0dc27c'),(1445,'Clients given 4K weighing 6-9.9kg','Clients given 4K weighing 6-9.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K weighing 6-9.9kg\n Clients given 4K weighing 6-9.9kg\n \n 2022-06-30 09:55:49 UTC\n \n 2023-07-27 12:59:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1445\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4K \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=6 and _weight <=9.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 11:55:49',4,'2023-07-27 14:59:00',4,0,NULL,NULL,NULL,'db5d6766-3a33-43c4-9732-a4d83ce9b1ea'),(1446,'Clients given 4K weighing 10-13.9kg','Clients given 4K weighing 10-13.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K weighing 10-13.9kg\n Clients given 4K weighing 10-13.9kg\n \n 2022-06-30 09:56:49 UTC\n \n 2023-07-27 12:57:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1446\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4K \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=10 and _weight <=13.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 11:56:49',4,'2023-07-27 14:57:10',4,0,NULL,NULL,NULL,'494aa500-1c2d-45b2-b6ba-aa987b52622a'),(1447,'Clients given 4K weighing 14-19.9kg','Clients given 4K weighing 14-19.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K weighing 14-19.9kg\n Clients given 4K weighing 14-19.9kg\n \n 2022-06-30 09:58:26 UTC\n \n 2023-07-27 12:57:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1447\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4K \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=14 and _weight <=19.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 11:58:26',4,'2023-07-27 14:57:30',4,0,NULL,NULL,NULL,'480ac769-5b88-4485-8885-03322fa49fc8'),(1448,'Clients given 4K weighing 20-24.9kg','Clients given 4K weighing 20-24.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K weighing 20-24.9kg\n Clients given 4K weighing 20-24.9kg\n \n 2022-06-30 09:59:23 UTC\n \n 2023-07-27 12:57:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1448\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4K \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=20 and _weight <=24.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 11:59:23',4,'2023-07-27 14:57:51',4,0,NULL,NULL,NULL,'3bd2b9e5-01e8-43ac-a17a-3912a89d7ff1'),(1449,'Clients given 4K weighing 25-34.9kg','Clients given 4K weighing 25-34.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K weighing 25-34.9kg\n Clients given 4K weighing 25-34.9kg\n \n 2022-06-30 10:01:21 UTC\n \n 2023-07-27 12:58:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1449\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4K \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=25 and _weight <=34.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:01:21',4,'2023-07-27 14:58:15',4,0,NULL,NULL,NULL,'921f9499-c27b-4b41-95e0-b85292fa2f92'),(1450,'Clients given 4K weighing >=35kg','Clients given 4K weighing >=35kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K weighing >=35kg\n Clients given 4K weighing >=35kg\n \n 2022-06-30 10:02:42 UTC\n \n 2023-07-27 12:56:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1450\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4K \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=35)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:02:42',4,'2023-07-27 14:56:23',4,0,NULL,NULL,NULL,'3229cff2-e047-4073-90c1-e06e867b402b'),(1451,'Clients given 4C weighing 20-24.9kg','Clients given 4C weighing 20-24.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C weighing 20-24.9kg\n Clients given 4C weighing 20-24.9kg\n \n 2022-06-30 10:02:57 UTC\n \n 2023-07-27 10:03:19 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1451\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2202)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=20 and _weight <=24.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:02:57',4,'2023-07-27 12:03:19',4,0,NULL,NULL,NULL,'9e67fab4-3382-49c7-bc4a-8e6f95ecd7ff'),(1452,'Clients given 4C weighing 25-34.9kg','Clients given 4C weighing 25-34.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C weighing 25-34.9kg\n Clients given 4C weighing 25-34.9kg\n \n 2022-06-30 10:04:55 UTC\n \n 2023-07-27 10:05:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1452\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2202)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=25 and _weight <=34.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:04:55',4,'2023-07-27 12:05:26',4,0,NULL,NULL,NULL,'1e41db8d-aca6-471d-af67-bddf792eb12e'),(1453,'Clients given 4C weighing >=35kg','Clients given 4C weighing >=35kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C weighing >=35kg\n Clients given 4C weighing >=35kg\n \n 2022-06-30 10:06:32 UTC\n \n 2023-07-27 10:08:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1453\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2202)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=35)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:06:32',4,'2023-07-27 12:08:27',4,0,NULL,NULL,NULL,'9bb26987-59cb-48b8-8235-502a3d2f52b4'),(1454,'Clients given 4J weighing 0-3.9kg','Clients given 4J weighing 0-3.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J weighing 0-3.9kg\n Clients given 4J weighing 0-3.9kg\n \n 2022-06-30 10:07:54 UTC\n \n 2023-07-27 10:59:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1454\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4J \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight <=3.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:07:54',4,'2023-07-27 12:59:20',4,0,NULL,NULL,NULL,'b4265cc6-ac60-4aeb-ba91-ef213a6d949e'),(1455,'Clients given 4D weighing 0-3.9kg','Clients given 4D weighing 0-3.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D weighing 0-3.9kg\n Clients given 4D weighing 0-3.9kg\n \n 2022-06-30 10:08:47 UTC\n \n 2023-07-27 09:27:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n 1455\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4d \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2204)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight > 0 and _weight <=3.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:08:47',4,'2023-07-27 11:27:03',4,0,NULL,NULL,NULL,'d998e2f6-840d-473b-b176-e0550de42412'),(1456,'Clients given 4D weighing 4-5.9kg','Clients given 4D weighing 4-5.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D weighing 4-5.9kg\n Clients given 4D weighing 4-5.9kg\n \n 2022-06-30 10:13:16 UTC\n \n 2023-07-27 09:38:34 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1456\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4d \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2204)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 4 and _weight <=5.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:13:16',4,'2023-07-27 11:38:34',4,0,NULL,NULL,NULL,'6a8a13fc-28a2-4778-840f-e45fb90009b6'),(1457,'Clients given 4D weighing 6-9.9kg','Clients given 4D weighing 6-9.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D weighing 6-9.9kg\n Clients given 4D weighing 6-9.9kg\n \n 2022-06-30 10:15:03 UTC\n \n 2023-07-27 09:39:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1457\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4d \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2204)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 6 and _weight <=9.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:15:03',4,'2023-07-27 11:39:10',4,0,NULL,NULL,NULL,'5d76364b-1150-4bd7-b456-7844b2f28312'),(1458,'Clients given 4J weighing 4-5.9kg','Clients given 4J weighing 4-5.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J weighing 4-5.9kg\n Clients given 4J weighing 4-5.9kg\n \n 2022-06-30 10:15:44 UTC\n \n 2023-07-27 11:01:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1458\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4J \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=4 and _weight <=5.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:15:44',4,'2023-07-27 13:01:23',4,0,NULL,NULL,NULL,'8a4200ea-3da7-406f-9961-272c3898fe6c'),(1459,'Clients given 4D weighing 10-13.9kg','Clients given 4D weighing 10-13.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D weighing 10-13.9kg\n Clients given 4D weighing 10-13.9kg\n \n 2022-06-30 10:18:04 UTC\n \n 2023-07-27 09:28:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1459\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4d \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2204)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 10 and _weight <=13.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:18:04',4,'2023-07-27 11:28:41',4,0,NULL,NULL,NULL,'8a6e7ee5-2a61-4944-bfb4-bb47a5698f6c'),(1460,'Clients given 4D weighing 14-19.9kg','Clients given 4D weighing 14-19.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D weighing 14-19.9kg\n Clients given 4D weighing 14-19.9kg\n \n 2022-06-30 10:19:54 UTC\n \n 2023-07-27 09:36:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1460\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4d \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2204)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 14 and _weight <=19.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:19:54',4,'2023-07-27 11:36:07',4,0,NULL,NULL,NULL,'45092d9a-31f7-4734-bad7-6afa4af47c8c'),(1461,'Clients given 4J weighing 6-9.9kg','Clients given 4J weighing 6-9.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J weighing 6-9.9kg\n Clients given 4J weighing 6-9.9kg\n \n 2022-06-30 10:21:51 UTC\n \n 2023-07-27 11:01:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1461\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4J \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=6 and _weight <=9.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:21:51',4,'2023-07-27 13:01:41',4,0,NULL,NULL,NULL,'5f5b772e-63e5-4b96-b211-629491f33c0d'),(1462,'Clients given 4D weighing 20-24.9kg','Clients given 4D weighing 20-24.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D weighing 20-24.9kg\n Clients given 4D weighing 20-24.9kg\n \n 2022-06-30 10:22:05 UTC\n \n 2023-07-27 09:36:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1462\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4d \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2204)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 20 and _weight <=24.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:22:05',4,'2023-07-27 11:36:30',4,0,NULL,NULL,NULL,'a0d8e3b8-722d-491c-bd0f-fa90956f51db'),(1463,'Clients given 4J weighing 10-13.9kg','Clients given 4J weighing 10-13.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J weighing 10-13.9kg\n Clients given 4J weighing 10-13.9kg\n \n 2022-06-30 10:22:53 UTC\n \n 2023-07-27 10:59:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1463\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4J \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=10 and _weight <=13.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:22:53',4,'2023-07-27 12:59:41',4,0,NULL,NULL,NULL,'790715b6-630c-4294-8577-6f4815e44797'),(1464,'Clients given 4J weighing 14-19.9kg','Clients given 4J weighing 14-19.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J weighing 14-19.9kg\n Clients given 4J weighing 14-19.9kg\n \n 2022-06-30 10:24:03 UTC\n \n 2023-07-27 10:59:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1464\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4J \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=14 and _weight <=19.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:24:03',4,'2023-07-27 12:59:55',4,0,NULL,NULL,NULL,'08528ef7-fb50-42e0-b520-afb3ecedbad2'),(1465,'Clients given 4D weighing 25-34.9kg','Clients given 4D weighing 25-34.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D weighing 25-34.9kg\n Clients given 4D weighing 25-34.9kg\n \n 2022-06-30 10:24:49 UTC\n \n 2023-07-27 09:37:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1465\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4d \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2204)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 25 and _weight <=34.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:24:49',4,'2023-07-27 11:37:45',4,0,NULL,NULL,NULL,'527ab6b7-03a7-4ad5-86ae-2c494b0b3cb0'),(1466,'Clients given 4J weighing 20-24.9kg','Clients given 4J weighing 20-24.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J weighing 20-24.9kg\n Clients given 4J weighing 20-24.9kg\n \n 2022-06-30 10:24:52 UTC\n \n 2023-07-27 11:00:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1466\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4J \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=20 and _weight <=24.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:24:52',4,'2023-07-27 13:00:42',4,0,NULL,NULL,NULL,'65757623-b703-423a-a092-06e04ed87180'),(1467,'Clients given 4D weighing >= 35kg','Clients given 4D weighing >= 35kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D weighing >= 35kg\n Clients given 4D weighing >= 35kg\n \n 2022-06-30 10:27:51 UTC\n \n 2023-07-27 09:40:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1467\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4d \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2204)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 35)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:27:51',4,'2023-07-27 11:40:28',4,0,NULL,NULL,NULL,'242cded5-b463-489d-a941-901a590d1d47'),(1468,'Clients given 4J weighing 25-34.9kg','Clients given 4J weighing 25-34.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J weighing 25-34.9kg\n Clients given 4J weighing 25-34.9kg\n \n 2022-06-30 10:28:09 UTC\n \n 2023-07-27 11:01:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1468\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4J \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=25 and _weight <=34.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:28:09',4,'2023-07-27 13:01:04',4,0,NULL,NULL,NULL,'83bc989a-e2b7-4bed-a628-fc59a59c1ba6'),(1469,'Clients given 4J weighing >=35kg','Clients given 4J weighing >=35kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J weighing >=35kg\n Clients given 4J weighing >=35kg\n \n 2022-06-30 10:28:53 UTC\n \n 2023-07-27 10:58:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1469\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4J \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=35)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:28:53',4,'2023-07-27 12:58:41',4,0,NULL,NULL,NULL,'72f98838-eb15-4cb6-a914-0852726e5647'),(1470,'Clients given 4E weighing 0-3.9kg','Clients given 4E weighing 0-3.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E weighing 0-3.9kg\n Clients given 4E weighing 0-3.9kg\n \n 2022-06-30 10:29:43 UTC\n \n 2023-07-27 10:22:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1470\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3679)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight <=3.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:29:43',4,'2023-07-27 12:22:02',4,0,NULL,NULL,NULL,'0ab11624-0249-40a0-971b-e3e8bb23ea70'),(1471,'Clients given 4E weighing 4-5.9kg','Clients given 4E weighing 4-5.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E weighing 4-5.9kg\n Clients given 4E weighing 4-5.9kg\n \n 2022-06-30 10:33:36 UTC\n \n 2023-07-27 10:26:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1471\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3679)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=4 and _weight <=5.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:33:36',4,'2023-07-27 12:26:59',4,0,NULL,NULL,NULL,'8519fd1c-bd73-43d6-8c51-e76191131ca3'),(1472,'Clients given 4E weighing 6-9.9kg','Clients given 4E weighing 6-9.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E weighing 6-9.9kg\n Clients given 4E weighing 6-9.9kg\n \n 2022-06-30 10:35:26 UTC\n \n 2023-07-27 10:27:56 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1472\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3679)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=6 and _weight <=9.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:35:26',4,'2023-07-27 12:27:56',4,0,NULL,NULL,NULL,'c165720f-b024-49dc-8775-49de3830ea6f'),(1473,'Clients given 4E weighing 10-13.9kg','Clients given 4E weighing 10-13.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E weighing 10-13.9kg\n Clients given 4E weighing 10-13.9kg\n \n 2022-06-30 10:36:35 UTC\n \n 2023-07-27 10:22:52 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n java.lang.String\n true\n \n \n 1473\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3679)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=10 and _weight <=13.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:36:35',4,'2023-07-27 12:22:52',4,0,NULL,NULL,NULL,'c14db25f-8596-4fae-ab12-430a740aa487'),(1474,'Clients given 4E weighing 14-19.9kg','Clients given 4E weighing 14-19.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E weighing 14-19.9kg\n Clients given 4E weighing 14-19.9kg\n \n 2022-06-30 10:38:12 UTC\n \n 2023-07-27 10:24:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1474\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3679)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=14 and _weight <=19.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:38:12',4,'2023-07-27 12:24:17',4,0,NULL,NULL,NULL,'bc5dc540-6696-47aa-a512-1cb7a78d7377'),(1475,'Clients given 4E weighing 20-24.9kg','Clients given 4E weighing 20-24.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E weighing 20-24.9kg\n Clients given 4E weighing 20-24.9kg\n \n 2022-06-30 10:40:04 UTC\n \n 2023-07-27 10:25:54 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1475\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3679)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=20 and _weight <=24.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:40:04',4,'2023-07-27 12:25:54',4,0,NULL,NULL,NULL,'221244d7-0042-432a-a711-d9cccd4358ab'),(1476,'Clients given 4E weighing 25-34.9kg','Clients given 4E weighing 25-34.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E weighing 25-34.9kg\n Clients given 4E weighing 25-34.9kg\n \n 2022-06-30 10:41:40 UTC\n \n 2023-07-27 10:26:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1476\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3679)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=25 and _weight <=34.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:41:40',4,'2023-07-27 12:26:28',4,0,NULL,NULL,NULL,'9490638d-1289-4114-bbbc-724006e38d93'),(1477,'Clients given 4E weighing >= 35kg','Clients given 4E weighing >= 35kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E weighing >= 35kg\n Clients given 4E weighing >= 35kg\n \n 2022-06-30 10:43:04 UTC\n \n 2023-07-27 10:21:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1477\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3679)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=35)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:43:04',4,'2023-07-27 12:21:29',4,0,NULL,NULL,NULL,'2bf8b315-8095-4176-ab7c-34d32e5302bb'),(1478,'Clients given 4F weighing 0-3.9kg','Clients given 4F weighing 0-3.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F weighing 0-3.9kg\n Clients given 4F weighing 0-3.9kg\n \n 2022-06-30 10:44:22 UTC\n \n 2023-07-27 10:41:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1478\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3680)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight <=3.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:44:22',4,'2023-07-27 12:41:29',4,0,NULL,NULL,NULL,'42b80ebc-ab48-48ca-a4f4-a20229c3e624'),(1479,'Clients given 4H weighing 0-3.9kg','Clients given 4H weighing 0-3.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H weighing 0-3.9kg\n Clients given 4H weighing 0-3.9kg\n \n 2022-06-30 10:44:56 UTC\n \n 2023-07-27 10:55:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1479\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4685)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight <=3.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:44:56',4,'2023-07-27 12:55:00',4,0,NULL,NULL,NULL,'4d8d584e-acb2-4935-b2ba-b1b175d8f7d5'),(1480,'Clients given 4H weighing 4-5.9kg','Clients given 4H weighing 4-5.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H weighing 4-5.9kg\n Clients given 4H weighing 4-5.9kg\n \n 2022-06-30 10:46:13 UTC\n \n 2023-07-27 10:56:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1480\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4685)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=4 and _weight <=5.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:46:13',4,'2023-07-27 12:56:53',4,0,NULL,NULL,NULL,'26f845a2-246d-468b-817a-9c60bdd078b9'),(1481,'Clients given 4F weighing 4-5.9kg','Clients given 4F weighing 4-5.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F weighing 4-5.9kg\n Clients given 4F weighing 4-5.9kg\n \n 2022-06-30 10:46:29 UTC\n \n 2023-07-27 10:43:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1481\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3680)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=4 and _weight <=5.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:46:29',4,'2023-07-27 12:43:41',4,0,NULL,NULL,NULL,'72862b43-6e4e-4a10-822f-ac5648433215'),(1482,'Clients given 4H weighing 6-9.9kg','Clients given 4H weighing 6-9.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H weighing 6-9.9kg\n Clients given 4H weighing 6-9.9kg\n \n 2022-06-30 10:46:57 UTC\n \n 2023-07-27 10:57:16 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1482\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4685)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=6 and _weight <=9.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:46:57',4,'2023-07-27 12:57:16',4,0,NULL,NULL,NULL,'01c48121-50df-46cb-8a3b-35623d584ebf'),(1483,'Clients given 4H weighing 10-13.9kg','Clients given 4H weighing 10-13.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H weighing 10-13.9kg\n Clients given 4H weighing 10-13.9kg\n \n 2022-06-30 10:47:36 UTC\n \n 2023-07-27 10:55:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1483\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4685)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=10 and _weight <=13.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:47:36',4,'2023-07-27 12:55:36',4,0,NULL,NULL,NULL,'d02359fe-619b-4a9c-871b-ae3aa3a98aa2'),(1484,'Clients given 4F weighing 6-9.9kg','Clients given 4F weighing 6-9.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F weighing 6-9.9kg\n Clients given 4F weighing 6-9.9kg\n \n 2022-06-30 10:47:39 UTC\n \n 2023-07-27 10:44:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1484\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3680)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=6 and _weight <=9.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:47:39',4,'2023-07-27 12:44:02',4,0,NULL,NULL,NULL,'b67ded87-6d0d-4d6a-8d86-01fffedfca86'),(1485,'Clients given 4F weighing 10-13.9kg','Clients given 4F weighing 10-13.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F weighing 10-13.9kg\n Clients given 4F weighing 10-13.9kg\n \n 2022-06-30 10:48:47 UTC\n \n 2023-07-27 10:41:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1485\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3680)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=10 and _weight <=13.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:48:47',4,'2023-07-27 12:41:53',4,0,NULL,NULL,NULL,'9ff30aca-0d8d-4fca-a3a9-13c0f28c48ac'),(1486,'Clients given 4H weighing 14-19.9kg','Clients given 4H weighing 14-19.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H weighing 14-19.9kg\n Clients given 4H weighing 14-19.9kg\n \n 2022-06-30 10:48:50 UTC\n \n 2023-07-27 10:55:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1486\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4685)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=14 and _weight <=19.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:48:50',4,'2023-07-27 12:55:55',4,0,NULL,NULL,NULL,'4477b341-8fb3-4d94-bc1a-cec68c45d5e8'),(1487,'Clients given 4F weighing 14-19.9kg','Clients given 4F weighing 14-19.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F weighing 14-19.9kg\n Clients given 4F weighing 14-19.9kg\n \n 2022-06-30 10:49:43 UTC\n \n 2023-07-27 10:42:09 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1487\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3680)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=14 and _weight <=19.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:49:43',4,'2023-07-27 12:42:09',4,0,NULL,NULL,NULL,'bc68c0e3-f9af-458a-9c48-e498e27e55cf'),(1488,'Clients given 4H weighing 20-24.9kg','Clients given 4H weighing 20-24.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H weighing 20-24.9kg\n Clients given 4H weighing 20-24.9kg\n \n 2022-06-30 10:49:44 UTC\n \n 2023-07-27 10:56:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1488\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4685)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=20 and _weight <=24.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:49:44',4,'2023-07-27 12:56:17',4,0,NULL,NULL,NULL,'db7df0b0-048e-4292-8047-aede481f516a'),(1489,'Clients given 4H weighing 25-34.9kg','Clients given 4H weighing 25-34.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H weighing 25-34.9kg\n Clients given 4H weighing 25-34.9kg\n \n 2022-06-30 10:50:30 UTC\n \n 2023-07-27 10:56:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1489\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4685)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=25 and _weight <=34.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:50:30',4,'2023-07-27 12:56:36',4,0,NULL,NULL,NULL,'8a0ffc3a-6f13-41d4-9012-80f7df387328'),(1490,'Clients given 4F weighing 20-24.9kg','Clients given 4F weighing 20-24.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F weighing 20-24.9kg\n Clients given 4F weighing 20-24.9kg\n \n 2022-06-30 10:50:41 UTC\n \n 2023-07-27 10:42:33 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1490\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3680)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=20 and _weight <=24.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:50:41',4,'2023-07-27 12:42:33',4,0,NULL,NULL,NULL,'acf07216-1652-4e83-9d65-6823c59981a8'),(1491,'Clients given 4H weighing >=35kg','Clients given 4H weighing >=35kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H weighing >=35kg\n Clients given 4H weighing >=35kg\n \n 2022-06-30 10:51:17 UTC\n \n 2023-07-27 10:54:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1491\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4685)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=35)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:51:17',4,'2023-07-27 12:54:12',4,0,NULL,NULL,NULL,'831a76ea-3a0d-4c8c-b68f-fcb26f67f6d8'),(1492,'Clients given 4F weighing 25-34.9kg','Clients given 4F weighing 25-34.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F weighing 25-34.9kg\n Clients given 4F weighing 25-34.9kg\n \n 2022-06-30 10:51:46 UTC\n \n 2023-07-27 10:43:13 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1492\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3680)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=25 and _weight <=34.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:51:46',4,'2023-07-27 12:43:13',4,0,NULL,NULL,NULL,'3da33639-d791-4633-8e15-b41313cb55f1'),(1493,'Clients given 4F weighing >= 35kg','Clients given 4F weighing >= 35kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F weighing >= 35kg\n Clients given 4F weighing >= 35kg\n \n 2022-06-30 10:53:56 UTC\n \n 2023-07-27 10:40:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1493\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3680)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=35)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:53:56',4,'2023-07-27 12:40:58',4,0,NULL,NULL,NULL,'c7599281-45dd-4b73-8ab0-ea8e524b98d1'),(1494,'Clients given 4G weighing 0-3.9kg','Clients given 4G weighing 0-3.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G weighing 0-3.9kg\n Clients given 4G weighing 0-3.9kg\n \n 2022-06-30 10:54:05 UTC\n \n 2023-07-27 10:46:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1494\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4684)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight <=3.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:54:05',4,'2023-07-27 12:46:39',4,0,NULL,NULL,NULL,'2475b103-3fa8-4b29-bb87-fab00aa27257'),(1495,'Clients given 4G weighing 4-5.9kg','Clients given 4G weighing 4-5.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G weighing 4-5.9kg\n Clients given 4G weighing 4-5.9kg\n \n 2022-06-30 10:55:47 UTC\n \n 2023-07-27 10:48:33 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1495\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4684)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=4 and _weight <=5.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:55:47',4,'2023-07-27 12:48:33',4,0,NULL,NULL,NULL,'b7fef4f2-1d0c-4942-88e3-45c9535ef4bc'),(1496,'Clients given 4G weighing 6-9.9kg','Clients given 4G weighing 6-9.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G weighing 6-9.9kg\n Clients given 4G weighing 6-9.9kg\n \n 2022-06-30 10:56:50 UTC\n \n 2023-07-27 10:48:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1496\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4684)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=6 and _weight <=9.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:56:50',4,'2023-07-27 12:48:51',4,0,NULL,NULL,NULL,'2539084a-3b56-4fd2-b7b7-1d75b7403e4c'),(1497,'Clients given 4G weighing 10-13.9kg','Clients given 4G weighing 10-13.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G weighing 10-13.9kg\n Clients given 4G weighing 10-13.9kg\n \n 2022-06-30 10:57:46 UTC\n \n 2023-07-27 10:47:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1497\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4684)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=10 and _weight <=13.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:57:46',4,'2023-07-27 12:47:08',4,0,NULL,NULL,NULL,'f7e13045-87fd-45c5-9e4c-818fbcb84888'),(1498,'Clients given 5A weighing 0-3.9kg','Clients given 5A weighing 0-3.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5A weighing 0-3.9kg\n Clients given 5A weighing 0-3.9kg\n \n 2022-06-30 10:58:03 UTC\n \n 2023-08-15 09:30:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1498\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5A \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3681)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=0 and _weight <=3.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:58:03',4,'2023-08-15 11:30:27',4,0,NULL,NULL,NULL,'87a82695-8e84-4f45-9b37-6fcfbdd68b9b'),(1499,'Clients given 4G weighing 14-19.9kg','Clients given 4G weighing 14-19.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G weighing 14-19.9kg\n Clients given 4G weighing 14-19.9kg\n \n 2022-06-30 10:58:40 UTC\n \n 2023-07-27 10:47:25 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1499\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4684)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=14 and _weight <=19.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:58:40',4,'2023-07-27 12:47:25',4,0,NULL,NULL,NULL,'91726710-94cf-4118-9c47-766cb5f11ae8'),(1500,'Clients given 4G weighing 20-24.9kg','Clients given 4G weighing 20-24.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G weighing 20-24.9kg\n Clients given 4G weighing 20-24.9kg\n \n 2022-06-30 10:59:29 UTC\n \n 2023-07-27 10:47:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1500\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4684)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=20 and _weight <=24.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 12:59:29',4,'2023-07-27 12:47:44',4,0,NULL,NULL,NULL,'e1070366-40ee-4f52-ae16-34a5de911a65'),(1501,'Clients given 4G weighing 25-34.9kg','Clients given 4G weighing 25-34.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G weighing 25-34.9kg\n Clients given 4G weighing 25-34.9kg\n \n 2022-06-30 11:00:09 UTC\n \n 2023-07-27 10:48:09 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1501\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4684)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=25 and _weight <=34.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:00:09',4,'2023-07-27 12:48:09',4,0,NULL,NULL,NULL,'d95d19d8-05d8-49d2-8b48-e0e179a7d99f'),(1502,'Clients given 5A weighing 4-5.9kg','Clients given 5A weighing 4-5.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5A weighing 4-5.9kg\n Clients given 5A weighing 4-5.9kg\n \n 2022-06-30 11:00:22 UTC\n \n 2023-08-15 10:10:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1502\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5A \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3681)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=4 and _weight <=5.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:00:22',4,'2023-08-15 12:10:02',4,0,NULL,NULL,NULL,'5b216507-efb0-46a6-a948-08f4bc7a2bf2'),(1503,'Clients given 4G weighing >=35kg','Clients given 4G weighing >=35kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G weighing >=35kg\n Clients given 4G weighing >=35kg\n \n 2022-06-30 11:00:59 UTC\n \n 2023-07-27 10:46:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1503\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4684)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=35)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:00:59',4,'2023-07-27 12:46:14',4,0,NULL,NULL,NULL,'0aa0cdb4-feed-4504-ad23-50fdfbb94347'),(1504,'Clients given 5A weighing 6-9.9kg','Clients given 5A weighing 6-9.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5A weighing 6-9.9kg\n Clients given 5A weighing 6-9.9kg\n \n 2022-06-30 11:01:39 UTC\n \n 2022-06-30 11:02:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1504\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5A \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND MONTH(os.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3681)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=6 and _weight <=9.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:01:39',4,'2022-06-30 13:02:04',4,0,NULL,NULL,NULL,'8c1a3939-af3e-4859-bc97-cfb2a9d2e712'),(1505,'Clients given 5A weighing 10-13.9kg','Clients given 5A weighing 10-13.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5A weighing 10-13.9kg\n Clients given 5A weighing 10-13.9kg\n \n 2022-06-30 11:02:41 UTC\n \n 2023-08-15 09:38:33 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1505\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5A \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3681)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=10 and _weight <=13.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:02:41',4,'2023-08-15 11:38:33',4,0,NULL,NULL,NULL,'3f90eaa0-49f7-4c6b-8ef4-9d75b1e83139'),(1506,'Clients given 5A weighing 14-19.9kg','Clients given 5A weighing 14-19.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5A weighing 14-19.9kg\n Clients given 5A weighing 14-19.9kg\n \n 2022-06-30 11:04:00 UTC\n \n 2023-08-15 09:44:19 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1506\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5A \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND MONTH(os.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3681)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=14 and _weight <=19.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:04:00',4,'2023-08-15 11:44:19',4,0,NULL,NULL,NULL,'f1b1f749-bfcc-4a13-b348-64c59866cc59'),(1507,'Clients given 5A weighing 20-24.9kg','Clients given 5A weighing 20-24.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5A weighing 20-24.9kg\n Clients given 5A weighing 20-24.9kg\n \n 2022-06-30 11:04:47 UTC\n \n 2023-08-15 09:46:25 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1507\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5A \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3681)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=20 and _weight <=24.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:04:47',4,'2023-08-15 11:46:25',4,0,NULL,NULL,NULL,'abad239c-e77e-4577-9ce7-dec2f8fec968'),(1508,'Clients given 5H weighing 0-3.9kg','Clients given 5H weighing 0-3.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5H weighing 0-3.9kg\n Clients given 5H weighing 0-3.9kg\n \n 2022-06-30 11:05:16 UTC\n \n 2022-06-30 11:05:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1508\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND MONTH(os.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4701)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight > 0 and _weight <=3.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:05:16',4,'2022-06-30 13:05:45',4,0,NULL,NULL,NULL,'6197805b-306c-4d08-8146-fa728c86cad0'),(1509,'Clients given 5A weighing 25-34.9kg','Clients given 5A weighing 25-34.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5A weighing 25-34.9kg\n Clients given 5A weighing 25-34.9kg\n \n 2022-06-30 11:05:57 UTC\n \n 2023-08-15 09:48:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1509\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5A \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3681)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=25 and _weight <=34.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:05:57',4,'2023-08-15 11:48:51',4,0,NULL,NULL,NULL,'56bc1e3d-3e39-4a2a-be29-f923f3403a9f'),(1510,'Clients given 5H weighing 4-5.9kg','Clients given 5H weighing 4-5.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5H weighing 4-5.9kg\n Clients given 5H weighing 4-5.9kg\n \n 2022-06-30 11:06:12 UTC\n \n 2022-06-30 11:06:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1510\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND MONTH(os.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4701)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 4 and _weight <=5.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:06:12',4,'2022-06-30 13:06:36',4,0,NULL,NULL,NULL,'f46b6d84-55a7-4fd0-af6d-da58bdfdadbc'),(1511,'Clients given 5A weighing >= 35kg','Clients given 5A weighing >= 35kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5A weighing >= 35kg\n Clients given 5A weighing >= 35kg\n \n 2022-06-30 11:07:03 UTC\n \n 2022-06-30 11:07:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1511\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5A \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND MONTH(os.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3681)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=35)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:07:03',4,'2022-06-30 13:07:39',4,0,NULL,NULL,NULL,'7313b979-6116-4b8c-8d45-159dce135628'),(1512,'Clients given 5H weighing 6-9.9kg','Clients given 5H weighing 6-9.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5H weighing 6-9.9kg\n Clients given 5H weighing 6-9.9kg\n \n 2022-06-30 11:07:30 UTC\n \n 2022-06-30 11:07:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1512\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND MONTH(os.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4701)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 6 and _weight <=9.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:07:30',4,'2022-06-30 13:07:53',4,0,NULL,NULL,NULL,'b302e353-da5b-495a-92bf-ac972aa7f94e'),(1513,'Clients given 5B weighing 0-3.9kg','Clients given 5B weighing 0-3.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5B weighing 0-3.9kg\n Clients given 5B weighing 0-3.9kg\n \n 2022-06-30 11:08:51 UTC\n \n 2023-08-15 10:23:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1513\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5B \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3682)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=0 and _weight <=3.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:08:51',4,'2023-08-15 12:23:59',4,0,NULL,NULL,NULL,'01fe5f00-9f8a-44c2-ba40-160f9d05d725'),(1514,'Clients given 5H weighing 10-13.9kg','Clients given 5H weighing 10-13.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5H weighing 10-13.9kg\n Clients given 5H weighing 10-13.9kg\n \n 2022-06-30 11:08:53 UTC\n \n 2022-06-30 11:09:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1514\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND MONTH(os.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4701)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 10 and _weight <=13.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:08:53',4,'2022-06-30 13:09:15',4,0,NULL,NULL,NULL,'fb13cd05-3a8a-4559-9bf2-8f2f4e2df601'),(1515,'Clients given 5H weighing 14-19.9kg','Clients given 5H weighing 14-19.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5H weighing 14-19.9kg\n Clients given 5H weighing 14-19.9kg\n \n 2022-06-30 11:09:36 UTC\n \n 2022-06-30 11:09:52 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1515\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND MONTH(os.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4701)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 14 and _weight <=19.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:09:36',4,'2022-06-30 13:09:52',4,0,NULL,NULL,NULL,'b99e2ade-ec65-4904-a6ca-e333b39322b6'),(1516,'Clients given 5H weighing 20-24.9kg','Clients given 5H weighing 20-24.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5H weighing 20-24.9kg\n Clients given 5H weighing 20-24.9kg\n \n 2022-06-30 11:10:25 UTC\n \n 2022-06-30 11:10:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1516\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND MONTH(os.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4701)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 20 and _weight <=24.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:10:25',4,'2022-06-30 13:10:43',4,0,NULL,NULL,NULL,'66408707-e4ad-4d2b-973c-77cd0220240c'),(1517,'Clients given 5B weighing 4-5.9kg','Clients given 5B weighing 4-5.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5B weighing 4-5.9kg\n Clients given 5B weighing 4-5.9kg\n \n 2022-06-30 11:10:36 UTC\n \n 2023-08-15 10:49:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1517\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5B \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3682)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=4 and _weight <=5.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:10:36',4,'2023-08-15 12:49:11',4,0,NULL,NULL,NULL,'ad0df8d9-d10d-4991-aa03-f7a96d902f69'),(1518,'Clients given 5H weighing 25-34.9kg','Clients given 5H weighing 25-34.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5H weighing 25-34.9kg\n Clients given 5H weighing 25-34.9kg\n \n 2022-06-30 11:11:12 UTC\n \n 2022-06-30 11:11:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1518\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND MONTH(os.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4701)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 25 and _weight <= 34.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:11:12',4,'2022-06-30 13:11:36',4,0,NULL,NULL,NULL,'67f0bd48-1cbf-4d6b-b037-1789f1b9f734'),(1519,'Clients given 5B weighing 6-9.9kg','Clients given 5B weighing 6-9.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5B weighing 6-9.9kg\n Clients given 5B weighing 6-9.9kg\n \n 2022-06-30 11:11:51 UTC\n \n 2023-08-15 10:50:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1519\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5B \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3682)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=6 and _weight <=9.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:11:51',4,'2023-08-15 12:50:59',4,0,NULL,NULL,NULL,'fcd13eef-bda1-46af-993f-ad29378c624a'),(1520,'Clients given 5H weighing >=35kg','Clients given 5H weighing >=35kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5H weighing >=35kg\n Clients given 5H weighing >=35kg\n \n 2022-06-30 11:12:13 UTC\n \n 2022-06-30 11:12:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1520\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND MONTH(os.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4701)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 35)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:12:13',4,'2022-06-30 13:12:39',4,0,NULL,NULL,NULL,'837029cf-0489-433f-b1f4-93207eb1bae5'),(1521,'Clients given 5B weighing 10-13.9kg','Clients given 5B weighing 10-13.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5B weighing 10-13.9kg\n Clients given 5B weighing 10-13.9kg\n \n 2022-06-30 11:13:00 UTC\n \n 2023-08-15 10:36:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1521\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5B \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3682)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=10 and _weight <=13.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:13:00',4,'2023-08-15 12:36:42',4,0,NULL,NULL,NULL,'f90822d7-8137-44bf-9b66-0022b61e1ece'),(1522,'Clients given 5B weighing 14-19.9kg','Clients given 5B weighing 14-19.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5B weighing 14-19.9kg\n Clients given 5B weighing 14-19.9kg\n \n 2022-06-30 11:13:55 UTC\n \n 2023-08-15 10:38:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1522\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5B \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3682)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=14 and _weight <=19.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:13:55',4,'2023-08-15 12:38:36',4,0,NULL,NULL,NULL,'247d8f89-0b72-4010-9328-a87600bd22d9'),(1523,'Clients given 5B weighing 20-24.9kg','Clients given 5B weighing 20-24.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5B weighing 20-24.9kg\n Clients given 5B weighing 20-24.9kg\n \n 2022-06-30 11:14:57 UTC\n \n 2023-08-15 10:43:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1523\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5B \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3682)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=20 and _weight <=24.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:14:57',4,'2023-08-15 12:43:27',4,0,NULL,NULL,NULL,'b9f0c6b6-a9f7-4ec3-9563-92a43def2068'),(1524,'Clients given 5G weighing 0-3.9kg','Clients given 5G weighing 0-3.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G weighing 0-3.9kg\n Clients given 5G weighing 0-3.9kg\n \n 2022-06-30 11:15:26 UTC\n \n 2023-08-15 14:15:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1524\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4700)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight > 0 and _weight <= 3.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:15:26',4,'2023-08-15 16:15:28',4,0,NULL,NULL,NULL,'d6899230-0f9b-4682-8822-478bfa1ad941'),(1525,'Clients given 5G weighing 4-5.9kg','Clients given 5G weighing 4-5.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G weighing 4-5.9kg\n Clients given 5G weighing 4-5.9kg\n \n 2022-06-30 11:16:09 UTC\n \n 2023-08-15 14:20:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1525\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4700)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 4 and _weight <= 5.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:16:09',4,'2023-08-15 16:20:31',4,0,NULL,NULL,NULL,'e0607707-f27c-434f-a5cd-44ed04531b3d'),(1526,'Clients given 5B weighing 25-34.9kg','Clients given 5B weighing 25-34.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5B weighing 25-34.9kg\n Clients given 5B weighing 25-34.9kg\n \n 2022-06-30 11:16:20 UTC\n \n 2023-08-15 10:46:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1526\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5B \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3682)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=25 and _weight <=34.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:16:20',4,'2023-08-15 12:46:41',4,0,NULL,NULL,NULL,'bd44e473-7f7a-4848-beb6-414f3c87ada1'),(1527,'Clients given 5G weighing 6-9.9kg','Clients given 5G weighing 6-9.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G weighing 6-9.9kg\n Clients given 5G weighing 6-9.9kg\n \n 2022-06-30 11:17:00 UTC\n \n 2023-08-15 14:21:24 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1527\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4700)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 6 and _weight <= 9.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:17:00',4,'2023-08-15 16:21:24',4,0,NULL,NULL,NULL,'2fa35676-ccce-4bde-a76f-65b9de55fd54'),(1528,'Clients given 5B weighing >= 35kg','Clients given 5B weighing >= 35kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5B weighing >= 35kg\n Clients given 5B weighing >= 35kg\n \n 2022-06-30 11:17:28 UTC\n \n 2023-08-15 10:21:09 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1528\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5B \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3682)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=35)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:17:28',4,'2023-08-15 12:21:09',4,0,NULL,NULL,NULL,'25a796fe-9437-4e38-9c95-6ef6bb295e8e'),(1529,'Clients given 5G weighing 10-13.9kg','Clients given 5G weighing 10-13.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G weighing 10-13.9kg\n Clients given 5G weighing 10-13.9kg\n \n 2022-06-30 11:18:10 UTC\n \n 2023-08-15 14:16:57 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1529\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4700)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 10 and _weight <= 13.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:18:10',4,'2023-08-15 16:16:57',4,0,NULL,NULL,NULL,'00ae6c3c-d1c6-44b8-ae77-0b0dadd15e1f'),(1530,'Clients given 5C weighing 0-3.9kg','Clients given 5C weighing 0-3.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5C weighing 0-3.9kg\n Clients given 5C weighing 0-3.9kg\n \n 2022-06-30 11:19:00 UTC\n \n 2023-08-15 10:58:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1530\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4696)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=0 and _weight <=3.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:19:00',4,'2023-08-15 12:58:29',4,0,NULL,NULL,NULL,'1e058b14-9ac4-4412-96ab-33fd04c575b0'),(1531,'Clients given 5G weighing 14-19.9kg','Clients given 5G weighing 14-19.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G weighing 14-19.9kg\n Clients given 5G weighing 14-19.9kg\n \n 2022-06-30 11:19:16 UTC\n \n 2023-08-15 14:18:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1531\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4700)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 14 and _weight <= 19.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:19:16',4,'2023-08-15 16:18:04',4,0,NULL,NULL,NULL,'2d4f2764-5ad4-4259-88bc-d6cfe29e5365'),(1532,'Clients given 5G weighing 20-24.9kg','Clients given 5G weighing 20-24.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G weighing 20-24.9kg\n Clients given 5G weighing 20-24.9kg\n \n 2022-06-30 11:19:50 UTC\n \n 2023-08-15 14:18:49 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1532\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4700)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 20 and _weight <= 24.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:19:50',4,'2023-08-15 16:18:49',4,0,NULL,NULL,NULL,'5869ce40-ff99-4614-b3f5-e058345f91a8'),(1533,'Clients given 5G weighing 25 -34.9kg','Clients given 5G weighing 25 -34.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G weighing 25 -34.9kg\n Clients given 5G weighing 25 -34.9kg\n \n 2022-06-30 11:20:43 UTC\n \n 2023-08-15 14:19:37 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1533\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4700)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 25 and _weight <= 34.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:20:43',4,'2023-08-15 16:19:37',4,0,NULL,NULL,NULL,'3134cfcd-283c-43a2-bb15-8ae6356ebbdd'),(1534,'Clients given 5C weighing 4-5.9kg','Clients given 5C weighing 4-5.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5C weighing 4-5.9kg\n Clients given 5C weighing 4-5.9kg\n \n 2022-06-30 11:21:08 UTC\n \n 2023-08-15 11:12:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1534\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4696)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=4 and _weight <=5.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:21:08',4,'2023-08-15 13:12:06',4,0,NULL,NULL,NULL,'b6a6e9f5-36ec-414e-95ec-b4a4bb1e7f77'),(1535,'Clients given 5G weighing >=35kg','Clients given 5G weighing >=35kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G weighing >=35kg\n Clients given 5G weighing >=35kg\n \n 2022-06-30 11:21:23 UTC\n \n 2023-08-15 14:14:25 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1535\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4700)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 35)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:21:23',4,'2023-08-15 16:14:25',4,0,NULL,NULL,NULL,'cb219c31-fab1-4f82-a202-48a4a8744a6e'),(1536,'Clients given 5C weighing 6-9.9kg','Clients given 5C weighing 6-9.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5C weighing 6-9.9kg\n Clients given 5C weighing 6-9.9kg\n \n 2022-06-30 11:22:17 UTC\n \n 2023-08-15 11:16:22 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1536\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4696)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=6 and _weight <=9.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:22:17',4,'2023-08-15 13:16:22',4,0,NULL,NULL,NULL,'e96a3e05-ee48-46f8-ad52-7ea11c785404'),(1537,'Clients given 5F weighing 0-3.9kg','Clients given 5F weighing 0-3.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5F weighing 0-3.9kg\n Clients given 5F weighing 0-3.9kg\n \n 2022-06-30 11:22:53 UTC\n \n 2023-08-15 13:52:56 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1537\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4699)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight > 0 and _weight <= 3.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:22:53',4,'2023-08-15 15:52:56',4,0,NULL,NULL,NULL,'3ed934cc-c2f7-4f9c-ab10-1794412389f1'),(1538,'Clients given 5C weighing 10-13.9kg','Clients given 5C weighing 10-13.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5C weighing 10-13.9kg\n Clients given 5C weighing 10-13.9kg\n \n 2022-06-30 11:23:09 UTC\n \n 2023-08-15 11:00:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1538\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND MONTH(os.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4696)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=10 and _weight <=13.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:23:09',4,'2023-08-15 13:00:14',4,0,NULL,NULL,NULL,'35aa87a9-9aec-42c6-a80d-1f71d2be1ef8'),(1539,'Clients given 5C weighing 14-19.9kg','Clients given 5C weighing 14-19.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5C weighing 14-19.9kg\n Clients given 5C weighing 14-19.9kg\n \n 2022-06-30 11:23:56 UTC\n \n 2023-08-15 11:03:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1539\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4696)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=14 and _weight <=19.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:23:56',4,'2023-08-15 13:03:40',4,0,NULL,NULL,NULL,'8827cdb6-b0b0-4dad-84d7-d06aae03ac3b'),(1540,'Clients given 5C weighing 20-24.9kg','Clients given 5C weighing 20-24.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5C weighing 20-24.9kg\n Clients given 5C weighing 20-24.9kg\n \n 2022-06-30 11:24:56 UTC\n \n 2023-08-15 11:06:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1540\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4696)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=20 and _weight <=24.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:24:56',4,'2023-08-15 13:06:21',4,0,NULL,NULL,NULL,'7cc30e9c-763c-454b-b961-d19c47d2da6a'),(1541,'Clients given 5F weighing 4-5.9kg','Clients given 5F weighing 4-5.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5F weighing 4-5.9kg\n Clients given 5F weighing 4-5.9kg\n \n 2022-06-30 11:24:57 UTC\n \n 2022-06-30 11:26:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1541\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND MONTH(os.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4699)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 4 and _weight <= 5.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:24:57',4,'2022-06-30 13:26:23',4,0,NULL,NULL,NULL,'86aec40b-a4e3-49f5-8c61-1b4395bddd75'),(1542,'Clients given 5F weighing 6-9.9kg','Clients given 5F weighing 6-9.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5F weighing 6-9.9kg\n Clients given 5F weighing 6-9.9kg\n \n 2022-06-30 11:25:26 UTC\n \n 2023-08-15 14:09:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1542\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4699)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 6 and _weight <= 9.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:25:26',4,'2023-08-15 16:09:20',4,0,NULL,NULL,NULL,'74ddbe48-ab4a-40e2-be97-c0ecfca4ec3d'),(1543,'Clients given 5C weighing 25-34.9kg','Clients given 5C weighing 25-34.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5C weighing 25-34.9kg\n Clients given 5C weighing 25-34.9kg\n \n 2022-06-30 11:26:03 UTC\n \n 2022-06-30 11:26:35 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1543\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND MONTH(os.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4696)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=25 and _weight <=34.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:26:03',4,'2022-06-30 13:26:35',4,0,NULL,NULL,NULL,'62831d13-bff3-4d96-b097-03c7f656489c'),(1544,'Clients given 5F weighing 10-13.9kg','Clients given 5F weighing 10-13.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5F weighing 10-13.9kg\n Clients given 5F weighing 10-13.9kg\n \n 2022-06-30 11:26:51 UTC\n \n 2023-08-15 13:54:54 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1544\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4699)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 10 and _weight <= 13.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:26:51',4,'2023-08-15 15:54:54',4,0,NULL,NULL,NULL,'32b14f2b-ab48-4905-a130-7cc98fadc7a3'),(1545,'Clients given 5C weighing >= 35kg','Clients given 5C weighing >= 35kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5C weighing >= 35kg\n Clients given 5C weighing >= 35kg\n \n 2022-06-30 11:27:06 UTC\n \n 2023-08-15 10:56:19 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1545\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4696)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=35)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:27:06',4,'2023-08-15 12:56:19',4,0,NULL,NULL,NULL,'2253da71-2fae-4683-87c0-4e876e27b5d9'); INSERT INTO `serialized_object` VALUES (1546,'Clients given 5F weighing 14-19.9kg','Clients given 5F weighing 14-19.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5F weighing 14-19.9kg\n Clients given 5F weighing 14-19.9kg\n \n 2022-06-30 11:27:37 UTC\n \n 2023-08-15 13:58:33 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1546\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4699)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 14 and _weight <= 19.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:27:37',4,'2023-08-15 15:58:33',4,0,NULL,NULL,NULL,'ce94925c-9501-475d-8ab6-9a34881d6c9a'),(1547,'Clients given 5F weighing 20-24.9kg','Clients given 5F weighing 20-24.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5F weighing 20-24.9kg\n Clients given 5F weighing 20-24.9kg\n \n 2022-06-30 11:28:13 UTC\n \n 2023-08-15 14:00:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1547\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4699)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 20 and _weight <= 24.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:28:13',4,'2023-08-15 16:00:55',4,0,NULL,NULL,NULL,'4e2fdf19-88d3-404b-8467-adbaba647c6c'),(1548,'Clients given 5D weighing 0-3.9kg','Clients given 5D weighing 0-3.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5D weighing 0-3.9kg\n Clients given 5D weighing 0-3.9kg\n \n 2022-06-30 11:28:24 UTC\n \n 2023-08-15 11:28:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1548\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5D \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4697)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=0 and _weight <=3.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:28:24',4,'2023-08-15 13:28:55',4,0,NULL,NULL,NULL,'9b7dc1a8-9c16-4ece-bf35-c13c45e27fd9'),(1549,'Clients given 5F weighing 25-34.9kg','Clients given 5F weighing 25-34.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5F weighing 25-34.9kg\n Clients given 5F weighing 25-34.9kg\n \n 2022-06-30 11:28:59 UTC\n \n 2023-08-15 14:02:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1549\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4699)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 25 and _weight <= 34.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:28:59',4,'2023-08-15 16:02:41',4,0,NULL,NULL,NULL,'8a336065-e783-4b0b-bfba-d49c0507171c'),(1550,'Clients given 5D weighing 4-5.9kg','Clients given 5D weighing 4-5.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5D weighing 4-5.9kg\n Clients given 5D weighing 4-5.9kg\n \n 2022-06-30 11:29:51 UTC\n \n 2023-08-15 12:02:22 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1550\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5D \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4697)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=4 and _weight <=5.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:29:51',4,'2023-08-15 14:02:22',4,0,NULL,NULL,NULL,'19fcd7c2-7d0e-4f89-8893-b7e56a90f565'),(1551,'Clients given 5F weighing >=35kg','Clients given 5F weighing >=35kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5F weighing >=35kg\n Clients given 5F weighing >=35kg\n \n 2022-06-30 11:30:09 UTC\n \n 2023-08-15 13:45:47 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1551\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4699)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 35)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:30:09',4,'2023-08-15 15:45:47',4,0,NULL,NULL,NULL,'8d926451-29fe-44cb-9898-a0aed10c3786'),(1552,'Clients given 5D weighing 6-9.9kg','Clients given 5D weighing 6-9.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5D weighing 6-9.9kg\n Clients given 5D weighing 6-9.9kg\n \n 2022-06-30 11:30:53 UTC\n \n 2023-08-15 12:03:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1552\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5D \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4697)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=6 and _weight <=9.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:30:53',4,'2023-08-15 14:03:43',4,0,NULL,NULL,NULL,'c4e2b4a6-62d3-4828-9088-05f88efd29d0'),(1553,'Clients given 5D weighing 10-13.9kg','Clients given 5D weighing 10-13.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5D weighing 10-13.9kg\n Clients given 5D weighing 10-13.9kg\n \n 2022-06-30 11:32:07 UTC\n \n 2023-08-15 11:52:13 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1553\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5D \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4697)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=10 and _weight <=13.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:32:07',4,'2023-08-15 13:52:13',4,0,NULL,NULL,NULL,'af887c72-8ee7-4273-abe0-8755f691eeb7'),(1554,'Clients given 5E weighing 0-3.9kg','Clients given 5E weighing 0-3.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5E weighing 0-3.9kg\n Clients given 5E weighing 0-3.9kg\n \n 2022-06-30 11:33:14 UTC\n \n 2023-08-15 12:11:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1554\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4698)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 0 and _weight <= 3.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:33:14',4,'2023-08-15 14:11:02',4,0,NULL,NULL,NULL,'e79351a3-8b87-48de-879e-7f531c97ae16'),(1555,'Clients given 5D weighing 14-19.9kg','Clients given 5D weighing 14-19.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5D weighing 14-19.9kg\n Clients given 5D weighing 14-19.9kg\n \n 2022-06-30 11:33:21 UTC\n \n 2023-08-15 11:55:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1555\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5D \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4697)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=14 and _weight <=19.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:33:21',4,'2023-08-15 13:55:11',4,0,NULL,NULL,NULL,'412170be-ff0c-4690-bc21-2fe362faafb1'),(1556,'Clients given 5E weighing 4-5.9kg','Clients given 5E weighing 4-5.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5E weighing 4-5.9kg\n Clients given 5E weighing 4-5.9kg\n \n 2022-06-30 11:34:03 UTC\n \n 2023-08-15 12:22:56 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1556\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4698)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 4 and _weight <= 5.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:34:03',4,'2023-08-15 14:22:56',4,0,NULL,NULL,NULL,'a6067fc6-8c70-4691-aa23-3e5a7973d4e4'),(1557,'Clients given 5D weighing 20-24.9kg','Clients given 5D weighing 20-24.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5D weighing 20-24.9kg\n Clients given 5D weighing 20-24.9kg\n \n 2022-06-30 11:34:31 UTC\n \n 2023-08-15 11:57:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1557\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5D \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4697)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=20 and _weight <=24.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:34:31',4,'2023-08-15 13:57:06',4,0,NULL,NULL,NULL,'b12b32c4-ae91-44c1-bb7a-f2a4f0f74dcc'),(1558,'Clients given 5E weighing 6-9.9kg','Clients given 5E weighing 6-9.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5E weighing 6-9.9kg\n Clients given 5E weighing 6-9.9kg\n \n 2022-06-30 11:34:43 UTC\n \n 2023-08-15 12:23:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1558\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4698)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 6 and _weight <= 9.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:34:43',4,'2023-08-15 14:23:53',4,0,NULL,NULL,NULL,'ddbb6383-120a-4cfc-b376-eb9ec22e891b'),(1559,'Clients given 5E weighing 10-13.9kg','Clients given 5E weighing 10-13.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5E weighing 10-13.9kg\n Clients given 5E weighing 10-13.9kg\n \n 2022-06-30 11:35:22 UTC\n \n 2023-08-15 12:13:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1559\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4698)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 10 and _weight <= 13.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:35:22',4,'2023-08-15 14:13:26',4,0,NULL,NULL,NULL,'9334b5ec-d46f-465b-91f5-aba7e4f590a0'),(1560,'Clients given 5D weighing 25-34.9kg','Clients given 5D weighing 25-34.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5D weighing 25-34.9kg\n Clients given 5D weighing 25-34.9kg\n \n 2022-06-30 11:35:31 UTC\n \n 2023-08-15 11:59:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1560\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5D \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4697)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=25 and _weight <=34.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:35:31',4,'2023-08-15 13:59:41',4,0,NULL,NULL,NULL,'88ff4abe-3367-4de0-be20-eaa6991568ce'),(1561,'Clients given 5E weighing 14-19.9kg','Clients given 5E weighing 14-19.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5E weighing 14-19.9kg\n Clients given 5E weighing 14-19.9kg\n \n 2022-06-30 11:36:01 UTC\n \n 2023-08-15 12:14:47 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1561\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4698)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 14 and _weight <= 19.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:36:01',4,'2023-08-15 14:14:47',4,0,NULL,NULL,NULL,'1514aaa6-288c-423b-96e6-ae5ee9074647'),(1562,'Clients given 5E weighing 20-24.9kg','Clients given 5E weighing 20-24.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5E weighing 20-24.9kg\n Clients given 5E weighing 20-24.9kg\n \n 2022-06-30 11:36:43 UTC\n \n 2023-08-15 12:20:37 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1562\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4698)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 20 and _weight <= 24.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:36:43',4,'2023-08-15 14:20:37',4,0,NULL,NULL,NULL,'28e98d97-dc6d-412f-89cb-3f19cd4d38b9'),(1563,'Clients given 5D weighing >= 35kg','Clients given 5D weighing >= 35kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5D weighing >= 35kg\n Clients given 5D weighing >= 35kg\n \n 2022-06-30 11:36:48 UTC\n \n 2023-08-15 11:23:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1563\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5D \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4697)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=35)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:36:48',4,'2023-08-15 13:23:11',4,0,NULL,NULL,NULL,'b4d8909f-2edb-4730-bf71-446d2fd8867c'),(1564,'Clients given 5E weighing 25-34.9kg','Clients given 5E weighing 25-34.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5E weighing 25-34.9kg\n Clients given 5E weighing 25-34.9kg\n \n 2022-06-30 11:37:59 UTC\n \n 2023-08-15 12:21:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1564\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4698)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 25 and _weight <= 34.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:37:59',4,'2023-08-15 14:21:55',4,0,NULL,NULL,NULL,'decbe846-1d21-400e-93c7-d535d80c75c2'),(1565,'Clients given 6A weighing 0-3.9kg','Clients given 6A weighing 0-3.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6A weighing 0-3.9kg\n Clients given 6A weighing 0-3.9kg\n \n 2022-06-30 11:38:28 UTC\n \n 2023-08-15 11:50:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1565\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6A \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight <=3.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:38:28',4,'2023-08-15 13:50:29',4,0,NULL,NULL,NULL,'9612971e-a174-4a5f-8fbd-59eec5a601b2'),(1566,'Clients given 5E weighing >=35kg','Clients given 5E weighing >=35kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5E weighing >=35kg\n Clients given 5E weighing >=35kg\n \n 2022-06-30 11:38:46 UTC\n \n 2023-08-15 12:08:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1566\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4698)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 35)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:38:46',4,'2023-08-15 14:08:51',4,0,NULL,NULL,NULL,'8e471ec5-2e65-4ade-9508-52eabac321a3'),(1567,'Clients given 6F weighing 0-3.9kg','Clients given 6F weighing 0-3.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F weighing 0-3.9kg\n Clients given 6F weighing 0-3.9kg\n \n 2022-06-30 11:41:42 UTC\n \n 2023-08-15 11:55:19 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1567\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4705)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight <=3.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:41:42',4,'2023-08-15 13:55:19',4,0,NULL,NULL,NULL,'21f2534a-381c-427b-85d0-2e8a156f55cc'),(1568,'Clients given 6A weighing 4-5.9kg','Clients given 6A weighing 4-5.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6A weighing 4-5.9kg\n Clients given 6A weighing 4-5.9kg\n \n 2022-06-30 11:42:04 UTC\n \n 2023-08-15 11:58:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1568\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6A \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=4 and _weight <=5.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:42:04',4,'2023-08-15 13:58:40',4,0,NULL,NULL,NULL,'349f5e74-fd1f-46ca-b279-089ec17daa3c'),(1569,'Clients given 6F weighing 4-5.9kg','Clients given 6F weighing 4-5.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F weighing 4-5.9kg\n Clients given 6F weighing 4-5.9kg\n \n 2022-06-30 11:42:52 UTC\n \n 2023-08-15 12:01:56 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1569\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4705)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=4 and _weight <=5.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:42:52',4,'2023-08-15 14:01:56',4,0,NULL,NULL,NULL,'6d6fd933-e915-4eb2-aa0a-5f9a3fc39c9e'),(1570,'Clients given 6A weighing 6-9.9kg','Clients given 6A weighing 6-9.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6A weighing 6-9.9kg\n Clients given 6A weighing 6-9.9kg\n \n 2022-06-30 11:42:56 UTC\n \n 2023-08-15 12:07:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1570\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6A \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=6 and _weight <=9.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:42:56',4,'2023-08-15 14:07:06',4,0,NULL,NULL,NULL,'d6cf3e57-fba8-4961-83e9-e0c69b152e91'),(1571,'Clients given 6F weighing 6-9.9kg','Clients given 6F weighing 6-9.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F weighing 6-9.9kg\n Clients given 6F weighing 6-9.9kg\n \n 2022-06-30 11:43:28 UTC\n \n 2023-08-15 12:11:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1571\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4705)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=6 and _weight <=9.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:43:28',4,'2023-08-15 14:11:18',4,0,NULL,NULL,NULL,'07ebdb1b-42fd-4338-9880-b53a0e857d14'),(1572,'Clients given 6A weighing 10-13.9kg','Clients given 6A weighing 10-13.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6A weighing 10-13.9kg\n Clients given 6A weighing 10-13.9kg\n \n 2022-06-30 11:43:45 UTC\n \n 2023-08-15 12:19:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1572\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6A \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=10 and _weight <=13.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:43:45',4,'2023-08-15 14:19:36',4,0,NULL,NULL,NULL,'de6af126-f558-4acf-b061-982dbfac0025'),(1573,'Clients given 6F weighing 10-13.9kg','Clients given 6F weighing 10-13.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F weighing 10-13.9kg\n Clients given 6F weighing 10-13.9kg\n \n 2022-06-30 11:44:06 UTC\n \n 2023-08-15 12:14:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1573\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4705)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=10 and _weight <=13.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:44:06',4,'2023-08-15 14:14:29',4,0,NULL,NULL,NULL,'e77aeb5b-70e2-46a1-9451-be37911a5dc0'),(1574,'Clients given 6A weighing 14-19.9kg','Clients given 6A weighing 14-19.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6A weighing 14-19.9kg\n Clients given 6A weighing 14-19.9kg\n \n 2022-06-30 11:44:40 UTC\n \n 2023-08-15 13:36:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1574\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6A \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=14 and _weight <=19.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:44:40',4,'2023-08-15 15:36:18',4,0,NULL,NULL,NULL,'6850d21e-415b-4941-aa12-ddcf45ebf1cf'),(1575,'Clients given 6F weighing 14-19.9kg','Clients given 6F weighing 14-19.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F weighing 14-19.9kg\n Clients given 6F weighing 14-19.9kg\n \n 2022-06-30 11:44:51 UTC\n \n 2023-08-15 13:39:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1575\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4705)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=14 and _weight <=19.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:44:51',4,'2023-08-15 15:39:53',4,0,NULL,NULL,NULL,'bffbdb83-5c53-4429-baca-46ef480cbbdd'),(1576,'Clients given 6A weighing 20-24.9kg','Clients given 6A weighing 20-24.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6A weighing 20-24.9kg\n Clients given 6A weighing 20-24.9kg\n \n 2022-06-30 11:45:34 UTC\n \n 2023-08-15 13:43:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1576\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6A \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=20 and _weight <=24.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:45:34',4,'2023-08-15 15:43:08',4,0,NULL,NULL,NULL,'00c9ee8c-dd26-4de8-8d76-65235331fc58'),(1577,'Clients given 6F weighing 20-24.9kg','Clients given 6F weighing 20-24.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F weighing 20-24.9kg\n Clients given 6F weighing 20-24.9kg\n \n 2022-06-30 11:45:40 UTC\n \n 2023-08-15 13:46:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1577\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4705)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=20 and _weight <=24.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:45:40',4,'2023-08-15 15:46:12',4,0,NULL,NULL,NULL,'1907619e-e315-4136-b63d-ebb12d9a8fc1'),(1578,'Clients given 6F weighing 25-34.9kg','Clients given 6F weighing 25-34.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F weighing 25-34.9kg\n Clients given 6F weighing 25-34.9kg\n \n 2022-06-30 11:46:30 UTC\n \n 2023-08-15 13:54:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1578\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4705)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=25 and _weight <=34.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:46:30',4,'2023-08-15 15:54:43',4,0,NULL,NULL,NULL,'67151923-545c-44f9-955c-705bd4b86bd8'),(1579,'Clients given 6A weighing 25-34.9kg','Clients given 6A weighing 25-34.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6A weighing 25-34.9kg\n Clients given 6A weighing 25-34.9kg\n \n 2022-06-30 11:46:33 UTC\n \n 2023-08-15 13:52:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1579\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6A \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=25 and _weight <=34.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:46:33',4,'2023-08-15 15:52:05',4,0,NULL,NULL,NULL,'c4410a3f-a272-4f5a-8b68-c293b482c8f2'),(1580,'Clients given 6F weighing >=35kg','Clients given 6F weighing >=35kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F weighing >=35kg\n Clients given 6F weighing >=35kg\n \n 2022-06-30 11:47:14 UTC\n \n 2023-08-15 14:01:34 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1580\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4705)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=35)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:47:14',4,'2023-08-15 16:01:34',4,0,NULL,NULL,NULL,'88e71ca5-8e27-438a-ad22-12007acc675a'),(1581,'Clients given 6A weighing >= 35kg','Clients given 6A weighing >= 35kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6A weighing >= 35kg\n Clients given 6A weighing >= 35kg\n \n 2022-06-30 11:47:26 UTC\n \n 2023-08-15 13:58:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1581\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6A \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=35)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:47:26',4,'2023-08-15 15:58:50',4,0,NULL,NULL,NULL,'120fc355-ea4b-4d74-9df3-713f396ad4d5'),(1582,'Clients given 6B weighing 0-3.9kg','Clients given 6B weighing 0-3.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6B weighing 0-3.9kg\n Clients given 6B weighing 0-3.9kg\n \n 2022-06-30 11:49:06 UTC\n \n 2023-08-15 11:51:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1582\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6B \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight <=3.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:49:06',4,'2023-08-15 13:51:04',4,0,NULL,NULL,NULL,'c94b83be-7708-46c9-803c-369d803ce612'),(1583,'Clients given 6E weighing 0-3.9kg','Clients given 6E weighing 0-3.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E weighing 0-3.9kg\n Clients given 6E weighing 0-3.9kg\n \n 2022-06-30 11:49:10 UTC\n \n 2023-08-15 11:55:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1583\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4704)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight <=3.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:49:10',4,'2023-08-15 13:55:28',4,0,NULL,NULL,NULL,'79f4464f-be3a-4f76-b911-1324264edb34'),(1584,'Clients given 6E weighing 4-5.9kg','Clients given 6E weighing 4-5.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E weighing 4-5.9kg\n Clients given 6E weighing 4-5.9kg\n \n 2022-06-30 11:50:19 UTC\n \n 2023-08-15 12:02:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1584\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4704)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=4 and _weight <=5.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:50:19',4,'2023-08-15 14:02:30',4,0,NULL,NULL,NULL,'c940a6d2-b183-4f3d-99c3-757c98c1d95d'),(1585,'Clients given 6B weighing 4-5.9kg','Clients given 6B weighing 4-5.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6B weighing 4-5.9kg\n Clients given 6B weighing 4-5.9kg\n \n 2022-06-30 11:50:41 UTC\n \n 2023-08-15 12:03:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1585\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6B \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=4 and _weight <=5.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:50:41',4,'2023-08-15 14:03:18',4,0,NULL,NULL,NULL,'b03e49d3-e03b-4a31-b0c9-dc33942ca80b'),(1586,'Clients given 6E weighing 6-9.9kg','Clients given 6E weighing 6-9.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E weighing 6-9.9kg\n Clients given 6E weighing 6-9.9kg\n \n 2022-06-30 11:51:01 UTC\n \n 2023-08-15 12:11:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1586\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4704)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=6 and _weight <=9.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:51:01',4,'2023-08-15 14:11:10',4,0,NULL,NULL,NULL,'b0f0ed35-fe90-4552-83a7-e10c1b509fdb'),(1587,'Clients given 6B weighing 6-9.9kg','Clients given 6B weighing 6-9.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6B weighing 6-9.9kg\n Clients given 6B weighing 6-9.9kg\n \n 2022-06-30 11:51:24 UTC\n \n 2023-08-15 12:07:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1587\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6B \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=6 and _weight <=9.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:51:24',4,'2023-08-15 14:07:40',4,0,NULL,NULL,NULL,'9b75e9b1-6086-4d10-aa5d-f574d58c2f9b'),(1588,'Clients given 6E weighing 10-13.9kg','Clients given 6E weighing 10-13.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E weighing 10-13.9kg\n Clients given 6E weighing 10-13.9kg\n \n 2022-06-30 11:51:37 UTC\n \n 2023-08-15 12:15:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1588\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4704)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=10 and _weight <=13.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:51:37',4,'2023-08-15 14:15:07',4,0,NULL,NULL,NULL,'4ab54017-730b-443b-b1a4-c7fb57c16069'),(1589,'Clients given 6B weighing 10-13.9kg','Clients given 6B weighing 10-13.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6B weighing 10-13.9kg\n Clients given 6B weighing 10-13.9kg\n \n 2022-06-30 11:52:19 UTC\n \n 2023-08-15 12:18:48 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1589\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6B \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=10 and _weight <=13.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:52:19',4,'2023-08-15 14:18:48',4,0,NULL,NULL,NULL,'439b52c1-c9d5-4366-9819-994f121bf0fa'),(1590,'Clients given 6E weighing 14-19.9kg','Clients given 6E weighing 14-19.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E weighing 14-19.9kg\n Clients given 6E weighing 14-19.9kg\n \n 2022-06-30 11:52:28 UTC\n \n 2023-08-15 13:39:35 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1590\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4704)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=14 and _weight <=19.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:52:28',4,'2023-08-15 15:39:35',4,0,NULL,NULL,NULL,'4a2873d6-97bb-42b9-8e4f-4786bf854462'),(1591,'Clients given 6E weighing 20-24.9kg','Clients given 6E weighing 20-24.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E weighing 20-24.9kg\n Clients given 6E weighing 20-24.9kg\n \n 2022-06-30 11:53:12 UTC\n \n 2023-08-15 13:45:54 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1591\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4704)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=20 and _weight <=24.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:53:12',4,'2023-08-15 15:45:54',4,0,NULL,NULL,NULL,'e129484c-9b6b-4ed5-a0b8-da691370e459'),(1592,'Clients given 6B weighing 14-19.9kg','Clients given 6B weighing 14-19.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6B weighing 14-19.9kg\n Clients given 6B weighing 14-19.9kg\n \n 2022-06-30 11:53:32 UTC\n \n 2023-08-15 13:38:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1592\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6B \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=14 and _weight <=19.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:53:32',4,'2023-08-15 15:38:03',4,0,NULL,NULL,NULL,'af7d5255-1e37-4def-b26d-dcded87c1ded'),(1593,'Clients given 6E weighing 25-34.9kg','Clients given 6E weighing 25-34.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E weighing 25-34.9kg\n Clients given 6E weighing 25-34.9kg\n \n 2022-06-30 11:54:08 UTC\n \n 2023-08-15 13:54:22 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1593\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4704)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=25 and _weight <=34.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:54:08',4,'2023-08-15 15:54:22',4,0,NULL,NULL,NULL,'5c8f4cdd-6c22-4df0-8d12-801a66ccff55'),(1594,'Clients given 6B weighing 20-24.9kg','Clients given 6B weighing 20-24.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6B weighing 20-24.9kg\n Clients given 6B weighing 20-24.9kg\n \n 2022-06-30 11:54:35 UTC\n \n 2023-08-15 13:43:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1594\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6B \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=20 and _weight <=24.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:54:35',4,'2023-08-15 15:43:29',4,0,NULL,NULL,NULL,'3d5ca230-bb1a-40ad-9a13-ae3d4a7868c1'),(1595,'Clients given 6E weighing >=35kg','Clients given 6E weighing >=35kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E weighing >=35kg\n Clients given 6E weighing >=35kg\n \n 2022-06-30 11:54:50 UTC\n \n 2023-08-15 14:01:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1595\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4704)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=35)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:54:50',4,'2023-08-15 16:01:10',4,0,NULL,NULL,NULL,'0ed30402-06d4-4a91-ab30-8aa4cb05f973'),(1596,'Clients given 6B weighing 25-34.9kg','Clients given 6B weighing 25-34.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6B weighing 25-34.9kg\n Clients given 6B weighing 25-34.9kg\n \n 2022-06-30 11:55:30 UTC\n \n 2023-08-15 13:52:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1596\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6B \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=25 and _weight <=34.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:55:30',4,'2023-08-15 15:52:19',4,0,NULL,NULL,NULL,'760b7d9e-5a7e-4a13-9517-59f18a299d60'),(1597,'Clients given 6B weighing >= 35kg','Clients given 6B weighing >= 35kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6B weighing >= 35kg\n Clients given 6B weighing >= 35kg\n \n 2022-06-30 11:56:44 UTC\n \n 2023-08-15 14:00:19 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1597\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6B \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=35)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:56:44',4,'2023-08-15 16:00:19',4,0,NULL,NULL,NULL,'89e94627-eb6a-4b05-8b5c-7c06482c67da'),(1598,'Clients given 6D weighing 0-3.9kg','Clients given 6D weighing 0-3.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D weighing 0-3.9kg\n Clients given 6D weighing 0-3.9kg\n \n 2022-06-30 11:57:07 UTC\n \n 2023-08-15 11:55:38 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1598\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6D \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4703)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight <=3.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:57:07',4,'2023-08-15 13:55:38',4,0,NULL,NULL,NULL,'c5ecfc78-4201-495c-9c7d-042b046d6c3d'),(1599,'Clients given 6D weighing 4-5.9kg','Clients given 6D weighing 4-5.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D weighing 4-5.9kg\n Clients given 6D weighing 4-5.9kg\n \n 2022-06-30 11:57:58 UTC\n \n 2023-08-15 12:02:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1599\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6D \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4703)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=4 and _weight <=5.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:57:58',4,'2023-08-15 14:02:40',4,0,NULL,NULL,NULL,'25950d8e-2a7a-484f-8674-e94ba2fc9071'),(1600,'Clients given 6C weighing 0-3.9kg','Clients given 6C weighing 0-3.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C weighing 0-3.9kg\n Clients given 6C weighing 0-3.9kg\n \n 2022-06-30 11:58:17 UTC\n \n 2023-08-15 11:52:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1600\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4702)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight <=3.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:58:17',4,'2023-08-15 13:52:01',4,0,NULL,NULL,NULL,'6eff51d3-2d07-44db-a617-ff288d027867'),(1601,'Clients given 6D weighing 6-9.9kg','Clients given 6D weighing 6-9.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D weighing 6-9.9kg\n Clients given 6D weighing 6-9.9kg\n \n 2022-06-30 11:58:42 UTC\n \n 2023-08-15 12:10:38 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1601\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6D \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4703)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=6 and _weight <=9.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:58:42',4,'2023-08-15 14:10:38',4,0,NULL,NULL,NULL,'0b2e111f-f266-4a34-ba0b-4080607ca595'),(1602,'Clients given 6D weighing 10-13.9kg','Clients given 6D weighing 10-13.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D weighing 10-13.9kg\n Clients given 6D weighing 10-13.9kg\n \n 2022-06-30 11:59:37 UTC\n \n 2023-08-15 12:15:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1602\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6D \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4703)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=10 and _weight <=13.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 13:59:37',4,'2023-08-15 14:15:29',4,0,NULL,NULL,NULL,'d13d961e-4f19-4d97-88f5-f0795b285859'),(1603,'Clients given 6D weighing 14-19.9kg','Clients given 6D weighing 14-19.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D weighing 14-19.9kg\n Clients given 6D weighing 14-19.9kg\n \n 2022-06-30 12:00:32 UTC\n \n 2023-08-15 13:39:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1603\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6D \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4703)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=14 and _weight <=19.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 14:00:32',4,'2023-08-15 15:39:12',4,0,NULL,NULL,NULL,'ba0967aa-34e7-4df6-a75b-cbe7c8b52cea'),(1604,'Clients given 6C weighing 4-5.9kg','Clients given 6C weighing 4-5.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C weighing 4-5.9kg\n Clients given 6C weighing 4-5.9kg\n \n 2022-06-30 12:00:54 UTC\n \n 2023-08-15 12:02:57 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1604\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4702)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=4 and _weight <=5.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 14:00:54',4,'2023-08-15 14:02:57',4,0,NULL,NULL,NULL,'9538730a-29f7-45cc-a6e5-4b20a1b80f2f'),(1605,'Clients given 6D weighing 20-24.9kg','Clients given 6D weighing 20-24.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D weighing 20-24.9kg\n Clients given 6D weighing 20-24.9kg\n \n 2022-06-30 12:01:12 UTC\n \n 2023-08-15 13:45:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1605\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6D \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4703)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=20 and _weight <=24.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 14:01:12',4,'2023-08-15 15:45:42',4,0,NULL,NULL,NULL,'87b14d09-b20e-47d1-b20e-c38bc338df15'),(1606,'Clients given 6D weighing 25-34.9kg','Clients given 6D weighing 25-34.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D weighing 25-34.9kg\n Clients given 6D weighing 25-34.9kg\n \n 2022-06-30 12:01:59 UTC\n \n 2023-08-15 13:54:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1606\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6D \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4703)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=25 and _weight <=34.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 14:01:59',4,'2023-08-15 15:54:05',4,0,NULL,NULL,NULL,'9b8508f6-6c59-4408-90d1-4366ad9f3df7'),(1607,'Clients given 6C weighing 6-9.9kg','Clients given 6C weighing 6-9.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C weighing 6-9.9kg\n Clients given 6C weighing 6-9.9kg\n \n 2022-06-30 12:02:20 UTC\n \n 2023-08-15 12:08:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1607\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4702)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=6 and _weight <=9.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 14:02:20',4,'2023-08-15 14:08:10',4,0,NULL,NULL,NULL,'021aecf8-4314-4feb-921d-dbab609bce88'),(1608,'Clients given 6D weighing >=35kg','Clients given 6D weighing >=35kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D weighing >=35kg\n Clients given 6D weighing >=35kg\n \n 2022-06-30 12:02:42 UTC\n \n 2023-08-15 14:00:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1608\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6D \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4703)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=35)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 14:02:42',4,'2023-08-15 16:00:51',4,0,NULL,NULL,NULL,'6b8cf9ee-1659-46da-8aab-1580ccd82fe7'),(1609,'Clients given 6C weighing 10-13.9kg','Clients given 6C weighing 10-13.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C weighing 10-13.9kg\n Clients given 6C weighing 10-13.9kg\n \n 2022-06-30 12:03:07 UTC\n \n 2023-08-15 12:15:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1609\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4702)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=10 and _weight <=13.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 14:03:07',4,'2023-08-15 14:15:45',4,0,NULL,NULL,NULL,'e43ddc56-97c9-4c2b-9dd1-4439ab2d154e'),(1610,'Clients given 6C weighing 14-19.9kg','Clients given 6C weighing 14-19.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C weighing 14-19.9kg\n Clients given 6C weighing 14-19.9kg\n \n 2022-06-30 12:03:52 UTC\n \n 2023-08-15 13:38:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1610\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4702)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=14 and _weight <=19.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 14:03:52',4,'2023-08-15 15:38:51',4,0,NULL,NULL,NULL,'7cc34bd7-01dc-4e10-97b4-3aabce82e0d2'),(1611,'Clients given 6C weighing 20-24.9kg','Clients given 6C weighing 20-24.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C weighing 20-24.9kg\n Clients given 6C weighing 20-24.9kg\n \n 2022-06-30 12:05:08 UTC\n \n 2023-08-15 13:45:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1611\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4702)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=20 and _weight <=24.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 14:05:08',4,'2023-08-15 15:45:29',4,0,NULL,NULL,NULL,'eb9fff17-d2d9-4c0a-a4ff-919fe86f2cfe'),(1612,'Clients given 6C weighing 25-34.9kg','Clients given 6C weighing 25-34.9kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C weighing 25-34.9kg\n Clients given 6C weighing 25-34.9kg\n \n 2022-06-30 12:06:35 UTC\n \n 2023-08-15 13:52:38 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1612\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4702)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=25 and _weight <=34.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 14:06:35',4,'2023-08-15 15:52:38',4,0,NULL,NULL,NULL,'95004055-2dd1-4b3c-9536-877974c6fc23'),(1613,'Clients given 6C weighing >= 35kg','Clients given 6C weighing >= 35kg','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C weighing >= 35kg\n Clients given 6C weighing >= 35kg\n \n 2022-06-30 12:07:48 UTC\n \n 2023-08-15 14:00:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1613\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4702)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight>=35)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2022-06-30 14:07:48',4,'2023-08-15 16:00:36',4,0,NULL,NULL,NULL,'a5659098-23a4-41c0-8bbd-12dd4c9bca64'),(1614,'Clients given 4C weighing 0-3.9kg','Clients given 4C weighing 0-3.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.SqlIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C weighing 0-3.9kg\n Clients given 4C weighing 0-3.9kg\n \n 2022-06-30 12:15:27 UTC\n \n','2022-06-30 14:15:27',4,NULL,NULL,0,NULL,NULL,NULL,'46894193-4656-4941-9050-4498338da679'),(1615,'Clients given 4C weighing 0-3.9kg','Clients given 4C weighing 0-3.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C weighing 0-3.9kg\n Clients given 4C weighing 0-3.9kg\n \n 2022-06-30 12:16:38 UTC\n \n 2022-06-30 12:20:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1615\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 14:16:38',4,'2022-06-30 14:20:27',4,0,NULL,NULL,NULL,'4a2b667a-930c-4d98-9073-18aa9e6104ec'),(1616,'Clients given 4C weighing 4-5.9kg','Clients given 4C weighing 4-5.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C weighing 4-5.9kg\n Clients given 4C weighing 4-5.9kg\n \n 2022-06-30 12:21:22 UTC\n \n 2022-06-30 12:23:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1616\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 14:21:22',4,'2022-06-30 14:23:05',4,0,NULL,NULL,NULL,'aa294dde-6440-4b72-ab4a-d5b782cec371'),(1617,'Clients given 4C weighing 6-9.9kg','Clients given 4C weighing 6-9.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C weighing 6-9.9kg\n Clients given 4C weighing 6-9.9kg\n \n 2022-06-30 12:23:45 UTC\n \n 2022-06-30 12:24:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1617\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 14:23:45',4,'2022-06-30 14:24:45',4,0,NULL,NULL,NULL,'5a98d199-a896-47ec-830e-56cd2fef0351'),(1618,'Clients given 4C weighing 10-13.9kg','Clients given 4C weighing 10-13.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C weighing 10-13.9kg\n Clients given 4C weighing 10-13.9kg\n \n 2022-06-30 12:25:23 UTC\n \n 2022-06-30 12:26:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1618\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 14:25:23',4,'2022-06-30 14:26:36',4,0,NULL,NULL,NULL,'bc8cd79c-b1fd-4956-8f87-596d56a8b0b9'),(1619,'Clients given 4C weighing 14-19.9kg','Clients given 4C weighing 14-19.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C weighing 14-19.9kg\n Clients given 4C weighing 14-19.9kg\n \n 2022-06-30 12:27:19 UTC\n \n 2022-06-30 12:28:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1619\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 14:27:19',4,'2022-06-30 14:28:17',4,0,NULL,NULL,NULL,'220abe15-cbb2-464a-bb57-fb1e75ad56c6'),(1620,'Clients given 4C weighing 20-24.9kg','Clients given 4C weighing 20-24.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C weighing 20-24.9kg\n Clients given 4C weighing 20-24.9kg\n \n 2022-06-30 12:28:52 UTC\n \n 2022-06-30 12:29:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1620\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 14:28:52',4,'2022-06-30 14:29:51',4,0,NULL,NULL,NULL,'0e4c3cca-5e54-4f77-a359-6c5a47141593'),(1621,'Clients given 4C weighing 25-34.9kg','Clients given 4C weighing 25-34.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C weighing 25-34.9kg\n Clients given 4C weighing 25-34.9kg\n \n 2022-06-30 12:30:29 UTC\n \n 2022-06-30 12:31:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1621\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 14:30:29',4,'2022-06-30 14:31:26',4,0,NULL,NULL,NULL,'d1810771-902c-44c5-b1a9-988f037cf87d'),(1622,'Clients given 4C weighing >= 35kg','Clients given 4C weighing >= 35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C weighing >= 35kg\n Clients given 4C weighing >= 35kg\n \n 2022-06-30 12:32:03 UTC\n \n 2022-06-30 12:33:13 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1622\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 14:32:03',4,'2022-06-30 14:33:13',4,0,NULL,NULL,NULL,'1d840c5f-240c-4159-8a72-6b0db642b53f'),(1623,'Clients given 4D weighing 0-3.9kg','Clients given 4D weighing 0-3.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D weighing 0-3.9kg\n Clients given 4D weighing 0-3.9kg\n \n 2022-06-30 12:33:59 UTC\n \n 2022-06-30 12:36:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1623\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 14:33:59',4,'2022-06-30 14:36:06',4,0,NULL,NULL,NULL,'0746d03a-e518-473c-809e-f764e275f42a'),(1624,'Clients given 4D weighing 4-5.9kg','Clients given 4D weighing 4-5.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D weighing 4-5.9kg\n Clients given 4D weighing 4-5.9kg\n \n 2022-06-30 12:36:44 UTC\n \n 2022-06-30 12:38:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1624\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 14:36:44',4,'2022-06-30 14:38:51',4,0,NULL,NULL,NULL,'fdaff2b0-2a93-4eed-8a21-37b4493a93d8'),(1625,'Clients given 4D weighing 6-9.9kg','Clients given 4D weighing 6-9.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D weighing 6-9.9kg\n Clients given 4D weighing 6-9.9kg\n \n 2022-06-30 12:37:11 UTC\n \n 2022-06-30 12:39:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1625\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 14:37:11',4,'2022-06-30 14:39:41',4,0,NULL,NULL,NULL,'f7342534-15b0-4b7f-abf7-4689c7510e5d'),(1626,'Clients given 4D weighing 10-13.9kg','Clients given 4D weighing 10-13.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D weighing 10-13.9kg\n Clients given 4D weighing 10-13.9kg\n \n 2022-06-30 12:40:08 UTC\n \n 2022-06-30 12:40:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1626\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 14:40:08',4,'2022-06-30 14:40:58',4,0,NULL,NULL,NULL,'f70b046a-7684-4087-85ac-b8e890c99a7d'),(1627,'Clients given 4D weighing 14-19.9kg','Clients given 4D weighing 14-19.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D weighing 14-19.9kg\n Clients given 4D weighing 14-19.9kg\n \n 2022-06-30 12:41:22 UTC\n \n 2022-06-30 12:46:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1627\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 14:41:22',4,'2022-06-30 14:46:15',4,0,NULL,NULL,NULL,'a78b89dd-1172-4ae3-9db1-252697c46714'),(1628,'Children ARV Regimen_1stLine_2022','Children ARV Regimen_1stLine','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_2022\n Children ARV Regimen_1stLine\n \n 2022-06-30 12:44:42 UTC\n \n 2022-06-30 12:44:52 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1628\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2022-06-30 14:44:42',4,'2022-06-30 14:44:52',4,0,NULL,NULL,NULL,'6d96f107-4e14-48ff-b6d7-c845d87e37e1'),(1629,'Children ARV Regimen_1stLine_2022 Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_2022 Data Set\n \n 2022-06-30 12:44:52 UTC\n \n 2022-06-30 19:13:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1629\n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n 4C0to3.9\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Age\n Children 0to14\n \n \n \n \n \n 4C10to13.9\n \n \n \n \n \n \n \n \n \n 4C14to19.9\n \n \n \n \n \n \n \n \n \n 4C20to24.9\n \n \n \n \n \n \n \n \n \n 4C25to34.9\n \n \n \n \n \n \n \n \n \n 4C35plus\n \n \n \n \n \n \n \n \n \n 4C4to5.9\n \n \n \n \n \n \n \n \n \n 4C6to9.9\n \n \n \n \n \n \n \n \n \n 4D0to3.9\n \n \n \n \n \n \n \n \n \n 4D10to13.9\n \n \n \n \n \n \n \n \n \n 4D14to19.9\n \n \n \n \n \n \n \n \n \n 4D20to24.9\n \n \n \n \n \n \n \n \n \n 4D25to34.9\n \n \n \n \n \n \n \n \n \n 4D35plus\n \n \n \n \n \n \n \n \n \n 4D4to5.9\n \n \n \n \n \n \n \n \n \n 4D6to9.9\n \n \n \n \n \n \n \n \n \n 4E0to3.9\n \n \n \n \n \n \n \n \n \n 4E10to13.9\n \n \n \n \n \n \n \n \n \n 4E14to19.9\n \n \n \n \n \n \n \n \n \n 4E20to24.9\n \n \n \n \n \n \n \n \n \n 4E25to34.9\n \n \n \n \n \n \n \n \n \n 4E35plus\n \n \n \n \n \n \n \n \n \n 4E4to5.9\n \n \n \n \n \n \n \n \n \n 4E6to9.9\n \n \n \n \n \n \n \n \n \n 4F0to3.9\n \n \n \n \n \n \n \n \n \n 4F10to13.9\n \n \n \n \n \n \n \n \n \n 4F14to19.9\n \n \n \n \n \n \n \n \n \n 4F20to24.9\n \n \n \n \n \n \n \n \n \n 4F25to34.9\n \n \n \n \n \n \n \n \n \n 4F35plus\n \n \n \n \n \n \n \n \n \n 4F4to5.9\n \n \n \n \n \n \n \n \n \n 4F6to9.9\n \n \n \n \n \n \n \n \n \n 4G0to3.9\n \n \n \n \n \n \n \n \n \n 4G10to13.9\n \n \n \n \n \n \n \n \n \n 4G14to19.9\n \n \n \n \n \n \n \n \n \n 4G20to24.9\n \n \n \n \n \n \n \n \n \n 4G25to34.9\n \n \n \n \n \n \n \n \n \n 4G35plus\n \n \n \n \n \n \n \n \n \n 4G4to5.9\n \n \n \n \n \n \n \n \n \n 4G6to9.9\n \n \n \n \n \n \n \n \n \n 4H0to3.9\n \n \n \n \n \n \n \n \n \n 4H10to13.9\n \n \n \n \n \n \n \n \n \n 4H14to19.9\n \n \n \n \n \n \n \n \n \n 4H20to24.9\n \n \n \n \n \n \n \n \n \n 4H25to34.9\n \n \n \n \n \n \n \n \n \n 4H35plus\n \n \n \n \n \n \n \n \n \n 4H4to5.9\n \n \n \n \n \n \n \n \n \n 4H6to9.9\n \n \n \n \n \n \n \n \n \n 4J0to3.9\n \n \n \n \n \n \n \n \n \n 4J10to13.9\n \n \n \n \n \n \n \n \n \n 4J14to19.9\n \n \n \n \n \n \n \n \n \n 4J20to24.9\n \n \n \n \n \n \n \n \n \n 4J25to34.9\n \n \n \n \n \n \n \n \n \n 4J35plus\n \n \n \n \n \n \n \n \n \n 4J4to5.9\n \n \n \n \n \n \n \n \n \n 4J6to9.9\n \n \n \n \n \n \n \n \n \n 4K0to3.9\n \n \n \n \n \n \n \n \n \n 4K10to13.9\n \n \n \n \n \n \n \n \n \n 4K14to19.9\n \n \n \n \n \n \n \n \n \n 4K20to24.9\n \n \n \n \n \n \n \n \n \n 4K25to34.9\n \n \n \n \n \n \n \n \n \n 4K35plus\n \n \n \n \n \n \n \n \n \n 4K4to5.9\n \n \n \n \n \n \n \n \n \n 4K6to9.9\n \n \n \n \n \n \n \n \n \n 4L0to3.9\n \n \n \n \n \n \n \n \n \n 4L10to13.9\n \n \n \n \n \n \n \n \n \n 4L14to19.9\n \n \n \n \n \n \n \n \n \n 4L20to24.9\n \n \n \n \n \n \n \n \n \n 4L25to34.9\n \n \n \n \n \n \n \n \n \n 4L35plus\n \n \n \n \n \n \n \n \n \n 4L4to5.9\n \n \n \n \n \n \n \n \n \n 4L6to9.9\n \n \n \n \n \n \n \n \n \n','2022-06-30 12:44:52',4,'2022-06-30 19:13:55',4,0,NULL,NULL,NULL,'72dc6096-f429-4c40-93bf-fbf45c22d970'),(1630,'Clients given 4D weighing 20-24.9kg','Clients given 4D weighing 20-24.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D weighing 20-24.9kg\n Clients given 4D weighing 20-24.9kg\n \n 2022-06-30 12:46:40 UTC\n \n 2022-06-30 12:47:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1630\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 14:46:40',4,'2022-06-30 14:47:39',4,0,NULL,NULL,NULL,'6c0b4f36-cc2c-4d85-a2ad-c5b5bf36b66b'),(1631,'Clients given 4D weighing 25-34.9kg','Clients given 4D weighing 25-34.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D weighing 25-34.9kg\n Clients given 4D weighing 25-34.9kg\n \n 2022-06-30 12:48:05 UTC\n \n 2022-06-30 12:49:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1631\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 14:48:05',4,'2022-06-30 14:49:27',4,0,NULL,NULL,NULL,'1c5157a7-08d8-4eb5-99df-f2ca1825baaa'),(1632,'Clients given 4D weighing >= 35kg','Clients given 4D weighing >= 35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D weighing >= 35kg\n Clients given 4D weighing >= 35kg\n \n 2022-06-30 12:48:59 UTC\n \n 2022-06-30 12:50:46 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1632\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 14:48:59',4,'2022-06-30 14:50:46',4,0,NULL,NULL,NULL,'5cbfb29b-e0b1-42b0-b7f5-a1b561ae3bb5'),(1633,'Clients given 4E weighing 0-3.9kg','Clients given 4E weighing 0-3.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E weighing 0-3.9kg\n Clients given 4E weighing 0-3.9kg\n \n 2022-06-30 12:50:28 UTC\n \n 2022-06-30 12:54:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1633\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 14:50:28',4,'2022-06-30 14:54:40',4,0,NULL,NULL,NULL,'36f7fe8c-f369-4152-a361-bc941ca32f35'),(1634,'Clients given 4E weighing 4-5.9kg','Clients given 4E weighing 4-5.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E weighing 4-5.9kg\n Clients given 4E weighing 4-5.9kg\n \n 2022-06-30 12:54:09 UTC\n \n 2022-06-30 12:55:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1634\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 14:54:09',4,'2022-06-30 14:55:44',4,0,NULL,NULL,NULL,'d6c46caf-e87c-4654-963f-91039f99e100'),(1635,'Clients given 4E weighing 6-9.9kg','Clients given 4E weighing 6-9.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E weighing 6-9.9kg\n Clients given 4E weighing 6-9.9kg\n \n 2022-06-30 12:57:00 UTC\n \n 2022-06-30 13:15:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1635\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 14:57:00',4,'2022-06-30 15:15:29',4,0,NULL,NULL,NULL,'2c954752-aaeb-427b-8cef-714be116f8d5'),(1636,'Clients given 4E weighing 10-13.9kg','Clients given 4E weighing 10-13.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E weighing 10-13.9kg\n Clients given 4E weighing 10-13.9kg\n \n 2022-06-30 13:16:23 UTC\n \n 2022-06-30 13:20:47 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1636\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:16:23',4,'2022-06-30 15:20:47',4,0,NULL,NULL,NULL,'92eb0675-5667-4202-ae12-91e31e89bc0a'),(1637,'Clients given 4K weighing 0-3.9kg','Clients given 4K weighing 0-3.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K weighing 0-3.9kg\n Clients given 4K weighing 0-3.9kg\n \n 2022-06-30 13:21:01 UTC\n \n 2022-06-30 13:22:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1637\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:21:01',4,'2022-06-30 15:22:04',4,0,NULL,NULL,NULL,'5166d416-8394-41a8-a7bf-cddf0f4573f9'),(1638,'Clients given 4E weighing 14-19.9kg','Clients given 4E weighing 14-19.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E weighing 14-19.9kg\n Clients given 4E weighing 14-19.9kg\n \n 2022-06-30 13:21:21 UTC\n \n 2022-06-30 13:23:24 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1638\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:21:21',4,'2022-06-30 15:23:24',4,0,NULL,NULL,NULL,'7c801f27-0d0e-4f8e-8d16-c9abbbc1d70f'),(1639,'Clients given 4K weighing 4-5.9kg','Clients given 4K weighing 4-5.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K weighing 4-5.9kg\n Clients given 4K weighing 4-5.9kg\n \n 2022-06-30 13:22:30 UTC\n \n 2022-06-30 13:23:19 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1639\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:22:30',4,'2022-06-30 15:23:19',4,0,NULL,NULL,NULL,'c3840473-881e-4c28-8b70-08ee65d51205'),(1640,'Clients given 4E weighing 20-24.9kg','Clients given 4E weighing 20-24.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E weighing 20-24.9kg\n Clients given 4E weighing 20-24.9kg\n \n 2022-06-30 13:22:54 UTC\n \n 2022-06-30 13:24:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1640\n COUNT\n \n \n \n \n endDate\n ${startDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:22:54',4,'2022-06-30 15:24:23',4,0,NULL,NULL,NULL,'7171def2-3caa-415e-8d0c-ae70c50ee52a'),(1641,'Clients given 4K weighing 6-9.9kg','Clients given 4K weighing 6-9.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K weighing 6-9.9kg\n Clients given 4K weighing 6-9.9kg\n \n 2022-06-30 13:23:54 UTC\n \n 2022-06-30 13:24:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1641\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:23:54',4,'2022-06-30 15:24:45',4,0,NULL,NULL,NULL,'2dc1198d-9268-4a29-b96d-7ac8921d3551'),(1642,'Clients given 4E weighing 25-34.9kg','Clients given 4E weighing 25-34.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E weighing 25-34.9kg\n Clients given 4E weighing 25-34.9kg\n \n 2022-06-30 13:24:00 UTC\n \n 2022-06-30 13:25:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1642\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:24:00',4,'2022-06-30 15:25:27',4,0,NULL,NULL,NULL,'40ac2a8b-12d5-4b3d-bea2-b63e3d969db9'),(1643,'Clients given 4E weighing >= 35kg','Clients given 4E weighing >= 35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E weighing >= 35kg\n Clients given 4E weighing >= 35kg\n \n 2022-06-30 13:25:02 UTC\n \n 2022-06-30 13:26:56 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1643\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:25:02',4,'2022-06-30 15:26:56',4,0,NULL,NULL,NULL,'9f104324-88d3-4be9-8a9e-2535e4368371'),(1644,'Clients given 4K weighing 10-13.9kg','Clients given 4K weighing 10-13.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K weighing 10-13.9kg\n Clients given 4K weighing 10-13.9kg\n \n 2022-06-30 13:25:05 UTC\n \n 2022-06-30 13:26:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1644\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:25:05',4,'2022-06-30 15:26:01',4,0,NULL,NULL,NULL,'38fbaae4-791a-4bba-85ea-d149625c3d79'),(1645,'Clients given 4K weighing 14-19.9kg','Clients given 4K weighing 14-19.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K weighing 14-19.9kg\n Clients given 4K weighing 14-19.9kg\n \n 2022-06-30 13:26:26 UTC\n \n 2022-06-30 13:27:37 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1645\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:26:26',4,'2022-06-30 15:27:37',4,0,NULL,NULL,NULL,'c0be7036-edcf-4337-97d7-2bb22bc6ef54'),(1646,'Clients given 4F weighing 0-3.9kg','Clients given 4F weighing 0-3.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F weighing 0-3.9kg\n Clients given 4F weighing 0-3.9kg\n \n 2022-06-30 13:26:29 UTC\n \n 2022-06-30 13:28:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1646\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:26:29',4,'2022-06-30 15:28:31',4,0,NULL,NULL,NULL,'3df707cf-c633-4a85-ab9a-affe8619ca0e'),(1647,'Clients given 4K weighing 20-24.9kg','Clients given 4K weighing 20-24.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K weighing 20-24.9kg\n Clients given 4K weighing 20-24.9kg\n \n 2022-06-30 13:26:52 UTC\n \n 2022-06-30 13:27:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1647\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:26:52',4,'2022-06-30 15:27:51',4,0,NULL,NULL,NULL,'f1be8c70-bd5f-4b25-8703-ebc91a56a354'),(1648,'Clients given 4F weighing 4-5.9kg','Clients given 4F weighing 4-5.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F weighing 4-5.9kg\n Clients given 4F weighing 4-5.9kg\n \n 2022-06-30 13:27:32 UTC\n \n 2022-06-30 13:28:56 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1648\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:27:32',4,'2022-06-30 15:28:56',4,0,NULL,NULL,NULL,'651b9843-2f38-4e58-a87b-8d01b1e1b736'),(1649,'Clients given 4K weighing 25-34.9kg','Clients given 4K weighing 25-34.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K weighing 25-34.9kg\n Clients given 4K weighing 25-34.9kg\n \n 2022-06-30 13:28:20 UTC\n \n 2022-06-30 13:29:38 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1649\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:28:20',4,'2022-06-30 15:29:38',4,0,NULL,NULL,NULL,'4a021424-b101-4001-8078-cd6e93935845'),(1650,'Clients given 4K weighing >=35kg','Clients given 4K weighing >=35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K weighing >=35kg\n Clients given 4K weighing >=35kg\n \n 2022-06-30 13:28:45 UTC\n \n 2022-06-30 13:29:54 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1650\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:28:45',4,'2022-06-30 15:29:54',4,0,NULL,NULL,NULL,'86cffb6f-3533-48b5-a568-425a6d32e7e6'),(1651,'Clients given 4F weighing 6-9.9kg','Clients given 4F weighing 6-9.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F weighing 6-9.9kg\n Clients given 4F weighing 6-9.9kg\n \n 2022-06-30 13:29:29 UTC\n \n 2022-06-30 13:33:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1651\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:29:29',4,'2022-06-30 15:33:15',4,0,NULL,NULL,NULL,'0d1c19ab-8761-43c9-b362-a733800ce420'),(1652,'Clients given 4F weighing 10-13.9kg','Clients given 4F weighing 10-13.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F weighing 10-13.9kg\n Clients given 4F weighing 10-13.9kg\n \n 2022-06-30 13:29:53 UTC\n \n 2022-06-30 13:31:09 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1652\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:29:53',4,'2022-06-30 15:31:09',4,0,NULL,NULL,NULL,'0be49339-dac1-4872-9c6c-50fee86542d0'),(1653,'Clients given 4F weighing 14-19.9kg','Clients given 4F weighing 14-19.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F weighing 14-19.9kg\n Clients given 4F weighing 14-19.9kg\n \n 2022-06-30 13:32:50 UTC\n \n 2022-06-30 13:34:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1653\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:32:50',4,'2022-06-30 15:34:42',4,0,NULL,NULL,NULL,'10f82a49-a80e-4feb-8a54-5011945608bc'),(1654,'Clients given 4F weighing 20-24.9kg','Clients given 4F weighing 20-24.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F weighing 20-24.9kg\n Clients given 4F weighing 20-24.9kg\n \n 2022-06-30 13:33:57 UTC\n \n 2022-06-30 13:35:34 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1654\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:33:57',4,'2022-06-30 15:35:34',4,0,NULL,NULL,NULL,'1b492993-7168-4cee-aeae-ed3cb3136ef4'),(1655,'Clients given 4F weighing 25-34.9kg','Clients given 4F weighing 25-34.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F weighing 25-34.9kg\n Clients given 4F weighing 25-34.9kg\n \n 2022-06-30 13:35:56 UTC\n \n 2022-06-30 13:37:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1655\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:35:56',4,'2022-06-30 15:37:26',4,0,NULL,NULL,NULL,'fd363f21-64f5-4465-8f1c-94a10ec790bc'),(1656,'Clients given 4F weighing >= 35kg','Clients given 4F weighing >= 35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F weighing >= 35kg\n Clients given 4F weighing >= 35kg\n \n 2022-06-30 13:36:27 UTC\n \n 2022-06-30 13:37:46 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1656\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:36:27',4,'2022-06-30 15:37:46',4,0,NULL,NULL,NULL,'2ca64d93-82d9-40b9-ae24-669a1d529641'),(1657,'Clients given 4G weighing 0-3.9kg','Clients given 4G weighing 0-3.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G weighing 0-3.9kg\n Clients given 4G weighing 0-3.9kg\n \n 2022-06-30 13:38:33 UTC\n \n 2022-06-30 13:39:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1657\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:38:33',4,'2022-06-30 15:39:42',4,0,NULL,NULL,NULL,'e2b136d9-95a4-49fa-8069-476f5b7e1bc2'),(1658,'Clients given 4G weighing 4-5.9kg','Clients given 4G weighing 4-5.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G weighing 4-5.9kg\n Clients given 4G weighing 4-5.9kg\n \n 2022-06-30 13:38:58 UTC\n \n 2022-06-30 13:40:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1658\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:38:58',4,'2022-06-30 15:40:05',4,0,NULL,NULL,NULL,'dc8af817-8512-4a0a-b692-331377842479'),(1659,'Clients given 4G weighing 6-9.9kg','Clients given 4G weighing 6-9.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G weighing 6-9.9kg\n Clients given 4G weighing 6-9.9kg\n \n 2022-06-30 13:40:27 UTC\n \n 2022-06-30 13:41:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1659\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:40:27',4,'2022-06-30 15:41:40',4,0,NULL,NULL,NULL,'97f6acaa-3818-4efc-b6e0-8d8ecd3255b5'),(1660,'Clients given 4G weighing 10-13.9kg','Clients given 4G weighing 10-13.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G weighing 10-13.9kg\n Clients given 4G weighing 10-13.9kg\n \n 2022-06-30 13:40:47 UTC\n \n 2022-06-30 13:43:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1660\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:40:47',4,'2022-06-30 15:43:02',4,0,NULL,NULL,NULL,'ebcfa3fc-dea8-4a53-99f7-a16dc23a026c'),(1661,'Clients given 4G weighing 14-19.9kg','Clients given 4G weighing 14-19.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G weighing 14-19.9kg\n Clients given 4G weighing 14-19.9kg\n \n 2022-06-30 13:42:19 UTC\n \n 2022-06-30 13:43:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1661\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:42:19',4,'2022-06-30 15:43:59',4,0,NULL,NULL,NULL,'793e78bb-284c-47fa-8967-3fa124d3e9c7'),(1662,'Clients given 4G weighing 20-24.9kg','Clients given 4G weighing 20-24.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G weighing 20-24.9kg\n Clients given 4G weighing 20-24.9kg\n \n 2022-06-30 13:43:37 UTC\n \n 2022-06-30 13:44:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1662\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:43:37',4,'2022-06-30 15:44:44',4,0,NULL,NULL,NULL,'2bffd86c-c304-4fe5-bea0-dcba1ddacd30'),(1663,'Clients given 4G weighing 25-34.9kg','Clients given 4G weighing 25-34.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G weighing 25-34.9kg\n Clients given 4G weighing 25-34.9kg\n \n 2022-06-30 13:44:57 UTC\n \n 2022-06-30 13:48:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1663\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:44:57',4,'2022-06-30 15:48:30',4,0,NULL,NULL,NULL,'dff299fd-70e4-42b6-821b-24bbfca5d130'),(1664,'Clients given 4G weighing >= 35kg','Clients given 4G weighing >= 35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G weighing >= 35kg\n Clients given 4G weighing >= 35kg\n \n 2022-06-30 13:45:24 UTC\n \n 2022-06-30 13:47:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1664\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:45:24',4,'2022-06-30 15:47:50',4,0,NULL,NULL,NULL,'250554d7-b11e-4572-9fe8-191077c91497'),(1665,'Clients given 4H weighing 0-3.9kg','Clients given 4H weighing 0-3.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H weighing 0-3.9kg\n Clients given 4H weighing 0-3.9kg\n \n 2022-06-30 13:49:48 UTC\n \n 2022-06-30 13:51:33 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1665\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:49:48',4,'2022-06-30 15:51:33',4,0,NULL,NULL,NULL,'0681f349-aa2a-4030-8932-08fe50d977b7'),(1666,'Clients given 4H weighing 4-5.9kg','Clients given 4H weighing 4-5.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H weighing 4-5.9kg\n Clients given 4H weighing 4-5.9kg\n \n 2022-06-30 13:50:26 UTC\n \n 2022-06-30 13:52:13 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1666\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:50:26',4,'2022-06-30 15:52:13',4,0,NULL,NULL,NULL,'7d0948bd-e302-428d-be3e-c15ad93d5002'),(1667,'Clients given 4H weighing 6-9.9kg','Clients given 4H weighing 6-9.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H weighing 6-9.9kg\n Clients given 4H weighing 6-9.9kg\n \n 2022-06-30 13:52:32 UTC\n \n 2022-06-30 13:53:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1667\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:52:32',4,'2022-06-30 15:53:36',4,0,NULL,NULL,NULL,'ec54533d-f75a-4314-b085-4016edf73ccc'),(1668,'Clients given 4H weighing 10-13.9kg','Clients given 4H weighing 10-13.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H weighing 10-13.9kg\n Clients given 4H weighing 10-13.9kg\n \n 2022-06-30 13:52:54 UTC\n \n 2022-06-30 13:53:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1668\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:52:54',4,'2022-06-30 15:53:58',4,0,NULL,NULL,NULL,'306fc3f9-604f-4088-84fc-565bd360942d'),(1669,'Clients given 4H weighing 14-19.9kg','Clients given 4H weighing 14-19.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H weighing 14-19.9kg\n Clients given 4H weighing 14-19.9kg\n \n 2022-06-30 13:54:20 UTC\n \n 2022-06-30 13:55:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1669\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:54:20',4,'2022-06-30 15:55:40',4,0,NULL,NULL,NULL,'afa2260d-2d12-4922-8214-7321d1a7a0b2'),(1670,'Clients given 4H weighing 20-24.9kg','Clients given 4H weighing 20-24.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H weighing 20-24.9kg\n Clients given 4H weighing 20-24.9kg\n \n 2022-06-30 13:54:47 UTC\n \n 2022-06-30 13:56:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1670\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:54:47',4,'2022-06-30 15:56:07',4,0,NULL,NULL,NULL,'b12d0c96-1d85-4c87-8224-fcdcca3684ad'),(1671,'Clients given 4H weighing 25-34.9kg','Clients given 4H weighing 25-34.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H weighing 25-34.9kg\n Clients given 4H weighing 25-34.9kg\n \n 2022-06-30 13:56:49 UTC\n \n 2022-06-30 13:59:24 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1671\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:56:49',4,'2022-06-30 15:59:24',4,0,NULL,NULL,NULL,'c03a3023-e223-4974-82d2-f9884b64fd94'),(1672,'Clients given 4H weighing >= 35kg','Clients given 4H weighing >= 35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H weighing >= 35kg\n Clients given 4H weighing >= 35kg\n \n 2022-06-30 13:57:18 UTC\n \n 2022-06-30 13:59:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1672\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 15:57:18',4,'2022-06-30 15:59:06',4,0,NULL,NULL,NULL,'021ba7c8-9dde-4912-850e-7e1f90746b9c'),(1673,'Clients given 4J weighing 0-3.9kg','Clients given 4J weighing 0-3.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J weighing 0-3.9kg\n Clients given 4J weighing 0-3.9kg\n \n 2022-06-30 14:00:30 UTC\n \n 2022-06-30 14:01:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1673\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 16:00:30',4,'2022-06-30 16:01:59',4,0,NULL,NULL,NULL,'21e22f99-3f2f-4e4a-ac19-ea6a1fe4030a'),(1674,'Clients given 4J weighing 4-5.9kg','Clients given 4J weighing 4-5.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J weighing 4-5.9kg\n Clients given 4J weighing 4-5.9kg\n \n 2022-06-30 14:00:54 UTC\n \n 2022-06-30 14:02:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1674\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 16:00:54',4,'2022-06-30 16:02:01',4,0,NULL,NULL,NULL,'14f446ec-5d3e-43b6-ad36-6153fe3ee3e9'),(1675,'Clients given 4J weighing 6-9.9kg','Clients given 4J weighing 6-9.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J weighing 6-9.9kg\n Clients given 4J weighing 6-9.9kg\n \n 2022-06-30 14:03:04 UTC\n \n 2022-06-30 14:04:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1675\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 16:03:04',4,'2022-06-30 16:04:17',4,0,NULL,NULL,NULL,'cc3db8f2-7644-426f-9c03-2a1d48ebd7d7'),(1676,'Clients given 4J weighing 10-13.9kg','Clients given 4J weighing 10-13.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J weighing 10-13.9kg\n Clients given 4J weighing 10-13.9kg\n \n 2022-06-30 14:03:25 UTC\n \n 2022-06-30 14:04:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1676\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 16:03:25',4,'2022-06-30 16:04:39',4,0,NULL,NULL,NULL,'adc9fdd3-0019-4213-998f-ab2d235aae80'),(1677,'Clients given 4J weighing 14-19.9kg','Clients given 4J weighing 14-19.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J weighing 14-19.9kg\n Clients given 4J weighing 14-19.9kg\n \n 2022-06-30 14:05:01 UTC\n \n 2022-06-30 14:06:13 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1677\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 16:05:01',4,'2022-06-30 16:06:13',4,0,NULL,NULL,NULL,'4fc6749f-c47b-4021-8dbf-26732df08880'),(1678,'Clients given 4J weighing 20-24.9kg','Clients given 4J weighing 20-24.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J weighing 20-24.9kg\n Clients given 4J weighing 20-24.9kg\n \n 2022-06-30 14:05:23 UTC\n \n 2022-06-30 14:06:34 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1678\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 16:05:23',4,'2022-06-30 16:06:34',4,0,NULL,NULL,NULL,'669e5746-1eee-4811-94dd-e4c6dd949131'),(1679,'Clients given 4J weighing 25-34.9kg','Clients given 4J weighing 25-34.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J weighing 25-34.9kg\n Clients given 4J weighing 25-34.9kg\n \n 2022-06-30 14:06:56 UTC\n \n 2022-06-30 14:08:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1679\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 16:06:56',4,'2022-06-30 16:08:42',4,0,NULL,NULL,NULL,'78cbb142-b205-4059-89fa-70bd488a0513'),(1680,'Clients given 4J weighing >= 35kg','Clients given 4J weighing >= 35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J weighing >= 35kg\n Clients given 4J weighing >= 35kg\n \n 2022-06-30 14:07:26 UTC\n \n 2022-06-30 14:09:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1680\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 16:07:26',4,'2022-06-30 16:09:04',4,0,NULL,NULL,NULL,'ec90ccaa-999c-4b18-956b-50bee7c36868'),(1681,'Clients given 4L weighing 0-3.9kg','Clients given 4L weighing 0-3.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L weighing 0-3.9kg\n Clients given 4L weighing 0-3.9kg\n \n 2022-06-30 14:09:37 UTC\n \n 2022-06-30 14:10:48 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1681\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 16:09:37',4,'2022-06-30 16:10:48',4,0,NULL,NULL,NULL,'0e228ccb-1909-4a98-8334-89bf36d6e810'),(1682,'Clients given 4L weighing 4-5.9kg','Clients given 4L weighing 4-5.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L weighing 4-5.9kg\n Clients given 4L weighing 4-5.9kg\n \n 2022-06-30 14:10:06 UTC\n \n 2022-06-30 14:11:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1682\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 16:10:06',4,'2022-06-30 16:11:40',4,0,NULL,NULL,NULL,'d962f501-7157-4c19-9c7b-1a2a22053674'),(1683,'Clients given 4L weighing 6-9.9kg','Clients given 4L weighing 6-9.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L weighing 6-9.9kg\n Clients given 4L weighing 6-9.9kg\n \n 2022-06-30 14:11:24 UTC\n \n 2022-06-30 14:13:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1683\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 16:11:24',4,'2022-06-30 16:13:32',4,0,NULL,NULL,NULL,'16bb43f6-91a5-4e02-9627-9921460d5c68'),(1684,'Clients given 4L weighing 10-13.9kg','Clients given 4L weighing 10-13.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L weighing 10-13.9kg\n Clients given 4L weighing 10-13.9kg\n \n 2022-06-30 14:12:51 UTC\n \n 2022-06-30 14:14:24 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1684\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 16:12:51',4,'2022-06-30 16:14:24',4,0,NULL,NULL,NULL,'52d68e65-aa63-4c88-820e-e00bf66061ea'),(1685,'Clients given 4L weighing 14-19.9kg','Clients given 4L weighing 14-19.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L weighing 14-19.9kg\n Clients given 4L weighing 14-19.9kg\n \n 2022-06-30 14:14:11 UTC\n \n 2022-06-30 14:15:56 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1685\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 16:14:11',4,'2022-06-30 16:15:56',4,0,NULL,NULL,NULL,'1eb7fbd6-fa49-4ada-af7e-19424fb5a7e8'),(1686,'Clients given 4L weighing 20-24.9kg','Clients given 4L weighing 20-24.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L weighing 20-24.9kg\n Clients given 4L weighing 20-24.9kg\n \n 2022-06-30 14:15:00 UTC\n \n 2022-06-30 14:16:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1686\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 16:15:00',4,'2022-06-30 16:16:18',4,0,NULL,NULL,NULL,'d889b33a-5324-4655-965f-1fb6fdb8864d'),(1687,'Clients given 4L weighing 25-34.9kg','Clients given 4L weighing 25-34.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L weighing 25-34.9kg\n Clients given 4L weighing 25-34.9kg\n \n 2022-06-30 14:16:41 UTC\n \n 2022-06-30 14:18:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1687\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 16:16:41',4,'2022-06-30 16:18:03',4,0,NULL,NULL,NULL,'f8853175-2a1a-4d34-9a40-2d9ae44b5367'),(1688,'Clients given 4L weighing >= 35kg','Clients given 4L weighing >= 35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L weighing >= 35kg\n Clients given 4L weighing >= 35kg\n \n 2022-06-30 14:17:04 UTC\n \n 2022-06-30 14:18:34 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1688\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-06-30 16:17:04',4,'2022-06-30 16:18:34',4,0,NULL,NULL,NULL,'6cf112ca-592d-4638-8919-561aeb0e1b2e'),(1689,'Clients given 5A weighing 0-3.9kg','Clients given 5A weighing 0-3.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5A weighing 0-3.9kg\n Clients given 5A weighing 0-3.9kg\n \n 2022-07-04 07:51:16 UTC\n \n 2022-07-04 07:59:19 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1689\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 13:21:16',4,'2022-07-04 13:29:19',4,0,NULL,NULL,NULL,'1e8f892d-f7dd-4c03-bae2-2b6af9a96063'),(1690,'Clients given 5A weighing 4-5.9kg','Clients given 5A weighing 4-5.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5A weighing 4-5.9kg\n Clients given 5A weighing 4-5.9kg\n \n 2022-07-04 08:01:43 UTC\n \n 2022-07-04 08:08:34 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1690\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 13:31:43',4,'2022-07-04 13:38:34',4,0,NULL,NULL,NULL,'caef996e-3278-49a5-a46b-264db7abba88'),(1691,'Clients given 5A weighing 6-9.9kg','Clients given 5A weighing 6-9.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5A weighing 6-9.9kg\n Clients given 5A weighing 6-9.9kg\n \n 2022-07-04 08:10:17 UTC\n \n 2022-07-04 08:27:38 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1691\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 13:40:17',4,'2022-07-04 13:57:38',4,0,NULL,NULL,NULL,'e035adc0-696d-46e6-8075-9ea647aea054'),(1692,'Clients given 5A weighing 10-13.9kg','Clients given 5A weighing 10-13.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5A weighing 10-13.9kg\n Clients given 5A weighing 10-13.9kg\n \n 2022-07-04 08:12:41 UTC\n \n 2022-07-04 08:29:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1692\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 13:42:41',4,'2022-07-04 13:59:01',4,0,NULL,NULL,NULL,'ee8edb07-58b9-4884-8044-948e6bdef0a8'),(1693,'Clients given 5A weighing 14-19.9kg','Clients given 5A weighing 14-19.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5A weighing 14-19.9kg\n Clients given 5A weighing 14-19.9kg\n \n 2022-07-04 08:15:22 UTC\n \n 2022-07-04 08:30:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1693\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 13:45:22',4,'2022-07-04 14:00:32',4,0,NULL,NULL,NULL,'91a9fa6e-69dc-4980-bb69-ff2399a6e30e'),(1694,'Clients given 5A weighing 25-34.9kg','Clients given 5A weighing 25-34.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5A weighing 25-34.9kg\n Clients given 5A weighing 25-34.9kg\n \n 2022-07-04 08:17:38 UTC\n \n 2022-07-04 08:33:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1694\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 13:47:38',4,'2022-07-04 14:03:14',4,0,NULL,NULL,NULL,'671c4577-cc93-464c-b822-cdbee99fce15'),(1695,'Clients given 5A weighing 20-24.9kg','Clients given 5A weighing 20-24.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5A weighing 20-24.9kg\n Clients given 5A weighing 20-24.9kg\n \n 2022-07-04 08:21:33 UTC\n \n 2022-07-04 08:32:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1695\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 13:51:33',4,'2022-07-04 14:02:01',4,0,NULL,NULL,NULL,'33f3931b-17d8-445a-8275-abe1c9c62e60'),(1696,'Clients given 5A weighing >= 35kg','Clients given 5A weighing >= 35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5A weighing >= 35kg\n Clients given 5A weighing >= 35kg\n \n 2022-07-04 08:22:19 UTC\n \n 2022-07-04 08:25:33 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1696\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 13:52:19',4,'2022-07-04 13:55:33',4,0,NULL,NULL,NULL,'4174b385-1353-40e8-8771-820e7b8cc439'),(1697,'Clients given 5B weighing 0-3.9kg','Clients given 5B weighing 0-3.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5B weighing 0-3.9kg\n Clients given 5B weighing 0-3.9kg\n \n 2022-07-04 08:35:49 UTC\n \n 2022-07-04 08:39:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1697\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 14:05:49',4,'2022-07-04 14:09:51',4,0,NULL,NULL,NULL,'8ccf814e-72c3-40b9-8dae-53c47231713a'),(1698,'Clients given 5B weighing 4-5.9kg','Clients given 5B weighing 4-5.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5B weighing 4-5.9kg\n Clients given 5B weighing 4-5.9kg\n \n 2022-07-04 09:11:19 UTC\n \n 2022-07-04 09:12:47 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1698\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 14:41:19',4,'2022-07-04 14:42:47',4,0,NULL,NULL,NULL,'da9d3384-9203-4c29-9bb3-0064275b0bbf'),(1699,'Clients given 5B weighing 6-9.9kg','Clients given 5B weighing 6-9.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5B weighing 6-9.9kg\n Clients given 5B weighing 6-9.9kg\n \n 2022-07-04 09:12:11 UTC\n \n 2022-07-04 09:14:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1699\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 14:42:11',4,'2022-07-04 14:44:17',4,0,NULL,NULL,NULL,'9b461cbe-5394-43f1-a3a8-5cab077d880b'),(1700,'Clients given 5B weighing 10-13.9kg','Clients given 5B weighing 10-13.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5B weighing 10-13.9kg\n Clients given 5B weighing 10-13.9kg\n \n 2022-07-04 09:13:47 UTC\n \n 2022-07-04 09:15:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1700\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 14:43:47',4,'2022-07-04 14:45:39',4,0,NULL,NULL,NULL,'e757de08-36b9-48aa-ae1c-6e8b67f41517'),(1701,'Clients given 5B weighing 14-19.9kg','Clients given 5B weighing 14-19.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5B weighing 14-19.9kg\n Clients given 5B weighing 14-19.9kg\n \n 2022-07-04 09:17:29 UTC\n \n 2022-07-04 09:33:16 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1701\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 14:47:29',4,'2022-07-04 15:03:16',4,0,NULL,NULL,NULL,'b1164742-ca14-4264-979a-53f89a268f3a'),(1702,'Clients given 5B weighing 20-24.9kg','Clients given 5B weighing 20-24.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5B weighing 20-24.9kg\n Clients given 5B weighing 20-24.9kg\n \n 2022-07-04 09:18:14 UTC\n \n 2022-07-04 09:33:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1702\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 14:48:14',4,'2022-07-04 15:03:55',4,0,NULL,NULL,NULL,'37598126-d94c-4da8-bbac-1e0b9020ef33'),(1703,'Clients given 5B weighing 25-34.9kg','Clients given 5B weighing 25-34.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5B weighing 25-34.9kg\n Clients given 5B weighing 25-34.9kg\n \n 2022-07-04 09:38:26 UTC\n \n 2022-07-04 09:39:35 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1703\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 15:08:26',4,'2022-07-04 15:09:35',4,0,NULL,NULL,NULL,'578575b5-5eaf-4487-85b6-e81f72e577e7'),(1704,'Clients given 5C weighing 0-3.9kg','Clients given 5C weighing 0-3.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5C weighing 0-3.9kg\n Clients given 5C weighing 0-3.9kg\n \n 2022-07-04 09:40:50 UTC\n \n 2022-07-04 09:46:13 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1704\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 15:10:50',4,'2022-07-04 15:16:13',4,0,NULL,NULL,NULL,'183f7dbc-af84-4166-802d-fc168517be56'),(1705,'Clients given 5B weighing >= 35kg','Clients given 5B weighing >= 35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5B weighing >= 35kg\n Clients given 5B weighing >= 35kg\n \n 2022-07-04 09:41:33 UTC\n \n 2022-07-04 09:45:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1705\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 15:11:33',4,'2022-07-04 15:15:51',4,0,NULL,NULL,NULL,'bcad7f66-5905-4cb4-820c-20b76c185df0'),(1706,'Clients given 5C weighing 4-5.9kg','Clients given 5C weighing 4-5.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5C weighing 4-5.9kg\n Clients given 5C weighing 4-5.9kg\n \n 2022-07-04 09:46:54 UTC\n \n 2022-07-04 09:48:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1706\n COUNT\n \n \n \n \n endDate\n ${startDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 15:16:54',4,'2022-07-04 15:18:55',4,0,NULL,NULL,NULL,'646d055c-d02e-46d9-8af4-e8edd67a053a'),(1707,'Clients given 5C weighing 6-9.9kg','Clients given 5C weighing 6-9.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5C weighing 6-9.9kg\n Clients given 5C weighing 6-9.9kg\n \n 2022-07-04 09:47:34 UTC\n \n 2022-07-04 09:49:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1707\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 15:17:34',4,'2022-07-04 15:19:45',4,0,NULL,NULL,NULL,'bff00fe0-ccdd-4e59-8a04-5daae78f609f'),(1708,'Clients given 5C weighing 6-9.9kg','Clients given 5C weighing 6-9.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5C weighing 6-9.9kg\n Clients given 5C weighing 6-9.9kg\n \n 2022-07-04 09:50:21 UTC\n \n 2022-07-04 09:52:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1708\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 15:20:21',4,'2022-07-04 15:22:53',4,0,NULL,NULL,NULL,'a12b3ec6-868f-49da-9993-65fcea6139ce'),(1709,'Clients given 5C weighing 10-13.9kg','Clients given 5C weighing 10-13.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5C weighing 10-13.9kg\n Clients given 5C weighing 10-13.9kg\n \n 2022-07-04 09:51:17 UTC\n \n 2022-07-04 09:54:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1709\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 15:21:17',4,'2022-07-04 15:24:31',4,0,NULL,NULL,NULL,'11fd5caf-00b2-4c9b-89d3-dbe43460e1b4'),(1710,'Clients given 5C weighing 14-19.9kg','Clients given 5C weighing 14-19.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5C weighing 14-19.9kg\n Clients given 5C weighing 14-19.9kg\n \n 2022-07-04 09:54:02 UTC\n \n 2022-07-04 10:19:24 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1710\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 15:24:02',4,'2022-07-04 15:49:24',4,0,NULL,NULL,NULL,'35c1a303-9f1d-41a4-a7b2-a63222c0c0f8'),(1711,'Clients given 5C weighing 20-24.9kg','Clients given 5C weighing 20-24.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5C weighing 20-24.9kg\n Clients given 5C weighing 20-24.9kg\n \n 2022-07-04 10:20:29 UTC\n \n 2022-07-04 10:24:33 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1711\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 15:50:29',4,'2022-07-04 15:54:33',4,0,NULL,NULL,NULL,'300ad93a-8a96-42ee-b027-15e6ea66150c'),(1712,'Clients given 5C weighing 25-34.9kg','Clients given 5C weighing 25-34.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5C weighing 25-34.9kg\n Clients given 5C weighing 25-34.9kg\n \n 2022-07-04 10:20:49 UTC\n \n 2022-07-04 10:23:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1712\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 15:50:49',4,'2022-07-04 15:53:58',4,0,NULL,NULL,NULL,'2fb0cc71-47ac-4408-bb68-608d33609d53'),(1713,'Clients given 5C weighing >= 35kg','Clients given 5C weighing >= 35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5C weighing >= 35kg\n Clients given 5C weighing >= 35kg\n \n 2022-07-04 10:26:20 UTC\n \n 2022-07-04 10:29:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1713\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 15:56:20',4,'2022-07-04 15:59:43',4,0,NULL,NULL,NULL,'731fc698-2509-4d99-9163-e08624e75417'),(1714,'Clients given 5D weighing 0-3.9kg','Clients given 5D weighing 0-3.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5D weighing 0-3.9kg\n Clients given 5D weighing 0-3.9kg\n \n 2022-07-04 10:31:02 UTC\n \n 2022-07-04 10:34:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1714\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 16:01:02',4,'2022-07-04 16:04:29',4,0,NULL,NULL,NULL,'b285d939-9f51-47bd-8a6d-7f4e5d321058'),(1715,'Clients given 5D weighing 4-5.9kg','Clients given 5D weighing 4-5.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5D weighing 4-5.9kg\n Clients given 5D weighing 4-5.9kg\n \n 2022-07-04 10:36:13 UTC\n \n 2022-07-04 10:38:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1715\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 16:06:13',4,'2022-07-04 16:08:50',4,0,NULL,NULL,NULL,'8c7b5eac-d68a-4dbe-b341-3417d6c7cb50'),(1716,'Clients given 5D weighing 6-9.9kg','Clients given 5D weighing 6-9.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5D weighing 6-9.9kg\n Clients given 5D weighing 6-9.9kg\n \n 2022-07-04 10:36:38 UTC\n \n 2022-07-04 10:38:25 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1716\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 16:06:38',4,'2022-07-04 16:08:25',4,0,NULL,NULL,NULL,'f1dbcf85-e7e2-406e-ab4f-5b29a0f2dfb3'),(1717,'Clients given 5D weighing 10-13.9kg','Clients given 5D weighing 10-13.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5D weighing 10-13.9kg\n Clients given 5D weighing 10-13.9kg\n \n 2022-07-04 10:39:56 UTC\n \n 2022-07-04 10:42:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1717\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 16:09:56',4,'2022-07-04 16:12:05',4,0,NULL,NULL,NULL,'cc9e92c9-53f2-46a4-be46-ca904d385286'),(1718,'Clients given 5D weighing 14-19.9kg','Clients given 5D weighing 14-19.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5D weighing 14-19.9kg\n Clients given 5D weighing 14-19.9kg\n \n 2022-07-04 10:40:24 UTC\n \n 2022-07-04 10:42:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1718\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 16:10:24',4,'2022-07-04 16:12:36',4,0,NULL,NULL,NULL,'ea3aa469-cc4f-499c-b20f-a163afa5c116'),(1719,'Clients given 5D weighing 20-24.9kg','Clients given 5D weighing 20-24.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5D weighing 20-24.9kg\n Clients given 5D weighing 20-24.9kg\n \n 2022-07-04 10:43:39 UTC\n \n 2022-07-04 10:45:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1719\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 16:13:39',4,'2022-07-04 16:15:07',4,0,NULL,NULL,NULL,'51201bc9-2e68-47b2-a264-dfe852767cbb'),(1720,'Clients given 5D weighing 25-34.9kg','Clients given 5D weighing 25-34.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5D weighing 25-34.9kg\n Clients given 5D weighing 25-34.9kg\n \n 2022-07-04 10:44:10 UTC\n \n 2022-07-04 10:46:49 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1720\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 16:14:10',4,'2022-07-04 16:16:49',4,0,NULL,NULL,NULL,'99779a0a-4228-4d21-bc53-a4724c950f64'),(1721,'Clients given 5D weighing >= 35kg','Clients given 5D weighing >= 35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5D weighing >= 35kg\n Clients given 5D weighing >= 35kg\n \n 2022-07-04 10:46:20 UTC\n \n 2022-07-04 10:49:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1721\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 16:16:20',4,'2022-07-04 16:19:12',4,0,NULL,NULL,NULL,'a9db689b-55c9-49a6-bf7b-f841503b81d4'),(1722,'Clients given 5E weighing 0-3.9kg','Clients given 5E weighing 0-3.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5E weighing 0-3.9kg\n Clients given 5E weighing 0-3.9kg\n \n 2022-07-04 10:49:03 UTC\n \n 2022-07-04 10:54:57 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1722\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 16:19:03',4,'2022-07-04 16:24:57',4,0,NULL,NULL,NULL,'98825a71-acf0-4a06-b318-1dfbc4bc85e8'),(1723,'Clients given 5E weighing 4-5.9kg','Clients given 5E weighing 4-5.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5E weighing 4-5.9kg\n Clients given 5E weighing 4-5.9kg\n \n 2022-07-04 10:50:24 UTC\n \n 2022-07-04 10:53:38 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1723\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 16:20:24',4,'2022-07-04 16:23:38',4,0,NULL,NULL,NULL,'09876d38-7d00-460f-a95d-f1d084f84cb0'),(1724,'Clients given 5E weighing 6-9.9kg','Clients given 5E weighing 6-9.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5E weighing 6-9.9kg\n Clients given 5E weighing 6-9.9kg\n \n 2022-07-04 10:55:45 UTC\n \n 2022-07-04 10:59:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1724\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 16:25:45',4,'2022-07-04 16:29:01',4,0,NULL,NULL,NULL,'d95839a2-da76-4d9f-9dde-6ef33f9d3c7d'),(1725,'Clients given 5E weighing 10-13.9kg','Clients given 5E weighing 10-13.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5E weighing 10-13.9kg\n Clients given 5E weighing 10-13.9kg\n \n 2022-07-04 10:56:27 UTC\n \n 2022-07-04 11:04:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1725\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 16:26:27',4,'2022-07-04 16:34:36',4,0,NULL,NULL,NULL,'c0a9a74f-b14c-42fb-87bc-710bd652916c'),(1726,'Clients given 5E weighing 14-19.9kg','Clients given 5E weighing 14-19.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5E weighing 14-19.9kg\n Clients given 5E weighing 14-19.9kg\n \n 2022-07-04 11:00:36 UTC\n \n 2022-07-04 11:07:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1726\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 16:30:36',4,'2022-07-04 16:37:08',4,0,NULL,NULL,NULL,'29478b1e-23c8-4fa0-a17e-9f3c11e801af'),(1727,'Clients given 5E weighing 20-24.9kg','Clients given 5E weighing 20-24.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5E weighing 20-24.9kg\n Clients given 5E weighing 20-24.9kg\n \n 2022-07-04 11:06:35 UTC\n \n 2022-07-04 11:08:57 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1727\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 16:36:35',4,'2022-07-04 16:38:57',4,0,NULL,NULL,NULL,'0a71c7f2-39c8-4d46-bdb3-847b616997b6'),(1728,'Clients given 5E weighing 25-34.9kg','Clients given 5E weighing 25-34.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5E weighing 25-34.9kg\n Clients given 5E weighing 25-34.9kg\n \n 2022-07-04 11:09:38 UTC\n \n 2022-07-04 11:12:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1728\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 16:39:38',4,'2022-07-04 16:42:02',4,0,NULL,NULL,NULL,'f20e7d1a-0f66-4fb8-a254-11720f9fcdb4'),(1729,'Clients given 5E weighing >= 35kg','Clients given 5E weighing >= 35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5E weighing >= 35kg\n Clients given 5E weighing >= 35kg\n \n 2022-07-04 11:10:10 UTC\n \n 2022-07-04 11:11:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1729\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 16:40:10',4,'2022-07-04 16:41:28',4,0,NULL,NULL,NULL,'6c8300f9-3327-46f5-b538-5926daf7f3e9'),(1730,'Clients given 5F weighing 0-3.9kg','Clients given 5F weighing 0-3.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5F weighing 0-3.9kg\n Clients given 5F weighing 0-3.9kg\n \n 2022-07-04 11:12:43 UTC\n \n 2022-07-04 11:16:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1730\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 16:42:43',4,'2022-07-04 16:46:11',4,0,NULL,NULL,NULL,'cc140697-6404-4bfa-927a-1e331e05a771'),(1731,'Clients given 5F weighing 4-5.9kg','Clients given 5F weighing 4-5.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5F weighing 4-5.9kg\n Clients given 5F weighing 4-5.9kg\n \n 2022-07-04 11:15:42 UTC\n \n 2022-07-04 11:17:37 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1731\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 16:45:42',4,'2022-07-04 16:47:37',4,0,NULL,NULL,NULL,'feee080e-df6e-4d55-a631-a5b8e6561be8'),(1732,'Clients given 5F weighing 6-9.9kg','Clients given 5F weighing 6-9.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5F weighing 6-9.9kg\n Clients given 5F weighing 6-9.9kg\n \n 2022-07-04 11:16:51 UTC\n \n 2022-07-04 11:20:54 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1732\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 16:46:51',4,'2022-07-04 16:50:54',4,0,NULL,NULL,NULL,'fefc7c1d-f181-415a-b896-9ef303b4ce6a'),(1733,'Clients given 5F weighing 10-13.9kg','Clients given 5F weighing 10-13.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5F weighing 10-13.9kg\n Clients given 5F weighing 10-13.9kg\n \n 2022-07-04 11:19:35 UTC\n \n 2022-07-04 11:21:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1733\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 16:49:35',4,'2022-07-04 16:51:36',4,0,NULL,NULL,NULL,'cc52bd93-49e7-488c-9706-669f6401eb7a'),(1734,'Clients given 5F weighing 14-19.9kg','Clients given 5F weighing 14-19.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5F weighing 14-19.9kg\n Clients given 5F weighing 14-19.9kg\n \n 2022-07-04 11:27:47 UTC\n \n 2022-07-04 11:30:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1734\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 16:57:47',4,'2022-07-04 17:00:51',4,0,NULL,NULL,NULL,'a1b3f036-8f11-463c-906f-0907c8bb3168'),(1735,'Clients given 5F weighing 20-24.9kg','Clients given 5F weighing 20-24.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5F weighing 20-24.9kg\n Clients given 5F weighing 20-24.9kg\n \n 2022-07-04 11:28:06 UTC\n \n 2022-07-04 11:31:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1735\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 16:58:06',4,'2022-07-04 17:01:26',4,0,NULL,NULL,NULL,'545d0307-0065-48ef-b35d-db0b97d6f0a4'),(1736,'Clients given 5F weighing 25-34.9kg','Clients given 5F weighing 25-34.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5F weighing 25-34.9kg\n Clients given 5F weighing 25-34.9kg\n \n 2022-07-04 11:32:18 UTC\n \n 2022-07-04 11:34:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1736\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 17:02:18',4,'2022-07-04 17:04:20',4,0,NULL,NULL,NULL,'a3cc0250-e3f5-4b02-a569-d5737c7c2ca2'),(1737,'Clients given 5F weighing >= 35kg','Clients given 5F weighing >= 35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5F weighing >= 35kg\n Clients given 5F weighing >= 35kg\n \n 2022-07-04 11:32:59 UTC\n \n 2022-07-04 11:34:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1737\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 17:02:59',4,'2022-07-04 17:04:45',4,0,NULL,NULL,NULL,'ff867f63-d45f-4ffc-8378-22a72111492b'),(1738,'Clients given 5G weighing 0-3.9kg','Clients given 5G weighing 0-3.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G weighing 0-3.9kg\n Clients given 5G weighing 0-3.9kg\n \n 2022-07-04 11:37:11 UTC\n \n 2022-07-04 11:39:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1738\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 17:07:11',4,'2022-07-04 17:09:08',4,0,NULL,NULL,NULL,'b5725eac-2a7a-4f4b-be0b-670c5edae46f'),(1739,'Clients given 5G weighing 4-5.9kg','Clients given 5G weighing 4-5.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G weighing 4-5.9kg\n Clients given 5G weighing 4-5.9kg\n \n 2022-07-04 11:38:21 UTC\n \n 2022-07-04 11:40:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1739\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 17:08:21',4,'2022-07-04 17:10:28',4,0,NULL,NULL,NULL,'01b5a831-a97a-473d-9cab-171aed11937a'),(1740,'Clients given 5G weighing 6-9.9kg','Clients given 5G weighing 6-9.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G weighing 6-9.9kg\n Clients given 5G weighing 6-9.9kg\n \n 2022-07-04 11:40:56 UTC\n \n 2022-07-04 11:42:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1740\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 17:10:56',4,'2022-07-04 17:12:46',4,0,NULL,NULL,NULL,'b35556af-d5de-4740-8d7d-ee2c7415f2aa'),(1741,'Clients given 5G weighing 10-13.9kg','Clients given 5G weighing 10-13.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G weighing 10-13.9kg\n Clients given 5G weighing 10-13.9kg\n \n 2022-07-04 11:41:26 UTC\n \n 2022-07-04 11:43:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1741\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 17:11:26',4,'2022-07-04 17:13:31',4,0,NULL,NULL,NULL,'fecb7060-8111-4db9-aa13-9355bfe19034'),(1742,'Clients given 5G weighing 14-19.9kg','Clients given 5G weighing 14-19.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G weighing 14-19.9kg\n Clients given 5G weighing 14-19.9kg\n \n 2022-07-04 11:44:52 UTC\n \n 2022-07-04 11:47:38 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1742\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 17:14:52',4,'2022-07-04 17:17:38',4,0,NULL,NULL,NULL,'edcea1e9-f4fe-459c-a9a5-99dc5b454f6b'),(1743,'Clients given 5G weighing 20-24.9kg','Clients given 5G weighing 20-24.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G weighing 20-24.9kg\n Clients given 5G weighing 20-24.9kg\n \n 2022-07-04 11:45:28 UTC\n \n 2022-07-04 11:47:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1743\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 17:15:28',4,'2022-07-04 17:17:23',4,0,NULL,NULL,NULL,'d624256f-ee53-49de-b806-e54f0f885165'),(1744,'Clients given 5G weighing 25-34.9kg','Clients given 5G weighing 25-34.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G weighing 25-34.9kg\n Clients given 5G weighing 25-34.9kg\n \n 2022-07-04 11:48:46 UTC\n \n 2022-07-06 09:16:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1744\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 11:48:46',4,'2022-07-06 09:16:23',4,0,NULL,NULL,NULL,'2fdbe8de-90ef-4198-8960-6d195608e255'),(1745,'Clients given 5G weighing >= 35kg','Clients given 5G weighing >= 35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G weighing >= 35kg\n Clients given 5G weighing >= 35kg\n \n 2022-07-04 11:49:49 UTC\n \n 2022-07-04 11:51:52 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1745\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 17:19:49',4,'2022-07-04 17:21:52',4,0,NULL,NULL,NULL,'477dc5ab-12a7-4553-b65d-57ced1093ae7'),(1746,'Clients given 5G weighing 0-3.9kg','Clients given 5G weighing 0-3.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G weighing 0-3.9kg\n Clients given 5G weighing 0-3.9kg\n \n 2022-07-04 11:52:26 UTC\n \n 2022-07-04 11:55:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1746\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 17:22:26',4,'2022-07-04 17:25:43',4,0,NULL,NULL,NULL,'b30dd237-ce5e-4eb4-8c3e-e4522f1fc695'),(1747,'Clients given 5G weighing 4-5.9kg','Clients given 5G weighing 4-5.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G weighing 4-5.9kg\n Clients given 5G weighing 4-5.9kg\n \n 2022-07-04 11:53:47 UTC\n \n 2022-07-04 11:56:37 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1747\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 17:23:47',4,'2022-07-04 17:26:37',4,0,NULL,NULL,NULL,'8e235e40-e811-4db9-82c2-ab1b5d2965f9'),(1748,'Clients given 5G weighing 6-9.9kg','Clients given 5G weighing 6-9.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G weighing 6-9.9kg\n Clients given 5G weighing 6-9.9kg\n \n 2022-07-04 11:57:59 UTC\n \n 2022-07-04 12:00:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1748\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 17:27:59',4,'2022-07-04 17:30:12',4,0,NULL,NULL,NULL,'b0a0a091-97ba-49d0-9845-f10070dd4ea3'),(1749,'Clients given 5G weighing 10-13.9kg','Clients given 5G weighing 10-13.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G weighing 10-13.9kg\n Clients given 5G weighing 10-13.9kg\n \n 2022-07-04 11:58:53 UTC\n \n 2022-07-04 12:00:48 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1749\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 17:28:53',4,'2022-07-04 17:30:48',4,0,NULL,NULL,NULL,'3d826ce1-96c8-4e57-892d-c097e4ac9ac5'),(1750,'Clients given 5G weighing 14-19.9kg','Clients given 5G weighing 14-19.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G weighing 14-19.9kg\n Clients given 5G weighing 14-19.9kg\n \n 2022-07-04 12:03:51 UTC\n \n 2022-07-04 12:08:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1750\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 17:33:51',4,'2022-07-04 17:38:23',4,0,NULL,NULL,NULL,'79890495-f468-4d64-b519-756630352b5d'),(1751,'Clients given 5G weighing 20-24.9kg','Clients given 5G weighing 20-24.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G weighing 20-24.9kg\n Clients given 5G weighing 20-24.9kg\n \n 2022-07-04 12:04:50 UTC\n \n 2022-07-04 18:39:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1751\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-04 17:34:50',4,'2022-07-05 00:09:28',4,0,NULL,NULL,NULL,'d06ae952-edbf-4c3e-b3a8-1c4ee70886fc'),(1752,' Clients given 5G weighing 25-29.9kg',' Clients given 5G weighing 25-29.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G weighing 25-29.9kg\n Clients given 5G weighing 25-29.9kg\n \n 2022-07-04 18:44:18 UTC\n \n 2022-07-04 18:47:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1752\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 00:14:18',4,'2022-07-05 00:17:20',4,0,NULL,NULL,NULL,'ad3c3764-3438-43a7-ade5-98458af16de5'),(1753,' Clients given 5G weighing >= 35kg',' Clients given 5G weighing >= 35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G weighing >= 35kg\n Clients given 5G weighing >= 35kg\n \n 2022-07-04 18:47:57 UTC\n \n 2022-07-04 18:49:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1753\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 00:17:57',4,'2022-07-05 00:19:45',4,0,NULL,NULL,NULL,'5c731dbc-ddd2-4a58-9e69-c112f74d40a7'),(1754,' Clients given 5H weighing 0-3.9kg',' Clients given 5H weighing 0-3.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5H weighing 0-3.9kg\n Clients given 5H weighing 0-3.9kg\n \n 2022-07-04 18:49:18 UTC\n \n 2022-07-04 18:53:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1754\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 00:19:18',4,'2022-07-05 00:23:27',4,0,NULL,NULL,NULL,'76ca732d-65f9-4ec3-8c5c-41d7503ed512'),(1755,' Clients given 5H weighing 4-5.9kg',' Clients given 5H weighing 4-5.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5H weighing 4-5.9kg\n Clients given 5H weighing 4-5.9kg\n \n 2022-07-04 18:54:29 UTC\n \n 2022-07-04 18:55:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1755\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 00:24:29',4,'2022-07-05 00:25:53',4,0,NULL,NULL,NULL,'75354bc7-40ec-489e-a13a-5b0de9d609cd'),(1756,' Clients given 5H weighing 6-9.9kg',' Clients given 5H weighing 6-9.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5H weighing 6-9.9kg\n Clients given 5H weighing 6-9.9kg\n \n 2022-07-04 18:55:07 UTC\n \n 2022-07-04 18:58:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1756\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 00:25:07',4,'2022-07-05 00:28:07',4,0,NULL,NULL,NULL,'4c27c57e-78ec-4934-837f-d52f59a8e263'),(1757,' Clients given 5H weighing 10-13.9kg',' Clients given 5H weighing 10-13.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5H weighing 10-13.9kg\n Clients given 5H weighing 10-13.9kg\n \n 2022-07-04 18:57:10 UTC\n \n 2022-07-04 19:05:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1757\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 00:27:10',4,'2022-07-05 00:35:15',4,0,NULL,NULL,NULL,'10ee2cc4-a8c0-46c7-8b26-2c69eafd6aed'),(1758,' Clients given 5H weighing 14-19.9kg',' Clients given 5H weighing 14-19.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5H weighing 14-19.9kg\n Clients given 5H weighing 14-19.9kg\n \n 2022-07-04 18:58:51 UTC\n \n 2022-07-04 19:01:57 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1758\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 00:28:51',4,'2022-07-05 00:31:57',4,0,NULL,NULL,NULL,'bfd4191f-c556-41df-8f09-970ece8eb883'),(1759,' Clients given 5H weighing 20-24.9kg',' Clients given 5H weighing 20-24.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5H weighing 20-24.9kg\n Clients given 5H weighing 20-24.9kg\n \n 2022-07-04 19:02:44 UTC\n \n 2022-07-04 19:03:54 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1759\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 00:32:44',4,'2022-07-05 00:33:54',4,0,NULL,NULL,NULL,'3118f852-4fd1-4807-abfc-6f4d8a4b34e3'),(1760,' Clients given 5H weighing 25-34.9kg',' Clients given 5H weighing 25-34.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5H weighing 25-34.9kg\n Clients given 5H weighing 25-34.9kg\n \n 2022-07-04 19:04:45 UTC\n \n 2022-07-04 19:07:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1760\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 00:34:45',4,'2022-07-05 00:37:04',4,0,NULL,NULL,NULL,'443efbd3-a0a9-473a-8408-e57b58477156'),(1761,' Clients given 5H weighing >= 35kg',' Clients given 5H weighing >= 35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5H weighing >= 35kg\n Clients given 5H weighing >= 35kg\n \n 2022-07-04 19:06:06 UTC\n \n 2022-07-04 19:07:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1761\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 00:36:06',4,'2022-07-05 00:37:27',4,0,NULL,NULL,NULL,'89320a1f-49b4-464e-8a37-21748419ed81'),(1762,' Clients given 6A weighing 0-3.9kg',' Clients given 6A weighing 0-3.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6A weighing 0-3.9kg\n Clients given 6A weighing 0-3.9kg\n \n 2022-07-04 19:08:02 UTC\n \n 2022-07-04 19:09:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1762\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 00:38:02',4,'2022-07-05 00:39:31',4,0,NULL,NULL,NULL,'f0cdda8e-9894-4125-b1c0-014ccc6ad7ea'),(1763,' Clients given 6A weighing 4-5.9kg',' Clients given 6A weighing 4-5.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6A weighing 4-5.9kg\n Clients given 6A weighing 4-5.9kg\n \n 2022-07-04 19:08:26 UTC\n \n 2022-07-04 19:09:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1763\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 00:38:26',4,'2022-07-05 00:39:50',4,0,NULL,NULL,NULL,'5701682a-a88c-46a8-957a-3322894a6e43'),(1764,' Clients given 6A weighing 6-9.9kg',' Clients given 6A weighing 6-9.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6A weighing 6-9.9kg\n Clients given 6A weighing 6-9.9kg\n \n 2022-07-04 19:10:14 UTC\n \n 2022-07-04 19:11:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1764\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 00:40:14',4,'2022-07-05 00:41:50',4,0,NULL,NULL,NULL,'92f27e6f-6178-4e65-b055-798f3dd1e1ae'),(1765,' Clients given 6A weighing 10-13.9kg',' Clients given 6A weighing 10-13.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6A weighing 10-13.9kg\n Clients given 6A weighing 10-13.9kg\n \n 2022-07-04 19:10:49 UTC\n \n 2022-07-04 19:12:19 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1765\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 00:40:49',4,'2022-07-05 00:42:19',4,0,NULL,NULL,NULL,'a74e222c-96c6-45f8-83e7-3ce0d50cc83c'),(1766,' Clients given 6A weighing 14-19.9kg',' Clients given 6A weighing 14-19.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6A weighing 14-19.9kg\n Clients given 6A weighing 14-19.9kg\n \n 2022-07-04 19:12:45 UTC\n \n 2022-07-04 19:14:57 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1766\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 00:42:45',4,'2022-07-05 00:44:57',4,0,NULL,NULL,NULL,'79e9b5db-636c-4afb-8291-cb558667ebd5'),(1767,' Clients given 6A weighing 20-24.9kg',' Clients given 6A weighing 20-24.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6A weighing 20-24.9kg\n Clients given 6A weighing 20-24.9kg\n \n 2022-07-04 19:13:20 UTC\n \n 2022-07-04 19:15:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1767\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 00:43:20',4,'2022-07-05 00:45:14',4,0,NULL,NULL,NULL,'11eeec05-8a04-4f44-bc0c-dddb88b8270d'),(1768,' Clients given 6A weighing 25-34.9kg',' Clients given 6A weighing 25-34.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6A weighing 25-34.9kg\n Clients given 6A weighing 25-34.9kg\n \n 2022-07-04 19:13:46 UTC\n \n 2022-07-04 19:15:35 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1768\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 00:43:46',4,'2022-07-05 00:45:35',4,0,NULL,NULL,NULL,'23c30258-a527-4c1e-92b8-c3d7310c7c49'),(1769,' Clients given 6A weighing >= 35kg',' Clients given 6A weighing >= 35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6A weighing >= 35kg\n Clients given 6A weighing >= 35kg\n \n 2022-07-04 19:16:05 UTC\n \n 2022-07-04 19:18:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1769\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 00:46:05',4,'2022-07-05 00:48:21',4,0,NULL,NULL,NULL,'eac739c5-ff7a-4169-a6c2-faba753958df'),(1770,' Clients given 6B weighing 0-3.9kg',' Clients given 6B weighing 0-3.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6B weighing 0-3.9kg\n Clients given 6B weighing 0-3.9kg\n \n 2022-07-04 19:16:33 UTC\n \n 2022-07-04 19:18:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1770\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 00:46:33',4,'2022-07-05 00:48:05',4,0,NULL,NULL,NULL,'6e8cb9ab-5663-4da1-9c67-9188bf5ce4c6'),(1771,' Clients given 6B weighing 4-5.9kg',' Clients given 6B weighing 4-5.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6B weighing 4-5.9kg\n Clients given 6B weighing 4-5.9kg\n \n 2022-07-04 19:16:56 UTC\n \n 2022-07-04 19:18:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1771\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 00:46:56',4,'2022-07-05 00:48:41',4,0,NULL,NULL,NULL,'6e7f8b89-d2bb-42a4-8b0d-687950bfd3a8'),(1772,' Clients given 6B weighing 6-9.9kg',' Clients given 6B weighing 6-9.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6B weighing 6-9.9kg\n Clients given 6B weighing 6-9.9kg\n \n 2022-07-04 19:19:08 UTC\n \n 2022-07-04 19:22:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1772\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 00:49:08',4,'2022-07-05 00:52:03',4,0,NULL,NULL,NULL,'4ccea0f3-80d7-4b3f-850f-93985538cfeb'),(1773,' Clients given 6B weighing 10-13.9kg',' Clients given 6B weighing 10-13.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6B weighing 10-13.9kg\n Clients given 6B weighing 10-13.9kg\n \n 2022-07-04 19:19:37 UTC\n \n 2022-07-04 19:22:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1773\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 00:49:37',4,'2022-07-05 00:52:18',4,0,NULL,NULL,NULL,'3c303fcf-f9db-4e5f-8e9e-33df86616930'),(1774,' Clients given 6B weighing 14-19.9kg',' Clients given 6B weighing 14-19.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6B weighing 14-19.9kg\n Clients given 6B weighing 14-19.9kg\n \n 2022-07-04 19:20:09 UTC\n \n 2022-07-04 19:24:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1774\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 00:50:09',4,'2022-07-05 00:54:44',4,0,NULL,NULL,NULL,'551ea342-168d-4089-834b-dab745648722'),(1775,' Clients given 6B weighing 20-24.9kg',' Clients given 6B weighing 20-24.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6B weighing 20-24.9kg\n Clients given 6B weighing 20-24.9kg\n \n 2022-07-04 19:20:32 UTC\n \n 2022-07-04 19:23:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1775\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 00:50:32',4,'2022-07-05 00:53:03',4,0,NULL,NULL,NULL,'42e304a1-3961-4344-ae32-2348b7a5b81a'); -INSERT INTO `serialized_object` VALUES (1776,' Clients given 6B weighing 25-34.9kg',' Clients given 6B weighing 25-34.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6B weighing 25-34.9kg\n Clients given 6B weighing 25-34.9kg\n \n 2022-07-04 19:23:47 UTC\n \n 2022-07-04 19:27:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1776\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 00:53:47',4,'2022-07-05 00:57:17',4,0,NULL,NULL,NULL,'70621294-d632-4b66-8f10-0343433b8267'),(1777,' Clients given 6B weighing >= 35kg',' Clients given 6B weighing >= 35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6B weighing >= 35kg\n Clients given 6B weighing >= 35kg\n \n 2022-07-04 19:24:19 UTC\n \n 2022-07-04 19:27:33 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1777\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 00:54:19',4,'2022-07-05 00:57:33',4,0,NULL,NULL,NULL,'ed32ff5b-41ed-4933-a39e-bc4fb685b9eb'),(1778,'Clients given 6C weighing 0-3.9kg','Clients given 6C weighing 0-3.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C weighing 0-3.9kg\n Clients given 6C weighing 0-3.9kg\n \n 2022-07-05 06:03:11 UTC\n \n 2022-07-05 06:05:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1778\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:33:11',4,'2022-07-05 11:35:26',4,0,NULL,NULL,NULL,'7708c697-6d7d-42e7-aba6-613e36081fab'),(1779,'Clients given 6C weighing 4-5.9kg','Clients given 6C weighing 6-9.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C weighing 4-5.9kg\n Clients given 6C weighing 6-9.9kg\n \n 2022-07-05 06:03:33 UTC\n \n 2022-07-05 06:09:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1779\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:33:33',4,'2022-07-05 11:39:04',4,0,NULL,NULL,NULL,'95504660-becd-4eff-a280-5aa869762885'),(1780,'Clients given 6C weighing 6-9.9kg','Clients given 6C weighing 6-9.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C weighing 6-9.9kg\n Clients given 6C weighing 6-9.9kg\n \n 2022-07-05 06:03:55 UTC\n \n 2022-07-05 06:07:47 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1780\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:33:55',4,'2022-07-05 11:37:47',4,0,NULL,NULL,NULL,'d3ba1e90-03ce-4af3-8b68-9e4bb86a2fda'),(1781,'Clients given 6C weighing 10-13.9kg','Clients given 6C weighing 10-13.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C weighing 10-13.9kg\n Clients given 6C weighing 10-13.9kg\n \n 2022-07-05 06:09:31 UTC\n \n 2022-07-05 06:12:33 UTC\n \n \n location\n \n org.openmrs.Location\n true\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n 1781\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:39:31',4,'2022-07-05 11:42:33',4,0,NULL,NULL,NULL,'bd61f262-344c-4834-846b-dbfd4b8f8454'),(1782,'Clients given 6C weighing 14-19.9kg','Clients given 6C weighing 14-19.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C weighing 14-19.9kg\n Clients given 6C weighing 14-19.9kg\n \n 2022-07-05 06:11:03 UTC\n \n 2022-07-05 06:14:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1782\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:41:03',4,'2022-07-05 11:44:18',4,0,NULL,NULL,NULL,'ef452600-16ec-4d05-bf02-a2f5da8c503d'),(1783,'Clients given 6C weighing 20-24.9kg','Clients given 6C weighing 20-24.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C weighing 20-24.9kg\n Clients given 6C weighing 20-24.9kg\n \n 2022-07-05 06:12:09 UTC\n \n 2022-07-05 06:14:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1783\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:42:09',4,'2022-07-05 11:44:44',4,0,NULL,NULL,NULL,'84b7e946-ef4b-498c-aa99-a7469d841d89'),(1784,'Clients given 6C weighing 25-34.9kg','Clients given 6C weighing 25-34.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C weighing 25-34.9kg\n Clients given 6C weighing 25-34.9kg\n \n 2022-07-05 06:13:57 UTC\n \n 2022-07-05 06:17:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1784\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:43:57',4,'2022-07-05 11:47:03',4,0,NULL,NULL,NULL,'d0662ec5-9909-46a1-8d42-4f13c5e08f54'),(1785,'Clients given 6C weighing >= 35kg','Clients given 6C weighing >= 35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C weighing >= 35kg\n Clients given 6C weighing >= 35kg\n \n 2022-07-05 06:17:43 UTC\n \n 2022-07-05 06:20:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1785\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:47:43',4,'2022-07-05 11:50:43',4,0,NULL,NULL,NULL,'e469295b-caa7-4154-b5ac-e2d0a7042d5b'),(1786,'Clients given 6D weighing 0-3.9kg','Clients given 6D weighing 0-3.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D weighing 0-3.9kg\n Clients given 6D weighing 0-3.9kg\n \n 2022-07-05 06:18:16 UTC\n \n 2022-07-05 06:19:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1786\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:48:16',4,'2022-07-05 11:49:53',4,0,NULL,NULL,NULL,'a6985c5b-86f8-4647-86ea-ddd69097681e'),(1787,'Clients given 6D weighing 4-5.9kg','Clients given 6D weighing 4-5.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D weighing 4-5.9kg\n Clients given 6D weighing 4-5.9kg\n \n 2022-07-05 06:18:43 UTC\n \n 2022-07-05 06:20:24 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1787\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:48:43',4,'2022-07-05 11:50:24',4,0,NULL,NULL,NULL,'3eec1d07-6d91-43dd-a942-24d23e4a0f9c'),(1788,'Clients given 6D weighing 6-9.9kg','Clients given 6D weighing 6-9.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D weighing 6-9.9kg\n Clients given 6D weighing 6-9.9kg\n \n 2022-07-05 06:21:17 UTC\n \n 2022-07-05 06:22:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1788\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:51:17',4,'2022-07-05 11:52:45',4,0,NULL,NULL,NULL,'37509f55-cbd9-4096-8522-1e7918b1a48c'),(1789,'Clients given 6D weighing 10-13.9kg','Clients given 6D weighing 10-13.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D weighing 10-13.9kg\n Clients given 6D weighing 10-13.9kg\n \n 2022-07-05 06:21:34 UTC\n \n 2022-07-05 06:23:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1789\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:51:34',4,'2022-07-05 11:53:04',4,0,NULL,NULL,NULL,'477311cf-0367-47e1-9717-4732fc0752f0'),(1790,'Clients given 6D weighing 14-19.9kg','Clients given 6D weighing 14-19.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D weighing 14-19.9kg\n Clients given 6D weighing 14-19.9kg\n \n 2022-07-05 06:21:55 UTC\n \n 2022-07-05 06:23:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1790\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:51:55',4,'2022-07-05 11:53:21',4,0,NULL,NULL,NULL,'62232334-aa48-4e29-92fc-c4f931bcfb01'),(1791,'Clients given 6D weighing 20-24.9kg','Clients given 6D weighing 20-24.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D weighing 20-24.9kg\n Clients given 6D weighing 20-24.9kg\n \n 2022-07-05 06:23:43 UTC\n \n 2022-07-05 06:25:33 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1791\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:53:43',4,'2022-07-05 11:55:33',4,0,NULL,NULL,NULL,'8b171cf1-4052-49f3-9b28-76161872f1ac'),(1792,'Clients given 6D weighing 25-34.9kg','Clients given 6D weighing 25-34.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D weighing 25-34.9kg\n Clients given 6D weighing 25-34.9kg\n \n 2022-07-05 06:24:03 UTC\n \n 2022-07-05 06:25:47 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1792\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:54:03',4,'2022-07-05 11:55:47',4,0,NULL,NULL,NULL,'20d6a8c0-12ee-420c-a3f6-22d2e7a829bd'),(1793,'Clients given 6D weighing >= 35kg','Clients given 6D weighing >= 35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D weighing >= 35kg\n Clients given 6D weighing >= 35kg\n \n 2022-07-05 06:24:35 UTC\n \n 2022-07-05 06:26:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1793\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:54:35',4,'2022-07-05 11:56:11',4,0,NULL,NULL,NULL,'41d104fe-8277-4caa-b55e-07ea346801a7'),(1794,'Clients given 6E weighing 0-3.9 kg','Clients given 6E weighing 0-3.9 kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E weighing 0-3.9 kg\n Clients given 6E weighing 0-3.9 kg\n \n 2022-07-05 06:27:58 UTC\n \n 2022-07-05 06:30:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1794\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:57:58',4,'2022-07-05 12:00:43',4,0,NULL,NULL,NULL,'ddcdfef8-c5fd-4bd2-9963-4d5d48702f57'),(1795,'Clients given 6E weighing 4-5.9 kg','Clients given 6E weighing 4-5.9 kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E weighing 4-5.9 kg\n Clients given 6E weighing 4-5.9 kg\n \n 2022-07-05 06:28:17 UTC\n \n 2022-07-05 06:32:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1795\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:58:17',4,'2022-07-05 12:02:01',4,0,NULL,NULL,NULL,'52757686-f3a7-4d53-84bb-76aea347f4d3'),(1796,'Clients given 6E weighing 6-9.9 kg','Clients given 6E weighing 6-9.9 kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E weighing 6-9.9 kg\n Clients given 6E weighing 6-9.9 kg\n \n 2022-07-05 06:30:03 UTC\n \n 2022-07-05 06:31:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1796\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${endDate}\n \n \n \n','2022-07-05 12:00:03',4,'2022-07-05 12:01:15',4,0,NULL,NULL,NULL,'d0682189-7d23-4c17-9648-ae39ea0f6916'),(1797,'Clients given 6E weighing 10-13.9 kg','Clients given 6E weighing 10-13.9 kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E weighing 10-13.9 kg\n Clients given 6E weighing 10-13.9 kg\n \n 2022-07-05 06:32:34 UTC\n \n 2022-07-05 06:34:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1797\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 12:02:34',4,'2022-07-05 12:04:30',4,0,NULL,NULL,NULL,'ad8a6b3c-88dd-4328-b042-076242f1ce54'),(1798,'Clients given 6E weighing 14-19.9 kg','Clients given 6E weighing 14-19.9 kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E weighing 14-19.9 kg\n Clients given 6E weighing 14-19.9 kg\n \n 2022-07-05 06:33:01 UTC\n \n 2022-07-05 06:34:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1798\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 12:03:01',4,'2022-07-05 12:04:51',4,0,NULL,NULL,NULL,'d58c1b55-d21c-497a-b201-c1f544c8264c'),(1799,'Clients given 6E weighing 20-24.9 kg','Clients given 6E weighing 20-24.9 kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E weighing 20-24.9 kg\n Clients given 6E weighing 20-24.9 kg\n \n 2022-07-05 06:33:24 UTC\n \n 2022-07-05 06:35:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1799\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 12:03:24',4,'2022-07-05 12:05:10',4,0,NULL,NULL,NULL,'e38de12c-6c72-4188-a8b7-b6d912e7baf2'),(1800,'Clients given 6E weighing 25-34.9 kg','Clients given 6E weighing 25-34.9 kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E weighing 25-34.9 kg\n Clients given 6E weighing 25-34.9 kg\n \n 2022-07-05 06:35:31 UTC\n \n 2022-07-05 06:37:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1800\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 12:05:31',4,'2022-07-05 12:07:03',4,0,NULL,NULL,NULL,'24def27b-738c-424e-b397-689a9fc28dd0'),(1801,'Clients given 6E weighing >= 35 kg','Clients given 6E weighing >= 35 kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E weighing >= 35 kg\n Clients given 6E weighing >= 35 kg\n \n 2022-07-05 06:35:59 UTC\n \n 2022-07-05 06:37:19 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1801\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 12:05:59',4,'2022-07-05 12:07:19',4,0,NULL,NULL,NULL,'bc732e0d-7aa7-412d-855c-76442487b9c9'),(1802,'Clients given 6F weighing 4-5.9kg','Clients given 6F weighing 4-5.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F weighing 4-5.9kg\n Clients given 6F weighing 4-5.9kg\n \n 2022-07-05 06:38:03 UTC\n \n 2022-07-05 06:42:09 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1802\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 12:08:03',4,'2022-07-05 12:12:09',4,0,NULL,NULL,NULL,'31aaf13e-0c70-472d-9d6f-8d288c6545d7'),(1803,'Clients given 6F weighing 0-3.9kg','Clients given 6F weighing 0-3.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F weighing 0-3.9kg\n Clients given 6F weighing 0-3.9kg\n \n 2022-07-05 06:38:38 UTC\n \n 2022-07-05 06:43:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1803\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 12:08:38',4,'2022-07-05 12:13:27',4,0,NULL,NULL,NULL,'ec58cc67-3866-4031-a385-d5f40bf5fa80'),(1804,'Clients given 6F weighing 6-9.9kg','Clients given 6F weighing 6-9.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F weighing 6-9.9kg\n Clients given 6F weighing 6-9.9kg\n \n 2022-07-05 06:40:34 UTC\n \n 2022-07-05 06:42:24 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1804\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${endDate}\n \n \n \n','2022-07-05 12:10:34',4,'2022-07-05 12:12:24',4,0,NULL,NULL,NULL,'ece7781b-8125-44f0-8189-6f4f66258b2c'),(1805,'Clients given 6F weighing 10-13.9kg','Clients given 6F weighing 10-13.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F weighing 10-13.9kg\n Clients given 6F weighing 10-13.9kg\n \n 2022-07-05 06:44:04 UTC\n \n 2022-07-05 06:47:25 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1805\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 12:14:04',4,'2022-07-05 12:17:25',4,0,NULL,NULL,NULL,'6cd6003e-fd2a-4acd-acbf-8025ed274332'),(1806,'Clients given 6F weighing 14-19.9kg','Clients given 6F weighing 14-19.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F weighing 14-19.9kg\n Clients given 6F weighing 14-19.9kg\n \n 2022-07-05 06:44:30 UTC\n \n 2022-07-05 06:50:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1806\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 12:14:30',4,'2022-07-05 12:20:01',4,0,NULL,NULL,NULL,'c465345e-8ab1-45d7-972a-d39b87dd1ade'),(1807,'Clients given 6F weighing 20-24.9kg','Clients given 6F weighing 20-24.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F weighing 20-24.9kg\n Clients given 6F weighing 20-24.9kg\n \n 2022-07-05 06:44:51 UTC\n \n 2022-07-05 06:46:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1807\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 12:14:51',4,'2022-07-05 12:16:42',4,0,NULL,NULL,NULL,'383ecc01-a8e6-42b4-83f3-eb9c2e48386b'),(1808,'Clients given 6F weighing 25-34.9kg','Clients given 6F weighing 25-34.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F weighing 25-34.9kg\n Clients given 6F weighing 25-34.9kg\n \n 2022-07-05 06:49:35 UTC\n \n 2022-07-05 06:54:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1808\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 12:19:35',4,'2022-07-05 12:24:29',4,0,NULL,NULL,NULL,'bacab6c2-b1d6-4a10-9f0d-ffb24844bae5'),(1809,'Clients given 6F weighing >= 35kg','Clients given 6F weighing >= 35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F weighing >= 35kg\n Clients given 6F weighing >= 35kg\n \n 2022-07-05 06:53:17 UTC\n \n 2022-07-05 06:56:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1809\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 12:23:17',4,'2022-07-05 12:26:41',4,0,NULL,NULL,NULL,'2614b81d-6441-4ee3-b4a7-a15f3ba36ace'),(1810,'Children ARV Regimen_2ndLine_2022','Children ARV Regimen_2ndLine','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_2022\n Children ARV Regimen_2ndLine\n \n 2022-07-06 07:16:05 UTC\n \n 2022-07-06 10:13:16 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1810\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2022-07-06 07:16:05',4,'2022-07-06 10:13:16',4,0,NULL,NULL,NULL,'dffce2c4-7adc-497e-8216-fa138d0201b1'),(1811,'Children ARV Regimen_2ndLine Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine Data Set\n \n 2022-07-06 07:16:44 UTC\n \n 2022-07-06 10:11:25 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1811\n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n 5A0to3.9\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Age\n Children 0to14\n \n \n \n \n \n 5A10to13.9\n \n \n \n \n \n \n \n \n \n 5A14to19.9\n \n \n \n \n \n \n \n \n \n 5A20to24.9\n \n \n \n \n \n \n \n \n \n 5A25to34.9\n \n \n \n \n \n \n \n \n \n 5A35plus\n \n \n \n \n \n \n \n \n \n 5A4to5.9\n \n \n \n \n \n \n \n \n \n 5A6to9.9\n \n \n \n \n \n \n \n \n \n 5B0to3.9\n \n \n \n \n \n \n \n \n \n 5B10to13.9\n \n \n \n \n \n \n \n \n \n 5B14to19.9\n \n \n \n \n \n \n \n \n \n 5B20to24.9\n \n \n \n \n \n \n \n \n \n 5B25to34.9\n \n \n \n \n \n \n \n \n \n 5B35plus\n \n \n \n \n \n \n \n \n \n 5B4to5.9\n \n \n \n \n \n \n \n \n \n 5B6to9.9\n \n \n \n \n \n \n \n \n \n 5C0to3.9\n \n \n \n \n \n \n \n \n \n 5C10to13.9\n \n \n \n \n \n \n \n \n \n 5C14to19.9\n \n \n \n \n \n \n \n \n \n 5C20to24.9\n \n \n \n \n \n \n \n \n \n 5C25to34.9\n \n \n \n \n \n \n \n \n \n 5C35plus\n \n \n \n \n \n \n \n \n \n 5C4to5.9\n \n \n \n \n \n \n \n \n \n 5C6to9.9\n \n \n \n \n \n \n \n \n \n 5D0to3.9\n \n \n \n \n \n \n \n \n \n 5D10to13.9\n \n \n \n \n \n \n \n \n \n 5D14to19.9\n \n \n \n \n \n \n \n \n \n 5D20to24.9\n \n \n \n \n \n \n \n \n \n 5D25to34.9\n \n \n \n \n \n \n \n \n \n 5D35plus\n \n \n \n \n \n \n \n \n \n 5D4to5.9\n \n \n \n \n \n \n \n \n \n 5D6to9.9\n \n \n \n \n \n \n \n \n \n 5E0to3.9\n \n \n \n \n \n \n \n \n \n 5E10to13.9\n \n \n \n \n \n \n \n \n \n 5E14to19.9\n \n \n \n \n \n \n \n \n \n 5E20to24.9\n \n \n \n \n \n \n \n \n \n 5E25to34.9\n \n \n \n \n \n \n \n \n \n 5E35plus\n \n \n \n \n \n \n \n \n \n 5E4to5.9\n \n \n \n \n \n \n \n \n \n 5E6to9.9\n \n \n \n \n \n \n \n \n \n 5F0to3.9\n \n \n \n \n \n \n \n \n \n 5F10to13.9\n \n \n \n \n \n \n \n \n \n 5F14to19.9\n \n \n \n \n \n \n 5F20to24.9\n \n \n \n \n \n \n \n \n \n 5F25to34.9\n \n \n \n \n \n \n \n \n \n 5F35plus\n \n \n \n \n \n \n \n \n \n 5F4to5.9\n \n \n \n \n \n \n \n \n \n 5F6to9.9\n \n \n \n \n \n \n \n \n \n 5G0to3.9\n \n \n \n \n \n \n \n \n \n 5G10to13.9\n \n \n \n \n \n \n \n \n \n 5G14to19.9\n \n \n \n \n \n \n \n \n \n 5G20to24.9\n \n \n \n \n \n \n \n \n \n 5G25to34.9\n \n \n \n \n \n \n \n \n \n 5G35plus\n \n \n \n \n \n \n \n \n \n 5G4to5.9\n \n \n \n \n \n \n \n \n \n 5G6to9.9\n \n \n \n \n \n \n \n \n \n 5H0to3.9\n \n \n \n \n \n \n \n \n \n 5H10to13.9\n \n \n \n \n \n \n \n \n \n 5H14to19.9\n \n \n \n \n \n \n \n \n \n 5H20to24.9\n \n \n \n \n \n \n \n \n \n 5H25to34.9\n \n \n \n \n \n \n \n \n \n 5H35plus\n \n \n \n \n \n \n \n \n \n 5H4to5.9\n \n \n \n \n \n \n \n \n \n 5H6to9.9\n \n \n \n \n \n \n \n \n \n','2022-07-06 07:16:44',4,'2022-07-06 10:11:25',4,0,NULL,NULL,NULL,'437a2414-1894-4eb5-8c13-356a8e2aa747'),(1812,'Children ARV Regimen_3rdLine_2022','Children ARV Regimen_3rdLine','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_2022\n Children ARV Regimen_3rdLine\n \n 2022-07-06 10:16:11 UTC\n \n 2022-07-06 10:16:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1812\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2022-07-06 10:16:11',4,'2022-07-06 10:16:23',4,0,NULL,NULL,NULL,'b6b0cf68-1305-49a2-8f43-30f3f175958d'),(1813,'Children ARV Regimen_3rdLine_2022 Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_2022 Data Set\n \n 2022-07-06 10:16:23 UTC\n \n 2022-07-06 14:44:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1813\n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n 6A0to3.9\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Age\n Children 0to14\n \n \n \n \n \n 6A10to13.9\n \n \n \n \n \n \n \n \n \n 6A14to19.9\n \n \n \n \n \n \n \n \n \n 6A20to24.9\n \n \n \n \n \n \n \n \n \n 6A25to34.9\n \n \n \n \n \n \n \n \n \n 6A35plus\n \n \n \n \n \n \n \n \n \n 6A4to5.9\n \n \n \n \n \n \n \n \n \n 6A6to9.9\n \n \n \n \n \n \n \n \n \n 6B0to3.9\n \n \n \n \n \n \n \n \n \n 6B10to13.9\n \n \n \n \n \n \n \n \n \n 6B14to19.9\n \n \n \n \n \n \n \n \n \n 6B20to24.9\n \n \n \n \n \n \n \n \n \n 6B25to34.9\n \n \n \n \n \n \n \n \n \n 6B35plus\n \n \n \n \n \n \n \n \n \n 6B4to5.9\n \n \n \n \n \n \n \n \n \n 6B6to9.9\n \n \n \n \n \n \n \n \n \n 6C0to3.9\n \n \n \n \n \n \n \n \n \n 6C10to13.9\n \n \n \n \n \n \n \n \n \n 6C14to19.9\n \n \n \n \n \n \n \n \n \n 6C20to24.9\n \n \n \n \n \n \n \n \n \n 6C25to34.9\n \n \n \n \n \n \n \n \n \n 6C35plus\n \n \n \n \n \n \n \n \n \n 6C4to5.9\n \n \n \n \n \n \n \n \n \n 6C6to9.9\n \n \n \n \n \n \n \n \n \n 6D0to3.9\n \n \n \n \n \n \n \n \n \n 6D10to13.9\n \n \n \n \n \n \n \n \n \n 6D14to19.9\n \n \n \n \n \n \n \n \n \n 6D20to24.9\n \n \n \n \n \n \n \n \n \n 6D25to34.9\n \n \n \n \n \n \n \n \n \n 6D35plus\n \n \n \n \n \n \n \n \n \n 6D4to5.9\n \n \n \n \n \n \n \n \n \n 6D6to9.9\n \n \n \n \n \n \n \n \n \n 6E0to3.9\n \n \n \n \n \n \n \n \n \n 6E10to13.9\n \n \n \n \n \n \n \n \n \n 6E14to19.9\n \n \n \n \n \n \n \n \n \n 6E20to24.9\n \n \n \n \n \n \n \n \n \n 6E25to34.9\n \n \n \n \n \n \n \n \n \n 6E35plus\n \n \n \n \n \n \n \n \n \n 6E4to5.9\n \n \n \n \n \n \n \n \n \n 6E6to9.9\n \n \n \n \n \n \n \n \n \n 6F0to3.9\n \n \n \n \n \n \n \n \n \n 6F10to13.9\n \n \n \n \n \n \n \n \n \n 6F14to19.9\n \n \n \n \n \n \n \n \n \n 6F20to24.9\n \n \n \n \n \n \n \n \n \n 6F25to34.9\n \n \n \n \n \n \n \n \n \n 6F35plus\n \n \n \n \n \n \n \n \n \n 6F4to5.9\n \n \n \n \n \n \n \n \n \n 6F6to9.9\n \n \n \n \n \n \n \n \n \n','2022-07-06 10:16:23',4,'2022-07-06 14:44:30',4,0,NULL,NULL,NULL,'3fa2b422-d556-4710-bfd7-bc8a5b0c9c0b'),(1814,'TX_ML-06 Clients who are current on ART at reporting period and experienced IIT_3-5 months','TX_ML-06 Clients who are current on ART at reporting period and experienced IIT_3-5 months','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TX_ML-06 Clients who are current on ART at reporting period and experienced IIT_3-5 months\n TX_ML-06 Clients who are current on ART at reporting period and experienced IIT_3-5 months\n \n 2022-08-10 11:03:51 UTC\n \n 2024-02-15 09:03:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1814\n select obs_ml_clients.person_id \nfrom obs os \ninner join location l on os.location_id = l.location_id \ninner join \n( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND patient.voided = 0 AND o.voided = 0 \n AND o.person_id in ( \n select person_id \n from \n (select oss.person_id, MAX(oss.obs_datetime) as max_observation, SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_datetime)), 20) AS latest_follow_up \n from obs oss \n inner join person p on oss.person_id=p.person_id and oss.concept_id = 3752 and oss.voided=0 \n and oss.obs_datetime < cast(:startDate as DATE) \n group by p.person_id \n having datediff(CAST(DATE_ADD(CAST(:startDate AS DATE), INTERVAL -1 DAY) AS DATE), latest_follow_up) < 29) as On_ART_Beginning_Quarter \n ) \n AND o.person_id in ( \n select person_id \n from \n (select oss.person_id, MAX(oss.obs_datetime) as max_observation, SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_datetime)), 20) AS latest_follow_up \n from obs oss \n inner join person p on oss.person_id=p.person_id and oss.concept_id = 3752 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as DATE) \n group by p.person_id \n having datediff(CAST(:endDate AS DATE), latest_follow_up) > 28) as Missed_Greater_Than_28Days \n ) \n INNER JOIN patient_identifier ON patient_identifier.patient_id = patient.patient_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n group by patient.patient_id \n UNION \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND patient.voided = 0 AND o.voided = 0 \n AND o.concept_id = 2249 and cast(o.value_datetime as date) >= cast(:startDate as DATE) and cast(o.value_datetime as date) <= cast(:endDate as DATE) \n AND o.person_id in ( \n select person_id \n from \n (select oss.person_id, MAX(oss.obs_datetime) as max_observation, SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_datetime)), 20) AS latest_follow_up \n from obs oss \n inner join person p on oss.person_id=p.person_id and oss.concept_id = 3752 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as DATE) \n group by p.person_id \n having datediff(CAST(:endDate AS DATE), latest_follow_up) > 28) as Missed_Greater_Than_28Days \n ) \n INNER JOIN patient_identifier ON patient_identifier.patient_id = patient.patient_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n group by patient.patient_id \n) as obs_ml_clients on os.person_id = obs_ml_clients.person_id \nINNER JOIN person ON person.person_id = obs_ml_clients.person_id AND person.voided = 0 \nINNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \nWHERE os.location_id =:location or parent_location =:location \n -- INITIATED ON ART BETWEEN 3 AND 5 MONTHS AGO \n AND obs_ml_clients.person_id in ( \n select distinct os.person_id \n from obs os \n where os.concept_id = 2249 \n AND datediff(CAST(:endDate AS DATE), os.value_datetime) BETWEEN 89 AND 180 \n ) \n -- NOT Transfered Out to Another Site \n AND obs_ml_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where os.concept_id = 4155 and os.value_coded = 2146 \n AND os.obs_datetime <= CAST(:endDate AS DATE) \n ) \n -- NOT DEAD \n AND obs_ml_clients.person_id not in ( \n select person_id \n from person \n where death_date <= CAST(:endDate AS DATE) \n and dead = 1 \n ) \nAND obs_ml_clients.person_id not in ( \n -- Visitors \n select o.person_id \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as examination_timing \n from obs oss \n where oss.concept_id = 3753 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where concept_id = 5416 \n and o.value_coded =1 and o.voided=0 \n and cast(o.obs_datetime as date) = cast(max_observation as date) \n )\n','2022-08-10 16:33:51',4,'2024-02-15 14:33:32',4,0,NULL,NULL,NULL,'e2a2e29e-040a-45b1-902d-fa25074d52a1'),(1815,'CI63:TxML IIT3-5','TxML IIT3-5','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CI63:TxML IIT3-5\n TxML IIT3-5\n \n 2022-08-10 11:07:17 UTC\n \n 2022-08-10 11:08:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1815\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-08-10 11:07:17',4,'2022-08-10 11:08:59',4,0,NULL,NULL,NULL,'781f34cd-9cce-41ef-acbe-b89b0e1257e4'),(1816,'TX_RTT-02 Clients with IIT for < 3 months in previous period who restarted ARV\'s during current period','TX_RTT-02 Clients with IIT for < 3 months in previous period who restarted ARV\'s during current period','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TX_RTT-02 Clients with IIT for < 3 months in previous period who restarted ARV's during current period\n TX_RTT-02 Clients with IIT for < 3 months in previous period who restarted ARV's during current period\n \n 2022-08-23 16:34:31 UTC\n \n 2024-02-15 08:22:47 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1816\n select distinct o.person_id \nfrom obs o \n-- PATIENTS WITH NO CLINICAL CONTACT OR ARV PICK-UP FOR GREATER THAN 28 DAYS \n-- SINCE THEIR LAST EXPECTED CONTACT WHO RESTARTED ARVs WITHIN THE REPORTING PERIOD \ninner join location l on o.location_id = l.location_id \nINNER JOIN patient ON o.person_id = patient.patient_id \nAND patient.voided = 0 AND o.voided = 0 \nAND o.person_id in ( \n select person_id \n from \n (select oss.person_id, MAX(oss.obs_datetime) as max_observation, SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_datetime)), 20) AS latest_follow_up \n from obs oss \n inner join person p on oss.person_id=p.person_id and oss.concept_id = 3752 and oss.voided=0 \n and oss.obs_datetime < cast(:startDate as DATE) \n group by p.person_id \n having datediff(CAST(DATE_ADD(CAST(:startDate AS DATE), INTERVAL -1 DAY) AS DATE), latest_follow_up) BETWEEN 29 and 90) as Missed_Greater_Than_28Days \n ) \n \n -- Client Seen: As either patient OR Treatment Buddy \n AND ( \n o.person_id in ( \n select distinct os.person_id \n from obs os \n where (os.concept_id = 3843 AND os.value_coded = 3841 OR os.value_coded = 3842) \n AND os.obs_datetime BETWEEN CAST(:startDate AS DATE) AND CAST(:endDate AS DATE) \n ) \n \n -- Client Seen and Date Restarted picked \n OR o.person_id in ( \n select distinct os.person_id \n from obs os \n where os.concept_id = 3708 AND os.value_datetime BETWEEN CAST(:startDate AS DATE) AND CAST(:endDate AS DATE) \n ) \n ) \n -- Still on treatment at the end of the reporting period \n AND o.person_id in ( \n select person_id \n from \n (select oss.person_id, MAX(oss.obs_datetime) as max_observation, SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_datetime)), 20) AS latest_follow_up \n from obs oss \n inner join person p on oss.person_id=p.person_id and oss.concept_id = 3752 and oss.voided=0 \n and oss.obs_datetime >= cast(:startDate as DATE) and oss.obs_datetime <= cast(:endDate as DATE) \n group by p.person_id \n having datediff(CAST(:endDate AS DATE), latest_follow_up) <= 28) as Still_On_Treatment_End_Period \n ) \n \n -- Transfered Out to Another Site during their latest encounter before the start date \n AND o.person_id not in ( \n select person_id \n from \n (select oss.person_id, MAX(oss.obs_datetime) as max_observation, SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) AS last_obs_tout \n from obs oss \n inner join person p on oss.person_id=p.person_id and oss.concept_id = 4155 and oss.voided=0 \n and oss.obs_datetime < cast(:startDate as DATE) \n group by p.person_id \n having last_obs_tout = 2146) as Transfered_Out_In_Last_Encounter \n ) \n \n-- NOT Transfered In from another Site \n AND o.person_id not in ( \n select os.person_id \n from obs os \n where (os.concept_id = 2253 AND DATE(os.value_datetime) BETWEEN CAST(:startDate AS DATE) AND CAST(:endDate AS DATE)) \n AND os.voided = 0 \n ) \n \n AND o.person_id not in ( \n select person_id \n from person \n where death_date <= CAST(:endDate AS DATE) \n and dead = 1 \n ) \n AND o.person_id not in ( \n -- Visitors \n select o.person_id \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as examination_timing \n from obs oss \n where oss.concept_id = 3753 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where concept_id = 5416 \n and o.value_coded =1 and o.voided=0 \n and cast(o.obs_datetime as date) = cast(max_observation as date) \n) \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \nWHERE (o.location_id =:location or parent_location =:location)\n','2022-08-23 22:04:31',4,'2024-02-15 13:52:47',4,0,NULL,NULL,NULL,'505841df-fa38-436c-8463-8a437f536b69'),(1817,'TX_RTT-03 Clients with IIT for 3-5 months in previous period who restarted ARV\'s during current period','TX_RTT-03 Clients with IIT for 3-5 months in previous period who restarted ARV\'s during current period','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TX_RTT-03 Clients with IIT for 3-5 months in previous period who restarted ARV's during current period\n TX_RTT-03 Clients with IIT for 3-5 months in previous period who restarted ARV's during current period\n \n 2022-08-23 16:42:57 UTC\n \n 2024-02-15 08:26:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1817\n select distinct o.person_id \nfrom obs o \n-- PATIENTS WITH NO CLINICAL CONTACT OR ARV PICK-UP FOR GREATER THAN 28 DAYS \n-- SINCE THEIR LAST EXPECTED CONTACT WHO RESTARTED ARVs WITHIN THE REPORTING PERIOD \ninner join location l on o.location_id = l.location_id \nINNER JOIN patient ON o.person_id = patient.patient_id \nAND patient.voided = 0 AND o.voided = 0 \nAND o.person_id in ( \n select person_id \n from \n (select oss.person_id, MAX(oss.obs_datetime) as max_observation, SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_datetime)), 20) AS latest_follow_up \n from obs oss \n inner join person p on oss.person_id=p.person_id and oss.concept_id = 3752 and oss.voided=0 \n and oss.obs_datetime < cast(:startDate as DATE) \n group by p.person_id \n having datediff(CAST(DATE_ADD(CAST(:startDate AS DATE), INTERVAL -1 DAY) AS DATE), latest_follow_up) BETWEEN 89 and 180) as Missed_Between_89_and_180Days \n ) \n \n -- Client Seen: As either patient OR Treatment Buddy \n AND ( \n o.person_id in ( \n select distinct os.person_id \n from obs os \n where (os.concept_id = 3843 AND os.value_coded = 3841 OR os.value_coded = 3842) \n AND os.obs_datetime BETWEEN CAST(:startDate AS DATE) AND CAST(:endDate AS DATE) \n ) \n \n -- Client Seen and Date Restarted picked \n OR o.person_id in ( \n select distinct os.person_id \n from obs os \n where os.concept_id = 3708 AND os.value_datetime BETWEEN CAST(:startDate AS DATE) AND CAST(:endDate AS DATE) \n ) \n ) \n -- Still on treatment at the end of the reporting period \n AND o.person_id in ( \n select person_id \n from \n (select oss.person_id, MAX(oss.obs_datetime) as max_observation, SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_datetime)), 20) AS latest_follow_up \n from obs oss \n inner join person p on oss.person_id=p.person_id and oss.concept_id = 3752 and oss.voided=0 \n and oss.obs_datetime >= cast(:startDate as DATE) and oss.obs_datetime <= cast(:endDate as DATE) \n group by p.person_id \n having datediff(CAST(:endDate AS DATE), latest_follow_up) <= 28) as Still_On_Treatment_End_Period \n ) \n \n -- Transfered Out to Another Site during their latest encounter before the start date \n AND o.person_id not in ( \n select person_id \n from \n (select oss.person_id, MAX(oss.obs_datetime) as max_observation, SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) AS last_obs_tout \n from obs oss \n inner join person p on oss.person_id=p.person_id and oss.concept_id = 4155 and oss.voided=0 \n and oss.obs_datetime < cast(:startDate as DATE) \n group by p.person_id \n having last_obs_tout = 2146) as Transfered_Out_In_Last_Encounter \n ) \n \n-- NOT Transfered In from another Site \n AND o.person_id not in ( \n select os.person_id \n from obs os \n where (os.concept_id = 2253 AND DATE(os.value_datetime) BETWEEN CAST(:startDate AS DATE) AND CAST(:endDate AS DATE)) \n AND os.voided = 0 \n ) \n \n AND o.person_id not in ( \n select person_id \n from person \n where death_date <= CAST(:endDate AS DATE) \n and dead = 1 \n ) \n AND o.person_id not in ( \n -- Visitors \n select o.person_id \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as examination_timing \n from obs oss \n where oss.concept_id = 3753 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where concept_id = 5416 \n and o.value_coded =1 and o.voided=0 \n and cast(o.obs_datetime as date) = cast(max_observation as date) \n ) \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \nWHERE (o.location_id =:location or parent_location =:location)\n','2022-08-23 22:12:57',4,'2024-02-15 13:56:51',4,0,NULL,NULL,NULL,'129f5049-8d6d-4cd9-8922-7cf72b623ab3'),(1818,' TX_RTT-04 Clients with IIT for >6 months in previous period who restarted ARV\'s during current period',' TX_RTT-04 Clients with IIT for >6 months in previous period who restarted ARV\'s during current period','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TX_RTT-04 Clients with IIT for >6 months in previous period who restarted ARV's during current period\n TX_RTT-04 Clients with IIT for >6 months in previous period who restarted ARV's during current period\n \n 2022-08-23 16:45:46 UTC\n \n 2024-02-15 08:42:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n endDateAS\n \n java.util.Date\n true\n \n \n 1818\n select distinct o.person_id \nfrom obs o \n-- PATIENTS WITH NO CLINICAL CONTACT OR ARV PICK-UP FOR GREATER THAN 28 DAYS \n-- SINCE THEIR LAST EXPECTED CONTACT WHO RESTARTED ARVs WITHIN THE REPORTING PERIOD \ninner join location l on o.location_id = l.location_id \nINNER JOIN patient ON o.person_id = patient.patient_id \nAND patient.voided = 0 AND o.voided = 0 \nAND o.person_id in ( \n select person_id \n from \n (select oss.person_id, MAX(oss.obs_datetime) as max_observation, SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_datetime)), 20) AS latest_follow_up \n from obs oss \n inner join person p on oss.person_id=p.person_id and oss.concept_id = 3752 and oss.voided=0 \n and oss.obs_datetime < cast(:startDate as DATE) \n group by p.person_id \n having datediff(CAST(DATE_ADD(CAST(:startDate AS DATE), INTERVAL -1 DAY) AS DATE), latest_follow_up) >= 180) as Missed_Greater_than_180Days \n ) \n \n -- Client Seen: As either patient OR Treatment Buddy \n AND ( \n o.person_id in ( \n select distinct os.person_id \n from obs os \n where (os.concept_id = 3843 AND os.value_coded = 3841 OR os.value_coded = 3842) \n AND os.obs_datetime BETWEEN CAST(:startDate AS DATE) AND CAST(:endDate AS DATE) \n ) \n \n -- Client Seen and Date Restarted picked \n OR o.person_id in ( \n select distinct os.person_id \n from obs os \n where os.concept_id = 3708 AND os.value_datetime BETWEEN CAST(:startDate AS DATE) AND CAST(:endDate AS DATE) \n ) \n ) \n -- Still on treatment at the end of the reporting period \n AND o.person_id in ( \n select person_id \n from \n (select oss.person_id, MAX(oss.obs_datetime) as max_observation, SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_datetime)), 20) AS latest_follow_up \n from obs oss \n inner join person p on oss.person_id=p.person_id and oss.concept_id = 3752 and oss.voided=0 \n and oss.obs_datetime >= cast(:startDate as DATE) and oss.obs_datetime <= cast(:endDate as DATE) \n group by p.person_id \n having datediff(CAST(:endDate AS DATE), latest_follow_up) <= 28) as Still_On_Treatment_End_Period \n ) \n \n -- Transfered Out to Another Site during their latest encounter before the start date \n AND o.person_id not in ( \n select person_id \n from \n (select oss.person_id, MAX(oss.obs_datetime) as max_observation, SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) AS last_obs_tout \n from obs oss \n inner join person p on oss.person_id=p.person_id and oss.concept_id = 4155 and oss.voided=0 \n and oss.obs_datetime < cast(:startDate as DATE) \n group by p.person_id \n having last_obs_tout = 2146) as Transfered_Out_In_Last_Encounter \n ) \n \n-- NOT Transfered In from another Site \n AND o.person_id not in ( \n select os.person_id \n from obs os \n where (os.concept_id = 2253 AND DATE(os.value_datetime) BETWEEN CAST(:startDate AS DATE) AND CAST(:endDate AS DATE)) \n AND os.voided = 0 \n ) \n \n AND o.person_id not in ( \n select person_id \n from person \n where death_date <= CAST(:endDate AS DATE) \n and dead = 1 \n ) \n AND o.person_id not in ( \n -- Visitors \n select o.person_id \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as examination_timing \n from obs oss \n where oss.concept_id = 3753 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where concept_id = 5416 \n and o.value_coded =1 and o.voided=0 \n and cast(o.obs_datetime as date) = cast(max_observation as date) \n ) \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \nWHERE (o.location_id =:location or parent_location =:location)\n','2022-08-23 22:15:46',4,'2024-02-15 14:12:31',4,0,NULL,NULL,NULL,'afc2a5d5-53e4-427a-9491-b3b1609bbe69'),(1819,'CI64:TxRTT IIT<3months','CI64:TxRTT IIT<3months','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CI64:TxRTT IIT<3months\n CI64:TxRTT IIT<3months\n \n 2022-08-24 07:46:14 UTC\n \n 2022-08-24 07:47:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1819\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-08-24 07:46:14',4,'2022-08-24 07:47:14',4,0,NULL,NULL,NULL,'6c4e2daf-e83f-4899-98f5-203f33ee4827'),(1820,'CI65:TxRTT IIT_3-5months','CI65:TxRTT IIT_3-5months','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CI65:TxRTT IIT_3-5months\n CI65:TxRTT IIT_3-5months\n \n 2022-08-24 07:47:56 UTC\n \n 2022-08-24 07:48:48 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1820\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-08-24 07:47:56',4,'2022-08-24 07:48:48',4,0,NULL,NULL,NULL,'714af509-9ade-48b5-b6f0-10d7499a6f15'),(1821,'CI66:TxRTT IIT_6+months','CI66:TxRTT IIT_6+months','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CI66:TxRTT IIT_6+months\n CI66:TxRTT IIT_6+months\n \n 2022-08-24 07:49:18 UTC\n \n 2022-08-24 07:49:56 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1821\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-08-24 07:49:18',4,'2022-08-24 07:49:56',4,0,NULL,NULL,NULL,'271261f4-75c6-4c64-a6f0-7be2d40c33c3'),(1822,'Pulmonary Bacteriologically Confirmed New','New Pulmonary Bacteriologically Confirmed clients','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Pulmonary Bacteriologically Confirmed New\n New Pulmonary Bacteriologically Confirmed clients\n \n 2023-03-27 10:50:04 UTC\n \n 2023-03-29 16:41:33 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1822\n select distinct o.person_id \n \n from obs o \ninner join location l on o.location_id = l.location_id \n \n -- Relapsed TB Client \nWHERE (o.location_id =:location or parent_location =:location) \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n -- TB Start Date \n where ob.concept_id = 2237 \n and ob.value_datetime >= :startDate \n and ob.value_datetime <= :endDate \n and ob.voided = 0 \n ) \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- New Clients \n select distinct person_id \n from obs \n where concept_id = 3785 and value_coded = 1034 \n and obs_datetime >= :startDate \n and obs_datetime <= :endDate \n ) \n ) \n \n \n AND o.person_id not in ( \n select distinct os.person_id \n from obs os \n -- Patient must not be a tranfer in \n where os.concept_id = 3772 and os.value_coded =2095 \n AND (os.obs_datetime BETWEEN :startDate AND :endDate) \n AND os.voided = 0 \n )\n','2023-03-27 12:50:04',4,'2023-03-29 18:41:33',4,0,NULL,NULL,NULL,'5ab3fc4d-0d1e-4a30-b0c7-d35c68f7f19a'),(1823,'NewRelapse_Tb_Treatment_History','Tb Treatment History - New and Relapse Patients','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n NewRelapse_Tb_Treatment_History\n Tb Treatment History - New and Relapse Patients\n \n 2023-03-27 11:51:48 UTC\n \n 2023-03-27 20:29:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1823\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in( \nSELECT Id \nFROM \n((SELECT distinct Id, patientIdentifier AS "Patient_Identifier", patientName AS "Patient_Name", Age , Gender, age_group, 'New Patient' AS 'TB_Treatment_History' \n FROM \n \n (select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n person.gender AS Gender, \n observed_age_group.name AS age_group, \n observed_age_group.sort_order AS sort_order \n \n from obs o \n -- New TB Patient \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n -- TB Start Date \n where ob.concept_id = 2237 \n and ob.value_datetime >= CAST(:startDate AS DATE) \n and ob.value_datetime <= CAST(:endDate AS DATE) \n and ob.voided = 0 \n ) \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- New Clients \n select distinct person_id \n from obs \n where concept_id = 3785 and value_coded = 1034 \n and obs_datetime >= CAST(:startDate AS DATE) \n and obs_datetime <= CAST(:endDate AS DATE) \n ) \n ) \n \n \n AND o.person_id not in ( \n select distinct os.person_id \n from obs os \n -- Patient must not be a tranfer in \n where os.concept_id = 3772 and os.value_coded =2095 \n AND (os.obs_datetime BETWEEN CAST(:startDate AS DATE) AND CAST(:endDate AS DATE)) \n AND patient.voided = 0 AND os.voided = 0 \n ) \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages') AS NEW_TB_CLIENTS \n ORDER BY NEW_TB_CLIENTS.Age) \n \n \n UNION \n \n (SELECT distinct Id, patientIdentifier AS "Patient_Identifier", patientName AS "Patient_Name", Age , Gender, age_group, 'Relapsed Patient' AS 'TB_Treatment_History' \n FROM \n (select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n person.gender AS Gender, \n observed_age_group.name AS age_group, \n observed_age_group.sort_order AS sort_order \n \n from obs o \n -- Relapsed TB Client \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n -- TB Start Date \n where ob.concept_id = 2237 \n and ob.value_datetime >= CAST(:startDate AS DATE) \n and ob.value_datetime <= CAST(:endDate AS DATE) \n ) \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- Relapsed Clients \n select distinct person_id \n from obs \n where concept_id = 3785 and value_coded = 1084 \n and ob.value_datetime >= CAST(:startDate AS DATE) \n and ob.value_datetime <= CAST(:endDate AS DATE) \n ) \n ) \n \n \n \n AND o.person_id not in ( \n select distinct os.person_id \n from obs os \n -- Client must not be a transfer in \n where os.concept_id = 3772 and os.value_coded =2095 \n AND os.obs_datetime >= CAST(:startDate AS DATE) \n and os.obs_datetime <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND os.voided = 0 \n ) \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages') AS RELAPSE_TB_CLIENTS \n ORDER BY RELAPSE_TB_CLIENTS.Age) \n) AS NewRelapsed)\n','2023-03-27 17:21:48',4,'2023-03-28 01:59:53',4,0,NULL,NULL,NULL,'7f8a23bd-eec0-40a6-8181-cda3d0aab0bd'),(1824,'Pulmonary Bacteriologically Confirmed Relapse','Pulmonary Bacteriologically Confirmed Relapse','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Pulmonary Bacteriologically Confirmed Relapse\n Pulmonary Bacteriologically Confirmed Relapse\n \n 2023-03-27 12:10:01 UTC\n \n 2023-03-29 16:45:37 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1824\n select o.person_id \n from obs o \ninner join location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \nWHERE (o.location_id =:location or parent_location =:location) \nAND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n -- TB Start Date \n where ob.concept_id = 2237 \n and ob.value_datetime >= :startDate \n and ob.value_datetime <= :endDate \n ) \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- Relapsed Clients \n select distinct person_id \n from obs \n where concept_id = 3785 and value_coded = 1084 \n and ob.value_datetime >= :startDate \n and ob.value_datetime <= :endDate \n ) \n ) \n \n \n \n AND o.person_id not in ( \n select distinct os.person_id \n from obs os \n -- Client must not be a transfer in \n where os.concept_id = 3772 and os.value_coded =2095 \n AND os.obs_datetime >= :startDate \n and os.obs_datetime <= :endDate \n AND patient.voided = 0 AND os.voided = 0 \n )\n','2023-03-27 14:10:01',4,'2023-03-29 18:45:37',4,0,NULL,NULL,NULL,'e495a330-c538-4fa2-9279-e0c03ec69b51'),(1825,'Pulmonary Bacteriologically Confirmed Excluding Relapse','Pulmonary Bacteriologically Confirmed Excluding Relapse','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Pulmonary Bacteriologically Confirmed Excluding Relapse\n Pulmonary Bacteriologically Confirmed Excluding Relapse\n \n 2023-03-27 17:01:52 UTC\n \n 2023-03-29 16:38:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1825\n select distinct o.person_id \n from obs o \ninner join location l on o.location_id = l.location_id \n \n -- Relapsed TB Client \nWHERE (o.location_id =:location or parent_location =:location) \n AND o.concept_id = 3785 and o.value_coded in (3786,1037) \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n -- TB Start Date \n where ob.concept_id = 2237 \n and ob.value_datetime >= :startDate \n and ob.value_datetime <= :endDate \n ) \n \n AND o.person_id not in ( \n select distinct os.person_id \n from obs os \n -- Client must not be a transfer in \n where os.concept_id = 3772 and os.value_coded = 3786 \n AND os.obs_datetime >= :startDate \n and os.obs_datetime <= :endDate \n AND os.voided = 0) \n\n','2023-03-27 19:01:52',4,'2023-03-29 18:38:41',4,0,NULL,NULL,NULL,'23ba6606-91b7-4f7c-9142-73d6a43769a3'),(1826,'New and Relapse with document HIV Status','New and Relapse patients with document HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n New and Relapse with document HIV Status\n New and Relapse patients with document HIV Status\n \n 2023-03-27 19:38:11 UTC\n \n 2023-03-27 21:21:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1826\n SELECT DISTINCT o.person_id \n from obs o \n -- New and Relapse with Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3785 and ob.value_coded in (1034, 1084) -- New and Relapse \n and ob.voided = 0 \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE)\n','2023-03-28 01:08:11',4,'2023-03-28 02:51:39',4,0,NULL,NULL,NULL,'ee4e2170-5dd7-423e-bc84-f0c13c3a9b4f'),(1827,'Retreatment with documented HIV status','Retreatment Excl. Relapse client with documented HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Retreatment with documented HIV status\n Retreatment Excl. Relapse client with documented HIV Status\n \n 2023-03-27 19:50:19 UTC\n \n 2023-03-27 19:53:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1827\n SELECT DISTINCT o.person_id \n from obs o \n -- New and Relapse with Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3785 and ob.value_coded in (3786, 1037) -- Retreatmentafter LTFU/Failure \n and ob.voided = 0 \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 01:20:19',4,'2023-03-28 01:23:28',4,0,NULL,NULL,NULL,'17edcc8f-3d38-49dd-a6f4-a5384cdb7245'),(1828,'Children < 15 with Documented HIV Status','Children (0 - 14) with documented HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children < 15 with Documented HIV Status\n Children (0 - 14) with documented HIV Status\n \n 2023-03-27 20:10:47 UTC\n \n 2023-03-27 20:11:20 UTC\n \n \n endDate\n \n java.util.Date\n true\n \n \n startDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1828\n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Documented HIV, Status \n inner join location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 \n AND o.voided = 0 \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n having Age < 15\n','2023-03-28 01:40:47',4,'2023-03-28 01:41:20',4,0,NULL,NULL,NULL,'ca5b1d37-8229-474d-8125-2486520685fd'),(1829,'Pulmonary Clinically Diagnosed New','Pulmonary Clinically Diagnosed New','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Pulmonary Clinically Diagnosed New\n Pulmonary Clinically Diagnosed New\n \n 2023-03-27 20:39:34 UTC\n \n 2023-03-28 08:18:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1829\n select distinct o.person_id \n FROM obs o \ninner join location l on o.location_id = l.location_id \n -- Clinical Diagnosis X-Ray \n and o.concept_id = 4673 and o.value_coded = 4171 \nAND o.person_id in ( \nselect o.person_id from obs o \nwhere o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n -- TB Start Date \n where ob.concept_id = 2237 \n and ob.value_datetime >= :startDate \n and ob.value_datetime <= :endDate \n and ob.voided = 0 \n ) \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- New Clients \n select distinct person_id \n from obs \n where concept_id = 3785 and value_coded = 1034 \n and obs_datetime >= :startDate \n and obs_datetime <= :endDate \n ) \n ) \n \n \n AND o.person_id not in ( \n select distinct os.person_id \n from obs os \n -- Patient must not be a tranfer in \n where os.concept_id = 3772 and os.value_coded =2095 \n AND (os.obs_datetime BETWEEN :startDate AND :endDate) \n and os.voided = 0 \n ) \n \n) \n and o.obs_datetime >= :startDate \n and o.obs_datetime <= :endDate \n and o.voided = 0 \n and o.person_id in ( \n select ob.person_id \n FROM obs ob \n -- Pulmonary TB \n where ob.concept_id = 3788 and ob.value_coded = 1018 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.voided = 0 \n ) \n or o.person_id in ( \n select ob.person_id \n FROM obs ob \n -- Pulmonary TB, Clinically Diagnosed \n where ob.concept_id = 2236 and ob.value_coded = 2235 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.voided = 0 \n )\n','2023-03-28 02:09:34',4,'2023-03-28 13:48:26',4,0,NULL,NULL,NULL,'34bcf70d-0178-4dcc-ab38-9046e4bcedd1'),(1830,'Miners with Documented HIV Status','High risk population of miners with documented HIV','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Miners with Documented HIV Status\n High risk population of miners with documented HIV\n \n 2023-03-27 20:45:17 UTC\n \n 2023-03-27 20:46:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1830\n select distinct o.person_id \n from obs o \n -- Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded = 3667 -- Population (Miner) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 02:15:17',4,'2023-03-28 02:16:08',4,0,NULL,NULL,NULL,'001d7c51-fa6b-45d5-9690-cc6dce14a608'),(1831,'Ex-Miners with Documented HIV Status','High risk population of Ex Miners with Documented HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Ex-Miners with Documented HIV Status\n High risk population of Ex Miners with Documented HIV Status\n \n 2023-03-27 20:47:57 UTC\n \n 2023-03-28 09:17:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1831\n select distinct o.person_id \n from obs o \n -- Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded = 3668 -- Population (Ex-Miner) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 02:17:57',4,'2023-03-28 14:47:41',4,0,NULL,NULL,NULL,'10248e4b-2f29-447e-814a-6d5b10398656'),(1832,'Factory Workers with Documented HIV Status','High risk population of Factory Workers with Documented HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Factory Workers with Documented HIV Status\n High risk population of Factory Workers with Documented HIV Status\n \n 2023-03-27 20:54:48 UTC\n \n 2023-03-27 20:55:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1832\n select distinct o.person_id \n from obs o \n -- Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded = 3669 -- Population (Factory Workers) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 02:24:48',4,'2023-03-28 02:25:05',4,0,NULL,NULL,NULL,'bb934645-58c2-4c19-bbd7-0ebf35fa3f7a'),(1833,'Public transport operators with Documented HIV Status','High risk population of Public transport operators with Documented HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Public transport operators with Documented HIV Status\n High risk population of Public transport operators with Documented HIV Status\n \n 2023-03-27 20:58:19 UTC\n \n 2023-03-28 20:14:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1833\n select distinct o.person_id \n from obs o \n -- Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded = 4654 -- Population (Public transport operators) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 02:28:19',4,'2023-03-29 01:44:32',4,0,NULL,NULL,NULL,'0c91b258-01ae-4928-be76-91201cadad93'),(1834,'Health workers with Documented HIV Status','High risk population of Health workers with Documented HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Health workers with Documented HIV Status\n High risk population of Health workers with Documented HIV Status\n \n 2023-03-27 21:04:15 UTC\n \n 2023-03-27 21:04:38 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1834\n select distinct o.person_id \n from obs o \n -- Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded = 4670 -- Population (Health workers) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 02:34:15',4,'2023-03-28 02:34:38',4,0,NULL,NULL,NULL,'7736630e-9da2-4ec0-b131-fe9e2ef01e00'),(1835,'Correctional Staff and inmates with Documented HIV Status','High risk population of Correctional Staff and inmates with Documented HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Correctional Staff and inmates with Documented HIV Status\n High risk population of Correctional Staff and inmates with Documented HIV Status\n \n 2023-03-27 21:06:32 UTC\n \n 2023-03-27 21:10:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1835\n select distinct o.person_id \n from obs o \n -- Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded in (3779, 3671) -- Population (Correctional Staff and inmates) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 02:36:32',4,'2023-03-28 02:40:03',4,0,NULL,NULL,NULL,'58ac8a09-0a12-4ab0-acb4-1fe8d1d81b77'),(1836,'RetreatmentExRelapse_Tb_Treatment_History','Retreatment Exclusive Relapse Tb Treatment History','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n RetreatmentExRelapse_Tb_Treatment_History\n Retreatment Exclusive Relapse Tb Treatment History\n \n 2023-03-27 21:07:51 UTC\n \n 2023-03-27 21:12:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1836\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(SELECT Id \nFROM \n((SELECT distinct Id, patientIdentifier AS "Patient_Identifier", patientName AS "Patient_Name" \n FROM \n \n (select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n person.gender AS Gender, \n observed_age_group.name AS age_group, \n observed_age_group.sort_order AS sort_order \n \n from obs o \n -- TB Retreatment Exclusive Relapse \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- TB Retreatment Exclusive Relapse \n select distinct person_id \n from obs \n where concept_id = 3785 and value_coded in (3786,1037) \n and obs_datetime >= CAST(:startDate AS DATE) \n and obs_datetime <= CAST(:endDate AS DATE) \n ) \n ) \n \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages') AS NEW_TB_CLIENTS \n ORDER BY NEW_TB_CLIENTS.Age) \n \n) AS RetreatmentExRelapse)\n','2023-03-28 02:37:51',4,'2023-03-28 02:42:07',4,0,NULL,NULL,NULL,'7263505b-34d2-4167-9d3f-4cdae66218f8'),(1837,'NewRelapse_Tb_Treatment_History','NewRelapse_Tb_Treatment_History','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n NewRelapse_Tb_Treatment_History\n NewRelapse_Tb_Treatment_History\n \n 2023-03-27 21:17:20 UTC\n \n 2023-03-27 21:20:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1837\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-28 02:47:20',4,'2023-03-28 02:50:31',4,0,NULL,NULL,NULL,'20879b46-ecbd-4ff9-818a-3c761bcf5ebd'),(1838,'New and Relapse with Positive HIV Status','New and Relapse with Positive HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n New and Relapse with Positive HIV Status\n New and Relapse with Positive HIV Status\n \n 2023-03-27 21:20:17 UTC\n \n 2023-03-29 20:36:19 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1838\n SELECT DISTINCT o.person_id \n from obs o \n -- New and Relapse with Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3785 and ob.value_coded in (1034, 1084) -- New/Relapse with HIV Status \n and ob.voided = 0 \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-27 23:20:17',4,'2023-03-29 22:36:19',4,0,NULL,NULL,NULL,'02c505a1-b724-422b-8c31-69440e233a0d'),(1839,'RetreatmentExRelapse_Tb_Treatment_History','Retreatment Exclusive Relapse - Tb Treatment History','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n RetreatmentExRelapse_Tb_Treatment_History\n Retreatment Exclusive Relapse - Tb Treatment History\n \n 2023-03-27 21:25:15 UTC\n \n 2023-03-27 21:26:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1839\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-28 02:55:15',4,'2023-03-28 02:56:10',4,0,NULL,NULL,NULL,'f901b38b-95e7-4bcc-ace1-ce86030ba88e'),(1840,'TB Notification - Block 2','TB Notification - Block 2','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Notification - Block 2\n TB Notification - Block 2\n \n 2023-03-27 21:45:01 UTC\n \n 2023-03-27 21:45:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1840\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-03-28 03:15:01',4,'2023-03-28 03:15:21',4,0,NULL,NULL,NULL,'8ab1160e-aca4-4d59-bd02-0269e8a3889a'),(1841,'TB Notification - Block 2 Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Notification - Block 2 Data Set\n \n 2023-03-27 21:45:21 UTC\n \n 2024-02-29 14:25:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1841\n \n \n DM_Sex\n \n \n \n \n \n \n DM_TB_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n NwRlpsF1-4\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_TB_Age\n 01-04yrs\n \n \n \n \n \n NwRlpsF5-9\n \n \n \n \n DM_Sex\n Females\n \n \n DM_TB_Age\n 05-09yrs\n \n \n \n \n \n NwRlpsM1-4\n \n \n \n \n DM_Sex\n Males\n \n \n DM_TB_Age\n 01-04yrs\n \n \n \n \n \n NwRlpsM5-9\n \n \n \n \n DM_Sex\n Males\n \n \n DM_TB_Age\n 05-09yrs\n \n \n \n \n \n NwRlpseF<1\n \n \n \n \n DM_Sex\n Females\n \n \n DM_TB_Age\n Under1yr\n \n \n \n \n \n NwRlpseM<1\n \n \n \n \n DM_Sex\n Males\n \n \n DM_TB_Age\n Under1yr\n \n \n \n \n \n NwRsF10-14\n \n \n \n \n DM_Sex\n Females\n \n \n DM_TB_Age\n 10-14yrs\n \n \n \n \n \n NwRsF15-19\n \n \n \n \n DM_Sex\n Females\n \n \n DM_TB_Age\n 15-19yrs\n \n \n \n \n \n NwRsF20-24\n \n \n \n \n DM_Sex\n Females\n \n \n DM_TB_Age\n 20-24yrs\n \n \n \n \n \n NwRsF25-34\n \n \n \n \n DM_Sex\n Females\n \n \n DM_TB_Age\n 25-34yrs\n \n \n \n \n \n NwRsF35-44\n \n \n \n \n DM_Sex\n Females\n \n \n DM_TB_Age\n 35-44yrs\n \n \n \n \n \n NwRsF45-49\n \n \n \n \n DM_Sex\n Females\n \n \n DM_TB_Age\n 45-49yrs\n \n \n \n \n \n NwRsF50-64\n \n \n \n \n DM_Sex\n Females\n \n \n DM_TB_Age\n 50-64yrs\n \n \n \n \n \n NwRsF65+\n \n \n \n \n DM_Sex\n Females\n \n \n DM_TB_Age\n 65Plus\n \n \n \n \n \n NwRsM10-14\n \n \n \n \n DM_Sex\n Males\n \n \n DM_TB_Age\n 10-14yrs\n \n \n \n \n \n NwRsM15-19\n \n \n \n \n DM_Sex\n Males\n \n \n DM_TB_Age\n 15-19yrs\n \n \n \n \n \n NwRsM20-24\n \n \n \n \n DM_Sex\n Males\n \n \n DM_TB_Age\n 20-24yrs\n \n \n \n \n \n NwRsM25-34\n \n \n \n \n DM_Sex\n Males\n \n \n DM_TB_Age\n 25-34yrs\n \n \n \n \n \n NwRsM35-44\n \n \n \n \n DM_Sex\n Males\n \n \n DM_TB_Age\n 35-44yrs\n \n \n \n \n \n NwRsM45-49\n \n \n \n \n DM_Sex\n Males\n \n \n DM_TB_Age\n 45-49yrs\n \n \n \n \n \n NwRsM50-64\n \n \n \n \n DM_Sex\n Males\n \n \n DM_TB_Age\n 50-64yrs\n \n \n \n \n \n NwRsM65+\n \n \n \n \n DM_Sex\n Males\n \n \n DM_TB_Age\n 65Plus\n \n \n \n \n \n RetreatF<1\n \n \n \n \n \n \n \n \n \n RetreatM<1\n \n \n \n \n \n \n RetrtF1-4\n \n \n \n \n \n \n RetrtF5-9\n \n \n \n \n \n \n RetrtM1-4\n \n \n \n \n \n \n RetrtM5-9\n \n \n \n \n \n \n RtrtF10-14\n \n \n \n \n \n \n RtrtF15-19\n \n \n \n \n \n \n RtrtF20-24\n \n \n \n \n \n \n RtrtF25-34\n \n \n \n \n \n \n RtrtF35-44\n \n \n \n \n \n \n RtrtF45-49\n \n \n \n \n \n \n RtrtF50-64\n \n \n \n \n \n \n RtrtF65+\n \n \n \n \n \n \n RtrtM10-14\n \n \n \n \n \n \n RtrtM15-19\n \n \n \n \n \n \n RtrtM20-24\n \n \n \n \n \n \n RtrtM25-34\n \n \n \n \n \n \n RtrtM35-44\n \n \n \n \n \n \n RtrtM45-49\n \n \n \n \n \n \n RtrtM50-64\n \n \n \n \n \n \n RtrtM65+\n \n \n \n \n \n \n','2023-03-28 03:15:21',4,'2024-02-29 19:55:50',4,0,NULL,NULL,NULL,'68f0aaca-a6a0-4cb5-aebb-e57d5ce5b2cd'),(1844,'Retreatment with Positive HIV status','Retreatment Excl. Relapse with Positive HIV status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Retreatment with Positive HIV status\n Retreatment Excl. Relapse with Positive HIV status\n \n 2023-03-28 08:28:56 UTC\n \n 2023-03-28 08:30:38 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1844\n SELECT DISTINCT o.person_id \n from obs o \n -- New and Relapse with Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3785 and ob.value_coded in (3786, 1037) -- Retreatmentafter LTFU/Failure with HIV Status \n and ob.voided = 0 \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 13:58:56',4,'2023-03-28 14:00:38',4,0,NULL,NULL,NULL,'d48e3545-1e4d-4d7a-a812-5fb7111cbf72'),(1845,'Pulmonary Clinically Diagnosed Relapse','Pulmonary Clinically Diagnosed Relapse','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Pulmonary Clinically Diagnosed Relapse\n Pulmonary Clinically Diagnosed Relapse\n \n 2023-03-28 08:30:26 UTC\n \n 2023-03-28 09:14:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1845\n select distinct o.person_id \n FROM obs o \n \n where o.concept_id = 4673 and o.value_coded = 4171 \n and o.obs_datetime >= :startDate \n and o.obs_datetime <= :endDate \n and o.person_id in ( \n select distinct o.person_id \n from obs o \n -- Relapsed TB Client \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n -- TB Start Date \n where ob.concept_id = 2237 \n and ob.value_datetime >= :startDate \n and ob.value_datetime <= :endDate \n ) \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- Relapsed Clients \n select distinct person_id \n from obs \n where concept_id = 3785 and value_coded = 1084 \n and ob.value_datetime >= :startDate \n and ob.value_datetime <= :endDate \n ) \n ) \n \n \n \n AND o.person_id not in ( \n select distinct os.person_id \n from obs os \n -- Client must not be a transfer in \n where os.concept_id = 3772 and os.value_coded =2095 \n AND os.obs_datetime >= :startDate \n and os.obs_datetime <= :endDate \n and os.voided = 0 \n ) \n ) \n \n and o.voided = 0 \n and o.person_id in ( \n select ob.person_id \n FROM obs ob \n -- Pulmonary TB \n where ob.concept_id = 3788 and ob.value_coded = 1018 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.voided = 0 \n ) \n or o.person_id in ( \n select ob.person_id \n FROM obs ob \n -- Pulmonary TB, Clinically Diagnosed \n where ob.concept_id = 2236 and ob.value_coded = 2235 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.voided = 0 \n ) \n \n \n','2023-03-28 14:00:26',4,'2023-03-28 14:44:26',4,0,NULL,NULL,NULL,'5d45f128-1037-42d6-939d-3ae6929bfd6c'),(1846,'DM_TB_Age','DM_TB_Age','org.openmrs.module.reporting.indicator.dimension.Dimension','org.openmrs.module.reporting.indicator.dimension.CohortDefinitionDimension','org.openmrs.module.reporting.serializer.ReportingSerializer','\n DM_TB_Age\n DM_TB_Age\n \n 2023-03-28 08:34:09 UTC\n \n 2024-02-29 14:04:18 UTC\n \n \n endDate\n \n java.util.Date\n true\n \n \n 1846\n \n \n 01-04yrs\n \n \n \n \n maxAge\n 4\n \n \n minAge\n 1\n \n \n effectiveDate\n ${endDate}\n \n \n \n \n \n 05-09yrs\n \n \n \n \n maxAge\n 9\n \n \n minAge\n 5\n \n \n effectiveDate\n ${endDate}\n \n \n \n \n \n 10-14yrs\n \n \n \n \n maxAge\n 14\n \n \n minAge\n 10\n \n \n effectiveDate\n ${endDate}\n \n \n \n \n \n 15-19yrs\n \n \n \n \n maxAge\n 19\n \n \n minAge\n 15\n \n \n effectiveDate\n ${endDate}\n \n \n \n \n \n 20-24yrs\n \n \n \n \n maxAge\n 24\n \n \n minAge\n 20\n \n \n effectiveDate\n ${endDate}\n \n \n \n \n \n 25-34yrs\n \n \n \n \n maxAge\n 34\n \n \n minAge\n 25\n \n \n effectiveDate\n ${endDate}\n \n \n \n \n \n 35-44yrs\n \n \n \n \n maxAge\n 44\n \n \n minAge\n 35\n \n \n effectiveDate\n ${endDate}\n \n \n \n \n \n 45-49yrs\n \n \n \n \n maxAge\n 49\n \n \n minAge\n 45\n \n \n effectiveDate\n ${endDate}\n \n \n \n \n \n 50-64yrs\n \n \n \n \n maxAge\n 64\n \n \n minAge\n 50\n \n \n effectiveDate\n ${endDate}\n \n \n \n \n \n 65Plus\n \n \n \n \n maxAge\n 120\n \n \n minAge\n 65\n \n \n effectiveDate\n ${endDate}\n \n \n \n \n \n Under1yr\n \n \n \n \n maxAge\n 0\n \n \n minAge\n 0\n \n \n effectiveDate\n ${endDate}\n \n \n \n \n \n','2023-03-28 14:04:09',4,'2024-02-29 19:34:18',4,0,NULL,NULL,NULL,'68d03856-4b9b-4d8d-ba8f-bc698222c9f2'),(1847,'Children < 15 with Positive HIV Status','High risk population for Children < 15 with Positive HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children < 15 with Positive HIV Status\n High risk population for Children < 15 with Positive HIV Status\n \n 2023-03-28 08:43:51 UTC\n \n 2023-03-28 08:54:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1847\n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- HIV PositiveStatus \n inner join location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n having Age < 15\n','2023-03-28 14:13:51',4,'2023-03-28 14:24:04',4,0,NULL,NULL,NULL,'63b6abab-6261-4d20-9601-74454ea10cd6'),(1848,'Miners with Positive HIV Status','High risk population of miners with Positive HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Miners with Positive HIV Status\n High risk population of miners with Positive HIV Status\n \n 2023-03-28 08:58:19 UTC\n \n 2023-03-28 09:01:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1848\n select distinct o.person_id \n from obs o \n -- Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded = 3667 -- Population (Miner) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 14:28:19',4,'2023-03-28 14:31:36',4,0,NULL,NULL,NULL,'d4d85343-09fc-473b-a650-50f444deee3e'),(1849,'Ex-Miners with Positive HIV Status',' High risk population of Ex Miners with Positive HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Ex-Miners with Positive HIV Status\n High risk population of Ex Miners with Positive HIV Status\n \n 2023-03-28 09:10:47 UTC\n \n 2023-03-28 09:17:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1849\n select distinct o.person_id \n from obs o \n -- Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded = 3668 -- Population (Ex-Miner) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 14:40:47',4,'2023-03-28 14:47:26',4,0,NULL,NULL,NULL,'33fa2a02-6cb8-4850-8d80-18d86f0516a8'),(1850,'Pulmonary Clinically Diagnosed Excluding Relapse','Pulmonary Clinically Diagnosed Excluding Relapse','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Pulmonary Clinically Diagnosed Excluding Relapse\n Pulmonary Clinically Diagnosed Excluding Relapse\n \n 2023-03-28 09:16:40 UTC\n \n 2023-03-28 09:55:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1850\n select distinct o.person_id \n FROM obs o \n \n where o.obs_datetime >= :startDate \n and o.obs_datetime <= :endDate \n AND o.concept_id = 3785 and o.value_coded in (3786,1037) \n and o.voided = 0 \n and o.person_id in ( \n select ob.person_id \n FROM obs ob \n -- Pulmonary TB \n where ob.concept_id = 3788 and ob.value_coded = 1018 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.voided = 0 \n ) \n or o.person_id in ( \n select ob.person_id \n FROM obs ob \n -- Pulmonary TB, Clinically Diagnosed \n where ob.concept_id = 2236 and ob.value_coded = 2235 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.voided = 0 \n ) \n \n \n','2023-03-28 14:46:40',4,'2023-03-28 15:25:11',4,0,NULL,NULL,NULL,'8a1f3d92-c5ec-4892-920b-5bae45020424'),(1851,'Factory Workers with Positive HIV Status','High risk population of Factory Workers with Positive HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Factory Workers with Positive HIV Status\n High risk population of Factory Workers with Positive HIV Status\n \n 2023-03-28 09:22:07 UTC\n \n 2023-03-28 09:23:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1851\n select distinct o.person_id \n from obs o \n -- Positive HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded = 3669 -- Population (Factory Workers) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 14:52:07',4,'2023-03-28 14:53:45',4,0,NULL,NULL,NULL,'e7f0599c-bb8c-4d2d-94a7-4b99e0f1f7af'),(1852,'Public transport with Positive HIV Status','High risk population of Public transport operators with Positive HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Public transport with Positive HIV Status\n High risk population of Public transport operators with Positive HIV Status\n \n 2023-03-28 09:26:12 UTC\n \n 2023-03-28 09:28:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1852\n select distinct o.person_id \n from obs o \n -- Positive HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded = 4654 -- Population (Public transport operators) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 14:56:12',4,'2023-03-28 14:58:18',4,0,NULL,NULL,NULL,'17f9486c-aefe-4a21-b3ad-d5c685280640'),(1853,'Health workers with Positive HIV Status',' High risk population of Health workers with Positive HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Health workers with Positive HIV Status\n High risk population of Health workers with Positive HIV Status\n \n 2023-03-28 09:31:54 UTC\n \n 2023-03-28 09:32:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1853\n select distinct o.person_id \n from obs o \n -- Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded = 4670 -- Population (Health workers) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 15:01:54',4,'2023-03-28 15:02:36',4,0,NULL,NULL,NULL,'e071852e-15c9-4eb6-92a9-c1c8157db41d'),(1854,'Correctional Staff and inmates with Positive HIV Status','High risk population of Correctional Staff and inmates with Positive HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Correctional Staff and inmates with Positive HIV Status\n High risk population of Correctional Staff and inmates with Positive HIV Status\n \n 2023-03-28 09:35:03 UTC\n \n 2023-03-28 09:35:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1854\n select distinct o.person_id \n from obs o \n -- Positive HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded in (3779, 3671) -- Population (Correctional Staff and inmates) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 15:05:03',4,'2023-03-28 15:05:43',4,0,NULL,NULL,NULL,'d6df7665-4e94-4ae6-886e-c1fb05a4a0b1'),(1855,'Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - New','Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - New','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - New\n Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - New\n \n 2023-03-28 10:05:40 UTC\n \n 2023-03-29 16:14:16 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1855\n select distinct ob.person_id \n FROM obs ob \ninner join location l on ob.location_id = l.location_id \n \n where ob.concept_id = 3788 and ob.value_coded = 2233 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.person_id in \n ( \n select distinct o.person_id \n \n from obs o \n -- New TB Patient \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n -- TB Start Date \n where ob.concept_id = 2237 \n and ob.value_datetime >= :startDate \n and ob.value_datetime <= :endDate \n and ob.voided = 0 \n ) \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- New Clients \n select distinct person_id \n from obs \n where concept_id = 3785 and value_coded = 1034 \n and obs_datetime >= :startDate \n and obs_datetime <= :endDate \n ) \n ) \n \n \n AND o.person_id not in ( \n select distinct os.person_id \n from obs os \n -- Patient must not be a tranfer in \n where os.concept_id = 3772 and os.value_coded =2095 \n AND (os.obs_datetime BETWEEN :startDate AND :endDate) \n ) \n ) \n and ob.voided = 0 \n or ob.person_id in ( \n select ob.person_id \n FROM obs ob \n -- Extra Pulmonary TB in ART Intake \n where ob.concept_id = 2236 and ob.value_coded = 2233 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.voided = 0 \n ) \n \n','2023-03-28 12:05:40',4,'2023-03-29 18:14:16',4,0,NULL,NULL,NULL,'155d4939-e304-4aa0-a2d4-efc18644affa'),(1856,'HHCM with Documented HIV Status','High risk population of HHCM with Documented HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM with Documented HIV Status\n High risk population of HHCM with Documented HIV Status\n \n 2023-03-28 10:39:40 UTC\n \n 2023-03-28 10:42:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1856\n select distinct o.person_id \n from obs o \n -- Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded =3777 -- Population (Household member of current miner) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 16:09:40',4,'2023-03-28 16:12:42',4,0,NULL,NULL,NULL,'6584ebef-9d17-4b53-80ba-7396b170919f'),(1857,'HHXM with Documented HIV Status','High risk population of HHXM with Documented HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM with Documented HIV Status\n High risk population of HHXM with Documented HIV Status\n \n 2023-03-28 10:46:20 UTC\n \n 2023-03-28 10:48:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1857\n select distinct o.person_id \n from obs o \n -- Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded =3778 -- Population (Household member of Ex miner) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 16:16:20',4,'2023-03-28 16:18:26',4,0,NULL,NULL,NULL,'f06272eb-e3f7-4d7e-82d1-1e3a391a8b9e'),(1858,'HHCM with Positive HIV Status','High risk population of HHCM with Positive HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM with Positive HIV Status\n High risk population of HHCM with Positive HIV Status\n \n 2023-03-28 10:54:07 UTC\n \n 2023-03-28 10:59:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1858\n select distinct o.person_id \n from obs o \n -- Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded =3777 -- Population (Household member of current miner) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 16:24:07',4,'2023-03-28 16:29:14',4,0,NULL,NULL,NULL,'2b06bd4f-a633-48d8-9a9a-12ae5f84001b'),(1859,'HHXM with Positive HIV Status','High risk population of HHXM with Positive HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM with Positive HIV Status\n High risk population of HHXM with Positive HIV Status\n \n 2023-03-28 11:03:32 UTC\n \n 2023-03-28 11:08:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1859\n select distinct o.person_id \n from obs o \n -- Positive, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded =3778 -- Population (Household member of Ex miner) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 16:33:32',4,'2023-03-28 16:38:06',4,0,NULL,NULL,NULL,'46bd9d48-49d2-4fd5-b433-f1123f217588'),(1860,'Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - Relapse','Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - Relapse','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - Relapse\n Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - Relapse\n \n 2023-03-28 11:42:29 UTC\n \n 2023-03-29 16:33:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1860\n select distinct ob.person_id \n FROM obs ob \ninner join location l on ob.location_id = l.location_id \n \n where ob.concept_id = 3788 and ob.value_coded = 2233 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.person_id in \n ( \n select distinct o.person_id \n \n from obs o \n -- New TB Patient \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n -- TB Start Date \n where ob.concept_id = 2237 \n and ob.value_datetime >= :startDate \n and ob.value_datetime <= :endDate \n and ob.voided = 0 \n ) \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- New Clients \n select distinct person_id \n from obs \n where concept_id = 3785 and value_coded = 1034 \n and obs_datetime >= :startDate \n and obs_datetime <= :endDate \n ) \n ) \n \n \n AND o.person_id not in ( \n select distinct os.person_id \n from obs os \n -- Patient must not be a tranfer in \n where os.concept_id = 3772 and os.value_coded =2095 \n AND (os.obs_datetime BETWEEN :startDate AND :endDate) \n ) \n ) \n and ob.voided = 0 \n or ob.person_id in ( \n select ob.person_id \n FROM obs ob \n -- Extra Pulmonary TB in ART Intake \n where ob.concept_id = 2236 and ob.value_coded = 2233 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.voided = 0 \n ) \n \n','2023-03-28 13:42:29',4,'2023-03-29 18:33:58',4,0,NULL,NULL,NULL,'b2905cf9-63d5-4b7b-9a72-0f76caf70da3'),(1861,'HHXM with HIV Positive on CPT/Dapzone','High risk population of HHXM with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM with HIV Positive on CPT/Dapzone\n High risk population of HHXM with HIV Positive on CPT/Dapzone\n \n 2023-03-28 13:51:41 UTC\n \n 2023-03-28 13:52:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1861\n select distinct o.person_id \n from obs o \n -- Positive, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded =3778 -- Population (Household member of Ex miner) \n AND ob.voided = 0 \n \n ) \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 5415 and ob.value_coded in (2330,4619) -- On Dapsone/CPT AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 19:21:41',4,'2023-03-28 19:22:17',4,0,NULL,NULL,NULL,'0133ee85-0abd-494a-86b7-6818670bd37b'),(1862,'Extra-pulmonary (bacteriologically confirmed or clinically diagnosed) - Exlude relapse','Extra-pulmonary (bacteriologically confirmed or clinically diagnosed) - Exlude relapse','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Extra-pulmonary (bacteriologically confirmed or clinically diagnosed) - Exlude relapse\n Extra-pulmonary (bacteriologically confirmed or clinically diagnosed) - Exlude relapse\n \n 2023-03-28 14:29:38 UTC\n \n 2023-03-29 16:36:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1862\n select distinct ob.person_id \n FROM obs ob \n \ninner join location l on ob.location_id = l.location_id \n \n -- Relapsed TB Client \nWHERE (ob.location_id =:location or parent_location =:location) \nand ob.concept_id = 3788 and ob.value_coded = 2233 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.person_id in \n ( \n select o.person_id \n from obs o \n where o.concept_id = 3785 and o.value_coded in (3786,1037) \n and o.obs_datetime >= :startDate \n and o.obs_datetime <= :endDate \n ) \n and ob.voided = 0 \n or ob.person_id in ( \n select ob.person_id \n FROM obs ob \n -- Extra Pulmonary TB in ART Intake \n where ob.concept_id = 2236 and ob.value_coded = 2233 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.voided = 0 \n ) \n \n','2023-03-28 16:29:38',4,'2023-03-29 18:36:39',4,0,NULL,NULL,NULL,'5023a0c3-15b8-4d16-ac54-09a77d01648d'),(1863,'HHCM with HIV Positive on CPT/Dapzone','High risk population of HHCM with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM with HIV Positive on CPT/Dapzone\n High risk population of HHCM with HIV Positive on CPT/Dapzone\n \n 2023-03-28 15:05:16 UTC\n \n 2023-03-28 15:09:54 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1863\n select distinct o.person_id \n from obs o \n -- Positive, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded =3777 -- Population (Household member of miner) \n AND ob.voided = 0 \n \n ) \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 5415 and ob.value_coded in (2330,4619) -- On Dapsone/CPT AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 20:35:16',4,'2023-03-28 20:39:54',4,0,NULL,NULL,NULL,'6365d73a-6fde-4e27-a75b-b5010023ddea'),(1864,'New and Relapse with HIV Positive on CPT/Dapzone','High risk population of New and Relapse with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n New and Relapse with HIV Positive on CPT/Dapzone\n High risk population of New and Relapse with HIV Positive on CPT/Dapzone\n \n 2023-03-28 15:14:37 UTC\n \n 2023-03-28 15:16:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1864\n select distinct o.person_id \n from obs o \n -- Positive, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded in (1034, 1084) -- Population (New and Relapse) \n AND ob.voided = 0 \n \n ) \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 5415 and ob.value_coded in (2330,4619) -- On Dapsone/CPT AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 20:44:37',4,'2023-03-28 20:46:55',4,0,NULL,NULL,NULL,'14343630-0c58-4f34-8bb5-1744e1618c31'),(1865,'Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : New','Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : New','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : New\n Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : New\n \n 2023-03-28 15:16:26 UTC\n \n 2023-03-29 16:47:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1865\n select distinct o.person_id \n FROM obs o \ninner join location l on o.location_id = l.location_id \n -- Bacteriologically confirmed Genotypic test results and Phenotypic test results \n where (o.location_id =:location or parent_location =:location) \n and o.concept_id in (3814, 3815) \n and o.obs_datetime >= :startDate \n and o.obs_datetime <= :endDate \n and o.voided = 0 \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- New Clients \n select distinct person_id \n from obs \n where concept_id = 3785 and value_coded = 1034 \n and obs_datetime >= :startDate \n and obs_datetime <= :endDate \n ) \n ) \n and o.person_id in ( \n select person_id \n from obs where concept_id = 3789 and value_coded= 3791 \n and obs_datetime >= :startDate \n and obs_datetime <= :endDate \n ) \n and o.person_id in ( \n select ob.person_id \n FROM obs ob \n -- Pulmonary TB \n where ob.concept_id = 3788 and ob.value_coded = 1018 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.voided = 0 \n ) \n or o.person_id in ( \n select ob.person_id \n FROM obs ob \n -- Pulmonary TB, Bacteriologically Confirmed \n where ob.concept_id = 2236 and ob.value_coded = 2234 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.voided = 0 \n )\n','2023-03-28 17:16:26',4,'2023-03-29 18:47:04',4,0,NULL,NULL,NULL,'273f38fa-7a41-4323-ac9d-24fd27c0c4cf'),(1866,'Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : Relapse','Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : Relapse','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : Relapse\n Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : Relapse\n \n 2023-03-28 15:21:59 UTC\n \n 2023-03-29 16:47:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1866\n select distinct o.person_id \n FROM obs o \n \ninner join location l on o.location_id = l.location_id \nWHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (3814, 3815) \n and o.obs_datetime >= :startDate \n and o.obs_datetime <= :endDate \n and o.voided = 0 \n AND o.person_id in \n ( \n \n -- Relapsed Clients \n select distinct oo.person_id \n from obs oo \n where oo.concept_id = 3785 and oo.value_coded = 1084 \n and oo.obs_datetime >= :startDate \n and oo.obs_datetime <= :endDate \n ) \n and o.person_id in ( \n select person_id \n from obs where concept_id = 3789 and value_coded= 3791 \n and obs_datetime >= :startDate \n and obs_datetime <= :endDate \n ) \n and o.person_id in ( \n select ob.person_id \n FROM obs ob \n -- Pulmonary TB \n where ob.concept_id = 3788 and ob.value_coded = 1018 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.voided = 0 \n ) \n or o.person_id in ( \n select ob.person_id \n FROM obs ob \n -- Pulmonary TB, Bacteriologically Confirmed \n where ob.concept_id = 2236 and ob.value_coded = 2234 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.voided = 0 \n )\n','2023-03-28 17:21:59',4,'2023-03-29 18:47:31',4,0,NULL,NULL,NULL,'300b2de6-1987-4ae2-a742-c2907f6bc2b7'),(1867,'Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : Excluding Relapse','Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : Excluding Relapse','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : Excluding Relapse\n Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : Excluding Relapse\n \n 2023-03-28 15:25:40 UTC\n \n 2023-03-30 15:34:09 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1867\n select distinct o.person_id \n FROM obs o \ninner join location l on o.location_id = l.location_id \nWHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (3814, 3815) \n and o.obs_datetime >= :startDate \n and o.obs_datetime <= :endDate \n and o.voided = 0 \n AND o.person_id in ( \n select person_id from obs \n where concept_id = 3788 and value_coded = 2233 \n and obs_datetime >= :startDate \n and obs_datetime <= :endDate \n \n ) \n AND o.person_id not in \n ( \n \n -- Relapsed Clients \n select distinct person_id \n from obs \n where concept_id = 3785 and value_coded = 1084 \n and obs_datetime >= :startDate \n and obs_datetime <= :endDate \n ) \n and o.person_id in ( \n select person_id \n from obs where concept_id = 3789 and value_coded= 3791 \n and obs_datetime >= :startDate \n and obs_datetime <= :endDate \n ) \n and o.person_id in ( \n select ob.person_id \n FROM obs ob \n -- Pulmonary TB \n where ob.concept_id = 3788 and ob.value_coded = 1018 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.voided = 0 \n ) \n or o.person_id in ( \n select ob.person_id \n FROM obs ob \n -- Pulmonary TB, Bacteriologically Confirmed \n where ob.concept_id = 2236 and ob.value_coded = 2234 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.voided = 0 \n )\n','2023-03-28 17:25:40',4,'2023-03-30 17:34:09',4,0,NULL,NULL,NULL,'fc1f07c9-e4d5-4d2f-97fb-98b26e6f66d0'),(1868,'Retreatment with HIV Positive on CPT/Dapzone','Retreatment Excl. Relapse with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Retreatment with HIV Positive on CPT/Dapzone\n Retreatment Excl. Relapse with HIV Positive on CPT/Dapzone\n \n 2023-03-28 15:28:13 UTC\n \n 2023-03-28 15:30:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1868\n select distinct o.person_id \n from obs o \n -- Positive, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded in (3786, 1037) -- Population (Retreatment Excl. Relapse) \n AND ob.voided = 0 \n \n ) \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 5415 and ob.value_coded in (2330,4619) -- On Dapsone/CPT AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 20:58:13',4,'2023-03-28 21:00:05',4,0,NULL,NULL,NULL,'fc64e900-ad46-45b3-9514-3d9aaefbd2cf'),(1869,'Children < 15 with Positive HIV on CPT/Dapzone','Children < 15 with Positive HIV on CPT/Dapzone','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children < 15 with Positive HIV on CPT/Dapzone\n Children < 15 with Positive HIV on CPT/Dapzone\n \n 2023-03-28 15:51:27 UTC\n \n 2023-03-29 21:44:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1869\n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- HIV Positive Status \n inner join location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 5415 and ob.value_coded in (2330,4619) -- On Dapsone/CPT AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n having Age < 15\n','2023-03-28 17:51:27',4,'2023-03-29 23:44:53',4,0,NULL,NULL,NULL,'36fe954a-f05e-431b-9037-4772a4b28383'),(1870,'Miners with HIV Positive on CPT/Dapzone','High risk population Miners with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Miners with HIV Positive on CPT/Dapzone\n High risk population Miners with HIV Positive on CPT/Dapzone\n \n 2023-03-28 15:55:23 UTC\n \n 2023-03-28 15:56:49 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1870\n select distinct o.person_id \n from obs o \n -- Positive, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded =3667 -- Population (miner) \n AND ob.voided = 0 \n \n ) \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 5415 and ob.value_coded in (2330,4619) -- On Dapsone/CPT AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 21:25:23',4,'2023-03-28 21:26:49',4,0,NULL,NULL,NULL,'354da83b-27c3-4124-9198-d1902fefb417'),(1871,'Ex Miner with HIV Positive on CPT/Dapzone',' High risk population of Ex Miner with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Ex Miner with HIV Positive on CPT/Dapzone\n High risk population of Ex Miner with HIV Positive on CPT/Dapzone\n \n 2023-03-28 16:02:40 UTC\n \n 2023-03-28 16:06:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1871\n select distinct o.person_id \n from obs o \n -- Positive, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded =3668 -- Population (Ex miner) \n AND ob.voided = 0 \n \n ) \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 5415 and ob.value_coded in (2330,4619) -- On Dapsone/CPT AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 21:32:40',4,'2023-03-28 21:36:28',4,0,NULL,NULL,NULL,'ff703f75-36cc-4487-afab-65df0ccbff68'),(1872,'Factory Workers with HIV Positive on CPT/Dapzone','High risk population of Factory Workers with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Factory Workers with HIV Positive on CPT/Dapzone\n High risk population of Factory Workers with HIV Positive on CPT/Dapzone\n \n 2023-03-28 16:08:16 UTC\n \n 2023-03-28 16:09:25 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1872\n select distinct o.person_id \n from obs o \n -- Positive, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded =3770 -- Population (Factory Workers) \n AND ob.voided = 0 \n \n ) \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 5415 and ob.value_coded in (2330,4619) -- On Dapsone/CPT AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 21:38:16',4,'2023-03-28 21:39:25',4,0,NULL,NULL,NULL,'ff030c28-e12b-45ed-80b0-330e353fdd29'),(1873,'Public transport operators with HIV Positive on CPT/Dapzone','High risk population of Public transport operators with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Public transport operators with HIV Positive on CPT/Dapzone\n High risk population of Public transport operators with HIV Positive on CPT/Dapzone\n \n 2023-03-28 16:14:01 UTC\n \n 2023-03-28 16:14:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1873\n select distinct o.person_id \n from obs o \n -- Positive, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded =4654 -- Population (Public transport operators) \n AND ob.voided = 0 \n \n ) \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 5415 and ob.value_coded in (2330,4619) -- On Dapsone/CPT AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 21:44:01',4,'2023-03-28 21:44:45',4,0,NULL,NULL,NULL,'b116d4a0-174f-49a7-be0f-3d5f79581b05'),(1874,'Health workers with HIV Positive on CPT/Dapzone',' High risk population of Health workers with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Health workers with HIV Positive on CPT/Dapzone\n High risk population of Health workers with HIV Positive on CPT/Dapzone\n \n 2023-03-28 16:16:21 UTC\n \n 2023-03-28 16:17:38 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1874\n select distinct o.person_id \n from obs o \n -- Positive, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded =3470 -- Population (Health workers) \n AND ob.voided = 0 \n \n ) \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 5415 and ob.value_coded in (2330,4619) -- On Dapsone/CPT AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 21:46:21',4,'2023-03-28 21:47:38',4,0,NULL,NULL,NULL,'4c4aa324-1728-4001-a94e-e857574126b1'),(1875,'Correctional Staff and inmates with HIV Positive on CPT/Dapzone','High risk population of Correctional Staff and inmates with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Correctional Staff and inmates with HIV Positive on CPT/Dapzone\n High risk population of Correctional Staff and inmates with HIV Positive on CPT/Dapzone\n \n 2023-03-28 16:20:31 UTC\n \n 2023-03-28 16:27:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1875\n select distinct o.person_id \n from obs o \n -- Positive, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded in (3779, 3671) -- Population (Correctional Staff and inmates) \n AND ob.voided = 0 \n \n ) \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 5415 and ob.value_coded in (2330,4619) -- On Dapsone/CPT AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 21:50:31',4,'2023-03-28 21:57:26',4,0,NULL,NULL,NULL,'423a7240-f359-41a2-929d-7b1cd7010807'),(1876,'TB among Miners','TB among Key Population Group Miners','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB among Miners\n TB among Key Population Group Miners\n \n 2023-03-28 17:11:27 UTC\n \n 2023-03-28 17:34:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1876\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in( \nSELECT Id \nFROM \n((SELECT distinct Id, patientIdentifier AS "Patient_Identifier", patientName AS "Patient_Name" \n FROM \n \n (select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n person.gender AS Gender, \n observed_age_group.name AS age_group, \n observed_age_group.sort_order AS sort_order \n \n from obs o \n -- Miners \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- Miners \n select distinct person_id \n from obs \n where concept_id = 3776 and value_coded = 3667 \n and obs_datetime >= CAST(:startDate AS DATE) \n and obs_datetime <= CAST(:endDate AS DATE) \n ) \n ) \n \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages') AS NEW_TB_CLIENTS \n ORDER BY NEW_TB_CLIENTS.Age) \n \n) AS Miner \n)\n','2023-03-28 22:41:27',4,'2023-03-28 23:04:23',4,0,NULL,NULL,NULL,'273e3515-f928-4164-be82-fc5235d66188'),(1877,'TB among Exminers','TB among Key Population Group Exminers','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB among Exminers\n TB among Key Population Group Exminers\n \n 2023-03-28 17:40:01 UTC\n \n 2023-03-28 17:41:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1877\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in( \nSELECT Id \nFROM \n((SELECT distinct Id, patientIdentifier AS "Patient_Identifier", patientName AS "Patient_Name" \n FROM \n \n (select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n person.gender AS Gender, \n observed_age_group.name AS age_group, \n observed_age_group.sort_order AS sort_order \n \n from obs o \n -- Exminers \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- Exminers \n select distinct person_id \n from obs \n where concept_id = 3776 and value_coded = 3668 \n and obs_datetime >= CAST(:startDate AS DATE) \n and obs_datetime <= CAST(:endDate AS DATE) \n ) \n ) \n \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages') AS NEW_TB_CLIENTS \n ORDER BY NEW_TB_CLIENTS.Age) \n \n) AS Exminer \n)\n','2023-03-28 23:10:01',4,'2023-03-28 23:11:15',4,0,NULL,NULL,NULL,'ecb47cb2-6af4-4932-8fee-076ba40afa87'),(1878,'TB among HHCM','TB among Key Population Group HHCM','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB among HHCM\n TB among Key Population Group HHCM\n \n 2023-03-28 19:19:59 UTC\n \n 2023-03-28 19:26:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1878\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in( \nSELECT Id \nFROM \n((SELECT distinct Id, patientIdentifier AS "Patient_Identifier", patientName AS "Patient_Name" \n FROM \n \n (select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n person.gender AS Gender, \n observed_age_group.name AS age_group, \n observed_age_group.sort_order AS sort_order \n \n from obs o \n -- HHCM \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- HHCM \n select distinct person_id \n from obs \n where concept_id = 3776 and value_coded = 3777 \n and obs_datetime >= CAST(:startDate AS DATE) \n and obs_datetime <= CAST(:endDate AS DATE) \n ) \n ) \n \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages') AS NEW_TB_CLIENTS \n ORDER BY NEW_TB_CLIENTS.Age) \n \n) As HHCM \n)\n','2023-03-29 00:49:59',4,'2023-03-29 00:56:17',4,0,NULL,NULL,NULL,'0da939c1-ae87-45c8-80ed-e56b82e5a62e'),(1879,'Correctional Staff and inmates on HIV Positive on ART','High risk population of Correctional Staff and inmates on HIV Positive on ART','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Correctional Staff and inmates on HIV Positive on ART\n High risk population of Correctional Staff and inmates on HIV Positive on ART\n \n 2023-03-28 19:25:59 UTC\n \n 2023-03-29 20:58:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1879\n select distinct o.person_id \n from obs o \n -- On ART \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4667 and o.value_coded in (4670, 4669) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded in (3779, 3671) -- Population (Correctional Staff and inmates) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \nAND o.obs_datetime >= CAST(:endDate AS DATE) \n\n','2023-03-28 21:25:59',4,'2023-03-29 22:58:43',4,0,NULL,NULL,NULL,'a6ebd7a8-631b-4e0e-bdfb-8be1b9fb9eec'),(1880,'New and Relapse with HIV Positive on ART','High risk population of New and Relapse with HIV Positive on ART','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n New and Relapse with HIV Positive on ART\n High risk population of New and Relapse with HIV Positive on ART\n \n 2023-03-28 19:29:52 UTC\n \n 2023-03-28 19:32:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1880\n SELECT DISTINCT o.person_id \n from obs o \n -- New and Relapse On ART \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4667 and o.value_coded in (4670, 4669) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3785 and ob.value_coded in (1034, 1084) -- New and Relapse \n and ob.voided = 0 \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE)\n','2023-03-29 00:59:52',4,'2023-03-29 01:02:02',4,0,NULL,NULL,NULL,'8067c849-4c81-475a-a26e-68a2e58b8067'),(1882,'Retreatment with HIV Positive on ART','High risk population of Retreatment Excl. Relapse HIV Positive on ART','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Retreatment with HIV Positive on ART\n High risk population of Retreatment Excl. Relapse HIV Positive on ART\n \n 2023-03-28 19:34:51 UTC\n \n 2023-03-28 19:45:46 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1882\n SELECT DISTINCT o.person_id \n from obs o \n -- Retreatmentafter LTFU/Failure on ART \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4667 and o.value_coded in (4670, 4669) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3785 and ob.value_coded in (3786, 1037) -- Retreatmentafter LTFU/Failure \n and ob.voided = 0 \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-29 01:04:51',4,'2023-03-29 01:15:46',4,0,NULL,NULL,NULL,'fe4f73c9-4b24-4458-9ae1-9d3fcad9f9cb'),(1883,'TB among HHXM','TB among Key Population Group HHXM','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB among HHXM\n TB among Key Population Group HHXM\n \n 2023-03-28 19:35:03 UTC\n \n 2023-03-28 19:37:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1883\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in( \nSELECT Id \nFROM \n((SELECT distinct Id, patientIdentifier AS "Patient_Identifier", patientName AS "Patient_Name" \n FROM \n \n (select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n person.gender AS Gender, \n observed_age_group.name AS age_group, \n observed_age_group.sort_order AS sort_order \n \n from obs o \n -- HHXM \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- HHXM \n select distinct person_id \n from obs \n where concept_id = 3776 and value_coded = 3778 \n and obs_datetime >= CAST(:startDate AS DATE) \n and obs_datetime <= CAST(:endDate AS DATE) \n ) \n ) \n \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages') AS NEW_TB_CLIENTS \n ORDER BY NEW_TB_CLIENTS.Age) \n \n) AS HHXM \n)\n','2023-03-29 01:05:03',4,'2023-03-29 01:07:06',4,0,NULL,NULL,NULL,'4715bb07-7b64-4001-b5cb-ea555b425a07'),(1884,'TB among Factory Workers','TB among Key Population Group Factory Workers','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB among Factory Workers\n TB among Key Population Group Factory Workers\n \n 2023-03-28 19:43:14 UTC\n \n 2023-03-28 19:45:00 UTC\n \n \n endDate\n \n java.util.Date\n true\n \n \n startDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1884\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in( \nSELECT Id \nFROM \n((SELECT distinct Id, patientIdentifier AS "Patient_Identifier", patientName AS "Patient_Name" \n FROM \n \n (select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n person.gender AS Gender, \n observed_age_group.name AS age_group, \n observed_age_group.sort_order AS sort_order \n \n from obs o \n -- FactoryWorkers \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- FactoryWorkers \n select distinct person_id \n from obs \n where concept_id = 3776 and value_coded = 3669 \n and obs_datetime >= CAST(:startDate AS DATE) \n and obs_datetime <= CAST(:endDate AS DATE) \n ) \n ) \n \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages') AS NEW_TB_CLIENTS \n ORDER BY NEW_TB_CLIENTS.Age) \n \n) AS FactoryWorkers \n)\n','2023-03-29 01:13:14',4,'2023-03-29 01:15:01',4,0,NULL,NULL,NULL,'6bed2c03-ba40-477b-9a9a-67f3fcd50ea3'),(1885,'TB among Correctional Staff & Inmates','TB among Key Population Group Correctional Staff & Inmates','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB among Correctional Staff & Inmates\n TB among Key Population Group Correctional Staff & Inmates\n \n 2023-03-28 19:47:06 UTC\n \n 2023-03-28 19:49:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1885\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in( \nSELECT Id \nFROM \n((SELECT distinct Id, patientIdentifier AS "Patient_Identifier", patientName AS "Patient_Name" \n FROM \n \n (select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n person.gender AS Gender, \n observed_age_group.name AS age_group, \n observed_age_group.sort_order AS sort_order \n \n from obs o \n -- Correctional Staff & Inmates \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- Correctional Staff & Inmates \n select distinct person_id \n from obs \n where concept_id = 3776 and value_coded in (3779,3671) \n and obs_datetime >= CAST(:startDate AS DATE) \n and obs_datetime <= CAST(:endDate AS DATE) \n ) \n ) \n \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages') AS NEW_TB_CLIENTS \n ORDER BY NEW_TB_CLIENTS.Age) \n \n) AS Correctional \n)\n','2023-03-29 01:17:06',4,'2023-03-29 01:19:30',4,0,NULL,NULL,NULL,'9016d0ef-4556-49e7-99bd-2bf2e7f5188f'),(1886,'Children < 15 with HIV Positive on ART','High risk population for Children < 15 with HIV Positive on ART','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children < 15 with HIV Positive on ART\n High risk population for Children < 15 with HIV Positive on ART\n \n 2023-03-28 19:47:46 UTC\n \n 2023-03-28 19:50:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1886\n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- HIV Positive on ART \n inner join location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4667 and o.value_coded in (4670, 4669) \n AND o.voided = 0 \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n having Age < 15\n','2023-03-29 01:17:46',4,'2023-03-29 01:20:02',4,0,NULL,NULL,NULL,'e724e30e-b9e1-4a19-afa9-d19aa8dc42f4'),(1887,'TB among Public Transport Operators ','TB among Key Population Group Public Transport Operators','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB among Public Transport Operators \n TB among Key Population Group Public Transport Operators\n \n 2023-03-28 19:51:36 UTC\n \n 2023-03-28 19:53:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1887\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in( \nSELECT Id \nFROM \n((SELECT distinct Id, patientIdentifier AS "Patient_Identifier", patientName AS "Patient_Name" \n FROM \n \n (select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n person.gender AS Gender, \n observed_age_group.name AS age_group, \n observed_age_group.sort_order AS sort_order \n \n from obs o \n -- Transport \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- Transport \n select distinct person_id \n from obs \n where concept_id = 3776 and value_coded = 4654 \n and obs_datetime >= CAST(:startDate AS DATE) \n and obs_datetime <= CAST(:endDate AS DATE) \n ) \n ) \n \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages') AS NEW_TB_CLIENTS \n ORDER BY NEW_TB_CLIENTS.Age) \n \n) AS Transport \n)\n','2023-03-29 01:21:36',4,'2023-03-29 01:23:32',4,0,NULL,NULL,NULL,'4aac5017-e28a-4f36-8805-0812476a9d7b'),(1888,'Miners with HIV Positive on ART','High risk population of Miners with HIV Positive on ART','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Miners with HIV Positive on ART\n High risk population of Miners with HIV Positive on ART\n \n 2023-03-28 19:55:27 UTC\n \n 2023-03-28 19:56:16 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1888\n select distinct o.person_id \n from obs o \n -- HIV Positive on ART \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded = 3667 -- Population (Miner) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-29 01:25:27',4,'2023-03-29 01:26:16',4,0,NULL,NULL,NULL,'a37a95b7-1365-4d73-8d21-28dd2e77196e'),(1889,'TB among Health Workers','TB among Key Population Group Health Workers','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB among Health Workers\n TB among Key Population Group Health Workers\n \n 2023-03-28 19:55:49 UTC\n \n 2023-03-28 19:57:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1889\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in( \nSELECT Id \nFROM \n((SELECT distinct Id, patientIdentifier AS "Patient_Identifier", patientName AS "Patient_Name" \n FROM \n \n (select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n person.gender AS Gender, \n observed_age_group.name AS age_group, \n observed_age_group.sort_order AS sort_order \n \n from obs o \n -- HealthWorkers \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- HealthWorkers \n select distinct person_id \n from obs \n where concept_id = 3776 and value_coded = 3670 \n and obs_datetime >= CAST(:startDate AS DATE) \n and obs_datetime <= CAST(:endDate AS DATE) \n ) \n ) \n \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages') AS NEW_TB_CLIENTS \n ORDER BY NEW_TB_CLIENTS.Age) \n \n) AS HealthWorkers \n)\n','2023-03-29 01:25:49',4,'2023-03-29 01:27:20',4,0,NULL,NULL,NULL,'04590a3f-4e59-45fe-a5c3-f5ae76ef805b'),(1890,'Ex Miner with with HIV Positive on ART','High risk population of Ex Miner with with HIV Positive on ART','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Ex Miner with with HIV Positive on ART\n High risk population of Ex Miner with with HIV Positive on ART\n \n 2023-03-28 19:58:00 UTC\n \n 2023-03-28 19:59:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1890\n select distinct o.person_id \n from obs o \n -- HIV Positive on ART \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4667 and o.value_coded in (4670, 4669) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded = 3668 -- Population (Ex-Miner) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-29 01:28:00',4,'2023-03-29 01:29:01',4,0,NULL,NULL,NULL,'1edf0f21-2fad-48c7-a24a-e21367f334c1'),(1891,'HHCM with with HIV Positive on ART','High risk population of HHCM with with HIV Positive on ART','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM with with HIV Positive on ART\n High risk population of HHCM with with HIV Positive on ART\n \n 2023-03-28 20:00:28 UTC\n \n 2023-03-28 20:03:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1891\n select distinct o.person_id \n from obs o \n -- HIV Positive on ART \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4667 and o.value_coded in (4670, 4669) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded =3777 -- Population (Household member of current miner) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-29 01:30:28',4,'2023-03-29 01:33:58',4,0,NULL,NULL,NULL,'14b8879f-49ef-492c-aeb0-fdd62fde084a'),(1892,'TB among Miners','TB among Key Population Group Miners','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB among Miners\n TB among Key Population Group Miners\n \n 2023-03-28 20:05:03 UTC\n \n 2023-03-28 20:12:22 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1892\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 01:35:03',4,'2023-03-29 01:42:22',4,0,NULL,NULL,NULL,'526100b3-2b2a-4f15-862e-4be06d73bdb3'),(1893,'HHXM with HIV Positive on ART','High risk population of HHXM with HIV Positive on ART','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM with HIV Positive on ART\n High risk population of HHXM with HIV Positive on ART\n \n 2023-03-28 20:05:19 UTC\n \n 2023-03-28 20:08:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1893\n select distinct o.person_id \n from obs o \n -- Positive, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4667 and o.value_coded in (4670, 4669) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded =3778 -- Population (Household member of Ex miner) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-29 01:35:19',4,'2023-03-29 01:38:02',4,0,NULL,NULL,NULL,'0d7e9652-b8fa-4264-859b-0b681452c462'),(1894,'Factory Workers with HIV Positive on ART','High risk population of Factory Workers with HIV Positive on ART','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Factory Workers with HIV Positive on ART\n High risk population of Factory Workers with HIV Positive on ART\n \n 2023-03-28 20:09:30 UTC\n \n 2023-03-28 20:10:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1894\n select distinct o.person_id \n from obs o \n -- Positive HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4667 and o.value_coded in (4670, 4669) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded = 3669 -- Population (Factory Workers) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-29 01:39:30',4,'2023-03-29 01:40:27',4,0,NULL,NULL,NULL,'67233a82-27bf-4615-948b-28fad7ad6322'),(1895,'Public transport operators with HIV Positive on ART','High risk population of Public transport operators with HIV Positive on ART','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Public transport operators with HIV Positive on ART\n High risk population of Public transport operators with HIV Positive on ART\n \n 2023-03-28 20:12:15 UTC\n \n 2023-03-28 20:14:34 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1895\n select distinct o.person_id \n from obs o \n -- Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded = 4654 -- Population (Public transport operators) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-29 01:42:15',4,'2023-03-29 01:44:34',4,0,NULL,NULL,NULL,'63418340-29fe-4106-83ad-a09538397f5f'),(1896,'TB among Exminers','TB among Key Population Group Ex Miners','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB among Exminers\n TB among Key Population Group Ex Miners\n \n 2023-03-28 20:13:33 UTC\n \n 2023-03-28 20:18:09 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1896\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 01:43:33',4,'2023-03-29 01:48:09',4,0,NULL,NULL,NULL,'2dcbfff3-70b6-4ed5-b727-a51fea71b8aa'),(1897,'Health workers with HIV Positive on ART','High risk population of Health workers with HIV Positive on ART','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Health workers with HIV Positive on ART\n High risk population of Health workers with HIV Positive on ART\n \n 2023-03-28 20:18:06 UTC\n \n 2023-03-28 20:18:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1897\n select distinct o.person_id \n from obs o \n -- Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4667 and o.value_coded in (4670, 4669) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded = 4670 -- Population (Health workers) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-29 01:48:06',4,'2023-03-29 01:48:39',4,0,NULL,NULL,NULL,'1340548d-896a-4473-ae26-4c8960dec630'),(1898,'TB among HHCM','TB among Key Population Group HHCM','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB among HHCM\n TB among Key Population Group HHCM\n \n 2023-03-28 20:19:17 UTC\n \n 2023-03-28 20:20:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1898\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 01:49:17',4,'2023-03-29 01:50:21',4,0,NULL,NULL,NULL,'dd0ada55-f903-426e-a60e-f83ceeb15cab'),(1899,'TB among HHXM','TB among Key Population Group HHXM','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB among HHXM\n TB among Key Population Group HHXM\n \n 2023-03-28 20:21:08 UTC\n \n 2023-03-28 20:23:24 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1899\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 01:51:08',4,'2023-03-29 01:53:24',4,0,NULL,NULL,NULL,'9558eb96-47f5-4cdd-ad4f-d07257529259'),(1900,'Pulmonary Bacteriologically Confirmed - Exlude Relapse','Pulmonary Bacteriologically Confirmed - Exlude Relapse','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Pulmonary Bacteriologically Confirmed - Exlude Relapse\n Pulmonary Bacteriologically Confirmed - Exlude Relapse\n \n 2023-03-29 03:39:55 UTC\n \n 2023-03-29 17:21:25 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1900\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 05:39:55',4,'2023-03-29 19:21:25',4,0,NULL,NULL,NULL,'8315a536-5b6e-4da8-bcf7-860b6b6bd8aa'),(1902,'Pulmonary Bacteriologically Confirmed New','Pulmonary Bacteriologically Confirmed New','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Pulmonary Bacteriologically Confirmed New\n Pulmonary Bacteriologically Confirmed New\n \n 2023-03-29 04:12:11 UTC\n \n 2023-03-29 05:37:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1902\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 09:42:11',4,'2023-03-29 11:07:28',4,0,NULL,NULL,NULL,'15e06979-0f27-4aba-87fb-bc5a6dc28da4'),(1903,'Pulmonary Clinically Diagnosed Excluding Relapse','Pulmonary Clinically Diagnosed Excluding Relapse','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Pulmonary Clinically Diagnosed Excluding Relapse\n Pulmonary Clinically Diagnosed Excluding Relapse\n \n 2023-03-29 06:06:35 UTC\n \n 2023-03-29 08:12:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1903\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 11:36:35',4,'2023-03-29 13:42:28',4,0,NULL,NULL,NULL,'b0ff3ba5-25df-46e4-8eae-bfca7d86b9dd'),(1904,'Pulmonary Bacteriologically Confirmed Relapse','Pulmonary Bacteriologically Confirmed Relapse','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Pulmonary Bacteriologically Confirmed Relapse\n Pulmonary Bacteriologically Confirmed Relapse\n \n 2023-03-29 06:08:27 UTC\n \n 2023-03-29 08:11:19 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1904\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 11:38:27',4,'2023-03-29 13:41:19',4,0,NULL,NULL,NULL,'f6797c59-e7e3-4492-ad5f-a67bf5e683bc'),(1905,'Pulmonary Clinically Diagnosed New','Pulmonary Clinically Diagnosed New','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Pulmonary Clinically Diagnosed New\n Pulmonary Clinically Diagnosed New\n \n 2023-03-29 08:14:51 UTC\n \n 2023-03-29 08:17:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1905\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 13:44:51',4,'2023-03-29 13:47:31',4,0,NULL,NULL,NULL,'63333694-f766-4047-830b-087496f8e5a8'),(1906,'Pulmonary Clinically Diagnosed Relapse','Pulmonary Clinically Diagnosed Relapse','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Pulmonary Clinically Diagnosed Relapse\n Pulmonary Clinically Diagnosed Relapse\n \n 2023-03-29 08:15:08 UTC\n \n 2023-03-29 08:18:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1906\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 13:45:08',4,'2023-03-29 13:48:31',4,0,NULL,NULL,NULL,'2ff007c1-993d-48fc-8df6-9ed7c66b42d3'),(1907,'Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - New','Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - New','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - New\n Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - New\n \n 2023-03-29 08:25:10 UTC\n \n 2023-03-29 08:49:47 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1907\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 13:55:10',4,'2023-03-29 14:19:47',4,0,NULL,NULL,NULL,'d1ce1a2c-338a-4926-a1d4-f7f79ac2b875'),(1908,'TB among Factory Workers','TB among Key Population Group Factory Workers','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB among Factory Workers\n TB among Key Population Group Factory Workers\n \n 2023-03-29 08:26:00 UTC\n \n 2023-03-29 08:52:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1908\n COUNT\n \n \n \n \n endDate\n ${startDate}\n \n \n location\n ${location}\n \n \n startDate\n ${endDate}\n \n \n \n','2023-03-29 13:56:00',4,'2023-03-29 14:22:40',4,0,NULL,NULL,NULL,'071a7d7a-f944-4965-978c-bfe740051b9a'),(1909,'Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - Relapse','Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - Relapse','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - Relapse\n Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - Relapse\n \n 2023-03-29 08:52:39 UTC\n \n 2023-03-29 08:54:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1909\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 14:22:39',4,'2023-03-29 14:24:28',4,0,NULL,NULL,NULL,'20c9a6fc-f845-4569-b018-b5f59c39948c'),(1910,'Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - Excluging Relapse','Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - Excluging Relapse','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - Excluging Relapse\n Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - Excluging Relapse\n \n 2023-03-29 08:53:19 UTC\n \n 2023-03-29 08:54:54 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1910\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 14:23:19',4,'2023-03-29 14:24:54',4,0,NULL,NULL,NULL,'422afe85-5763-4700-8a8b-bf17328901a8'),(1911,'TB among Correctional Staff & Inmates','TB among Key Population Group Correctional Staff & Inmates','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB among Correctional Staff & Inmates\n TB among Key Population Group Correctional Staff & Inmates\n \n 2023-03-29 08:53:58 UTC\n \n 2023-03-29 08:56:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1911\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 14:23:58',4,'2023-03-29 14:26:06',4,0,NULL,NULL,NULL,'8ac11f64-421a-4f48-9ac3-048ee6912eda'),(1912,'Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : Excluding Relapse','Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : Excluding Relapse','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : Excluding Relapse\n Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : Excluding Relapse\n \n 2023-03-29 08:55:36 UTC\n \n 2023-03-29 09:04:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1912\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 14:25:36',4,'2023-03-29 14:34:23',4,0,NULL,NULL,NULL,'83125cb9-0324-4e21-8f4d-b9fd51049909'),(1913,'TB among Public Transport Operators ','TB among Key Population Group Public Transport Operators','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB among Public Transport Operators \n TB among Key Population Group Public Transport Operators\n \n 2023-03-29 08:57:05 UTC\n \n 2023-03-29 08:59:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1913\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 14:27:05',4,'2023-03-29 14:29:07',4,0,NULL,NULL,NULL,'f3aabc74-880c-4502-94af-ff9fd0b95906'),(1914,'Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : New','Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : New','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : New\n Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : New\n \n 2023-03-29 08:59:37 UTC\n \n 2023-03-29 09:04:54 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1914\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 14:29:37',4,'2023-03-29 14:34:54',4,0,NULL,NULL,NULL,'c5e34544-e98f-42ce-82d1-3708ce5e5b80'),(1915,'TB among Health Workers','TB among Key Population Group Health Workers','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB among Health Workers\n TB among Key Population Group Health Workers\n \n 2023-03-29 09:02:15 UTC\n \n 2023-03-29 09:04:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1915\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 14:32:15',4,'2023-03-29 14:34:59',4,0,NULL,NULL,NULL,'76adf56b-486f-4a4c-b309-5c43372d94eb'),(1916,'TB Notification - Block 3','TB Notification - Block 3','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Notification - Block 3\n TB Notification - Block 3\n \n 2023-03-29 09:08:01 UTC\n \n 2023-03-29 09:08:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1916\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-03-29 14:38:01',4,'2023-03-29 14:38:31',4,0,NULL,NULL,NULL,'5a51f412-3b6f-4808-ae32-ed90141bb7e2'),(1917,'TB Notification - Block 3 Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Notification - Block 3 Data Set\n \n 2023-03-29 09:08:31 UTC\n \n 2023-03-29 10:08:22 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1917\n \n \n \n TB-HHCM\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n \n \n TB-HHXM\n \n \n \n \n \n \n \n \n \n TBExMiners\n \n \n \n \n \n \n \n \n \n TBFactoryW\n \n \n \n \n \n \n \n \n \n TBHealthW\n \n \n \n \n \n \n \n \n \n TBInmates\n \n \n \n \n \n \n \n \n \n TBMiners\n \n \n \n \n \n \n \n \n \n TBTrans\n \n \n \n \n \n \n \n \n \n','2023-03-29 14:38:31',4,'2023-03-29 15:38:22',4,0,NULL,NULL,NULL,'4e91ef91-ad5f-4717-b782-9ac61d52dc40'),(1919,'Block 1: All TB Patients diagnosed with TB during the current quarter, by history of treatment and anatomic site of disease Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Block 1: All TB Patients diagnosed with TB during the current quarter, by history of treatment and anatomic site of disease Data Set\n \n 2023-03-29 09:46:48 UTC\n \n 2023-03-29 15:30:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1919\n \n \n \n died1\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n \n \n died2\n \n \n \n \n \n \n \n \n \n died3\n \n \n \n \n \n \n \n \n \n extra1\n \n \n \n \n \n \n \n \n \n extra2\n \n \n \n \n \n \n \n \n \n extra3\n \n \n \n \n \n \n \n \n \n pul_ExPulm\n \n \n \n \n \n \n \n \n \n pul_clin1\n \n \n \n \n \n \n \n \n \n pul_diag2\n \n \n \n \n \n \n \n \n \n pul_new \n \n \n \n \n \n \n \n \n \n pul_newex\n \n \n \n \n \n \n \n \n \n pul_relaps\n \n \n \n \n \n \n \n \n \n','2023-03-29 11:46:48',4,'2023-03-29 17:30:32',4,0,NULL,NULL,NULL,'b7c3203a-888a-4139-9c3f-e9a8939bc811'),(1920,'New and Relapse with document HIV Status','','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n New and Relapse with document HIV Status\n \n \n 2023-03-29 14:22:45 UTC\n \n 2023-03-29 14:30:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1920\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 19:52:45',4,'2023-03-29 20:00:02',4,0,NULL,NULL,NULL,'18152a92-ded2-4f5a-af93-5dd01b51c839'),(1921,'Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : Relapse','Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : Relapse','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : Relapse\n Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : Relapse\n \n 2023-03-29 15:26:50 UTC\n \n 2023-03-29 15:28:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1921\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 17:26:50',4,'2023-03-29 17:28:11',4,0,NULL,NULL,NULL,'61cb2cc7-ee32-4da9-9c82-7bbc85f3e43c'),(1922,'TB Notification - Block 1 ','TB Notification - Block 1 ','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Notification - Block 1 \n TB Notification - Block 1 \n \n 2023-03-29 17:06:10 UTC\n \n 2023-03-29 17:06:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1922\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-03-29 19:06:10',4,'2023-03-29 19:06:58',4,0,NULL,NULL,NULL,'c7604f80-13cf-4773-abf5-b95f35fa1c92'),(1923,'TB Notification - Block 1 Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Notification - Block 1 Data Set\n \n 2023-03-29 17:06:58 UTC\n \n 2023-03-29 17:37:54 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1923\n \n \n \n died1\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n \n \n died2\n \n \n \n \n \n \n \n \n \n died3\n \n \n \n \n \n \n \n \n \n extra1\n \n \n \n \n \n \n \n \n \n extra2\n \n \n \n \n \n \n \n \n \n extra3\n \n \n \n \n \n \n \n \n \n pul1\n \n \n \n \n \n \n \n \n \n pul2\n \n \n \n \n \n \n \n \n \n pul3\n \n \n \n \n \n \n \n \n \n','2023-03-29 19:06:58',4,'2023-03-29 19:37:54',4,0,NULL,NULL,NULL,'d74aa49a-aa20-49e1-939a-5f1fb0c78d81'),(1924,'Children < 15 with Documented HIV Status','Children (0 - 14) with documented HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children < 15 with Documented HIV Status\n Children (0 - 14) with documented HIV Status\n \n 2023-03-29 17:07:40 UTC\n \n 2023-03-29 17:08:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1924\n COUNT\n \n \n \n \n endDate\n ${startDate}\n \n \n location\n ${location}\n \n \n startDate\n ${endDate}\n \n \n \n','2023-03-29 19:07:40',4,'2023-03-29 19:08:45',4,0,NULL,NULL,NULL,'777854f8-1e75-4b4c-9eb5-2b2a23acd1fd'),(1925,'Correctional Staff and inmates with Documented HIV Status','High risk population of Correctional Staff and inmates with Documented HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Correctional Staff and inmates with Documented HIV Status\n High risk population of Correctional Staff and inmates with Documented HIV Status\n \n 2023-03-29 17:11:52 UTC\n \n 2023-03-29 17:16:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1925\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 19:11:52',4,'2023-03-29 19:16:20',4,0,NULL,NULL,NULL,'8e2ae589-9a13-4aa5-bf9d-3cf376a59bf6'),(1926,'Ex-Miners with Documented HIV Status','High risk population of Ex Miners with Documented HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Ex-Miners with Documented HIV Status\n High risk population of Ex Miners with Documented HIV Status\n \n 2023-03-29 17:20:28 UTC\n \n 2023-03-29 17:23:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1926\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 19:20:28',4,'2023-03-29 19:23:06',4,0,NULL,NULL,NULL,'b2541e20-b6b8-4985-bd4a-9a980ee5ebf8'),(1927,'Factory Workers with Documented HIV Status','High risk population of Factory Workers with Documented HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Factory Workers with Documented HIV Status\n High risk population of Factory Workers with Documented HIV Status\n \n 2023-03-29 17:25:11 UTC\n \n 2023-03-29 17:29:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1927\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 19:25:11',4,'2023-03-29 19:29:17',4,0,NULL,NULL,NULL,'e95e9d48-01d5-4826-ab2c-82dbd2dfce44'),(1928,'Health workers with Documented HIV Status','High risk population of Health workers with Documented HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Health workers with Documented HIV Status\n High risk population of Health workers with Documented HIV Status\n \n 2023-03-29 17:31:28 UTC\n \n 2023-03-29 17:33:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1928\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 19:31:28',4,'2023-03-29 19:33:36',4,0,NULL,NULL,NULL,'38dd8693-21f8-40c2-ba3a-9f5d1a63959c'),(1929,'HHCM with Documented HIV Status','High risk population of HHCM with Documented HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM with Documented HIV Status\n High risk population of HHCM with Documented HIV Status\n \n 2023-03-29 17:34:59 UTC\n \n 2023-03-29 17:36:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1929\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 19:34:59',4,'2023-03-29 19:36:32',4,0,NULL,NULL,NULL,'12a86c02-9e39-4d69-8082-ecff9269d106'),(1930,'Miners with Documented HIV Status','High risk population of miners with documented HIV','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Miners with Documented HIV Status\n High risk population of miners with documented HIV\n \n 2023-03-29 17:39:04 UTC\n \n 2023-03-29 17:42:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1930\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 19:39:04',4,'2023-03-29 19:42:27',4,0,NULL,NULL,NULL,'625cc3fd-4dc5-4aee-9fba-2559b31470c8'),(1931,'Public transport operators with Documented HIV Status','High risk population of Public transport operators with Documented HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Public transport operators with Documented HIV Status\n High risk population of Public transport operators with Documented HIV Status\n \n 2023-03-29 19:32:07 UTC\n \n 2023-03-29 19:33:35 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1931\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 21:32:07',4,'2023-03-29 21:33:35',4,0,NULL,NULL,NULL,'9e48b5ef-99df-44e7-8946-2728727e08a1'),(1932,'Retreatment with documented HIV status','Retreatment Excl. Relapse client with documented HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Retreatment with documented HIV status\n Retreatment Excl. Relapse client with documented HIV Status\n \n 2023-03-29 19:35:36 UTC\n \n 2023-03-29 19:36:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1932\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 21:35:36',4,'2023-03-29 21:36:55',4,0,NULL,NULL,NULL,'5cc834ec-7c90-4063-b684-2c9da8ddc83e'),(1933,'Children < 15 with Positive HIV Status','High risk population for Children < 15 with Positive HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children < 15 with Positive HIV Status\n High risk population for Children < 15 with Positive HIV Status\n \n 2023-03-29 19:40:57 UTC\n \n 2023-03-29 19:42:25 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1933\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 21:40:57',4,'2023-03-29 21:42:25',4,0,NULL,NULL,NULL,'9ceb1ec0-0b28-49d8-a6ba-90297cae2968'),(1934,'Correctional Staff and inmates with Positive HIV Status',' High risk population of Correctional Staff and inmates with Positive HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Correctional Staff and inmates with Positive HIV Status\n High risk population of Correctional Staff and inmates with Positive HIV Status\n \n 2023-03-29 19:44:28 UTC\n \n 2023-03-29 19:45:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1934\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 21:44:28',4,'2023-03-29 21:45:44',4,0,NULL,NULL,NULL,'c9be5185-942d-41ae-8e15-c3ddea7bb22f'),(1935,'Ex-Miners with Positive HIV Status','High risk population of Ex Miners with Positive HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Ex-Miners with Positive HIV Status\n High risk population of Ex Miners with Positive HIV Status\n \n 2023-03-29 19:47:14 UTC\n \n 2023-03-29 19:50:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1935\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 21:47:14',4,'2023-03-29 21:50:01',4,0,NULL,NULL,NULL,'51933c5f-9020-417a-91fe-77cb0412d9ee'),(1936,'Factory Workers with Positive HIV Status','High risk population of Factory Workers with Positive HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Factory Workers with Positive HIV Status\n High risk population of Factory Workers with Positive HIV Status\n \n 2023-03-29 19:52:48 UTC\n \n 2023-03-29 19:56:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1936\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 21:52:48',4,'2023-03-29 21:56:43',4,0,NULL,NULL,NULL,'a72725b5-eac8-4f97-b285-3a9db174ab39'),(1937,'Health workers with Positive HIV Status',' High risk population of Health workers with Positive HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Health workers with Positive HIV Status\n High risk population of Health workers with Positive HIV Status\n \n 2023-03-29 19:59:20 UTC\n \n 2023-03-29 20:04:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1937\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 21:59:20',4,'2023-03-29 22:04:12',4,0,NULL,NULL,NULL,'317c0cce-c0d7-44da-9272-62cc9279a76c'),(1938,'HHCM with Positive HIV Status',' High risk population of HHCM with Positive HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM with Positive HIV Status\n High risk population of HHCM with Positive HIV Status\n \n 2023-03-29 20:05:19 UTC\n \n 2023-03-29 20:09:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1938\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 22:05:19',4,'2023-03-29 22:09:51',4,0,NULL,NULL,NULL,'7a7dee7e-a318-4819-96e9-a1c8fe3e0a4f'),(1939,'HHXM with Positive HIV Status','High risk population of HHXM with Positive HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM with Positive HIV Status\n High risk population of HHXM with Positive HIV Status\n \n 2023-03-29 20:10:54 UTC\n \n 2023-03-29 20:11:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1939\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 22:10:54',4,'2023-03-29 22:11:59',4,0,NULL,NULL,NULL,'4a4bc063-3233-4b3f-9776-8949a2a3104c'),(1940,'Miners with Positive HIV Status','High risk population of miners with Positive HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Miners with Positive HIV Status\n High risk population of miners with Positive HIV Status\n \n 2023-03-29 20:13:09 UTC\n \n 2023-03-29 20:15:52 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1940\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 22:13:09',4,'2023-03-29 22:15:52',4,0,NULL,NULL,NULL,'a555cd0b-41bf-4ba0-bc0a-bb84952305d7'),(1941,'New and Relapse with Positive HIV Status','New and Relapse with Positive HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n New and Relapse with Positive HIV Status\n New and Relapse with Positive HIV Status\n \n 2023-03-29 20:17:12 UTC\n \n 2023-03-29 20:37:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1941\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 22:17:12',4,'2023-03-29 22:37:39',4,0,NULL,NULL,NULL,'5212b24d-abdf-416a-812e-72b4f64b342d'),(1942,'Public transport with Positive HIV Status','High risk population of Public transport operators with Positive HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Public transport with Positive HIV Status\n High risk population of Public transport operators with Positive HIV Status\n \n 2023-03-29 20:38:50 UTC\n \n 2023-03-29 20:39:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1942\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 22:38:50',4,'2023-03-29 22:39:44',4,0,NULL,NULL,NULL,'3ada2309-e8f6-4301-ae89-63837fb6f36b'),(1943,'Retreatment with Positive HIV status','Retreatment Excl. Relapse with Positive HIV status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Retreatment with Positive HIV status\n Retreatment Excl. Relapse with Positive HIV status\n \n 2023-03-29 20:41:12 UTC\n \n 2023-03-29 20:42:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1943\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 22:41:12',4,'2023-03-29 22:42:06',4,0,NULL,NULL,NULL,'ee1b5901-9777-44c1-affd-37e3aba4746a'),(1944,'Children < 15 with HIV Positive on ART','High risk population for Children < 15 with HIV Positive on ART','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children < 15 with HIV Positive on ART\n High risk population for Children < 15 with HIV Positive on ART\n \n 2023-03-29 20:43:47 UTC\n \n 2023-03-29 20:55:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1944\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 22:43:47',4,'2023-03-29 22:55:26',4,0,NULL,NULL,NULL,'f636be9d-0527-4054-9822-6ab005267560'),(1945,'Correctional Staff and inmates on HIV Positive on ART','High risk population of Correctional Staff and inmates on HIV Positive on ART','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Correctional Staff and inmates on HIV Positive on ART\n High risk population of Correctional Staff and inmates on HIV Positive on ART\n \n 2023-03-29 20:56:54 UTC\n \n 2023-03-29 20:59:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1945\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 22:56:54',4,'2023-03-29 22:59:44',4,0,NULL,NULL,NULL,'2c07cd7e-cc23-4974-9964-602e576ef80d'),(1946,'Ex Miner with with HIV Positive on ART','High risk population of Ex Miner with with HIV Positive on ART','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Ex Miner with with HIV Positive on ART\n High risk population of Ex Miner with with HIV Positive on ART\n \n 2023-03-29 21:01:08 UTC\n \n 2023-03-29 21:05:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1946\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 23:01:08',4,'2023-03-29 23:05:53',4,0,NULL,NULL,NULL,'8df71093-9cb8-4d1d-9885-fb4415f8c1b2'),(1947,'Factory Workers with HIV Positive on ART','High risk population of Factory Workers with HIV Positive on ART','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Factory Workers with HIV Positive on ART\n High risk population of Factory Workers with HIV Positive on ART\n \n 2023-03-29 21:07:39 UTC\n \n 2023-03-29 21:11:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1947\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 23:07:39',4,'2023-03-29 23:11:51',4,0,NULL,NULL,NULL,'6d1a75ee-e860-483d-ad80-4308d1009c22'),(1948,'Health workers with HIV Positive on ART',' High risk population of Health workers with HIV Positive on ART','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Health workers with HIV Positive on ART\n High risk population of Health workers with HIV Positive on ART\n \n 2023-03-29 21:13:26 UTC\n \n 2023-03-29 21:17:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1948\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 23:13:26',4,'2023-03-29 23:17:08',4,0,NULL,NULL,NULL,'b3813228-7114-4e37-b997-6acebccd724a'),(1949,'HHCM with with HIV Positive on ART','High risk population of HHCM with with HIV Positive on ART','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM with with HIV Positive on ART\n High risk population of HHCM with with HIV Positive on ART\n \n 2023-03-29 21:18:20 UTC\n \n 2023-03-29 21:19:22 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1949\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 23:18:20',4,'2023-03-29 23:19:22',4,0,NULL,NULL,NULL,'360494e1-ccad-4e72-bf80-c564f2cfe18b'),(1950,'HHXM with HIV Positive on ART','High risk population of HHXM with HIV Positive on ART','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM with HIV Positive on ART\n High risk population of HHXM with HIV Positive on ART\n \n 2023-03-29 21:20:51 UTC\n \n 2023-03-29 21:25:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1950\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 23:20:51',4,'2023-03-29 23:25:50',4,0,NULL,NULL,NULL,'ce4eaae7-7985-4e89-ab65-3b0c1686f80e'),(1951,'Miners with HIV Positive on ART','High risk population of Miners with HIV Positive on ART','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Miners with HIV Positive on ART\n High risk population of Miners with HIV Positive on ART\n \n 2023-03-29 21:27:27 UTC\n \n 2023-03-29 21:30:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1951\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 23:27:27',4,'2023-03-29 23:30:27',4,0,NULL,NULL,NULL,'19d13a38-7625-4136-b870-a7facc92ecb3'),(1952,'New and Relapse with HIV Positive on ART','High risk population of New and Relapse with HIV Positive on ART','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n New and Relapse with HIV Positive on ART\n High risk population of New and Relapse with HIV Positive on ART\n \n 2023-03-29 21:33:41 UTC\n \n 2023-03-29 21:36:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1952\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 23:33:41',4,'2023-03-29 23:36:00',4,0,NULL,NULL,NULL,'86db5b09-049a-4be4-a35f-f02f9de644f6'),(1953,'Public transport operators with HIV Positive on ART','High risk population of Public transport operators with HIV Positive on ART','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Public transport operators with HIV Positive on ART\n High risk population of Public transport operators with HIV Positive on ART\n \n 2023-03-29 21:37:07 UTC\n \n 2023-03-29 21:38:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1953\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 23:37:07',4,'2023-03-29 23:38:05',4,0,NULL,NULL,NULL,'ebbb00b2-3779-47b8-8265-c8afea8a5ac1'),(1954,'Retreatment with HIV Positive on ART','High risk population of Retreatment Excl. Relapse HIV Positive on ART','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Retreatment with HIV Positive on ART\n High risk population of Retreatment Excl. Relapse HIV Positive on ART\n \n 2023-03-29 21:39:16 UTC\n \n 2023-03-29 21:40:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1954\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 23:39:16',4,'2023-03-29 23:40:08',4,0,NULL,NULL,NULL,'2ffdb12c-d02b-4e9a-a1dc-6e4974093b5a'),(1955,'Children < 15 with Positive HIV on CPT/Dapzone','Children < 15 with Positive HIV on CPT/Dapzone','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children < 15 with Positive HIV on CPT/Dapzone\n Children < 15 with Positive HIV on CPT/Dapzone\n \n 2023-03-29 21:44:42 UTC\n \n 2023-03-29 21:47:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1955\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 23:44:42',4,'2023-03-29 23:47:53',4,0,NULL,NULL,NULL,'78313782-541c-4568-956c-9fb7bf92c08b'),(1956,'Correctional Staff and inmates with HIV Positive on CPT/Dapzone','High risk population of Correctional Staff and inmates with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Correctional Staff and inmates with HIV Positive on CPT/Dapzone\n High risk population of Correctional Staff and inmates with HIV Positive on CPT/Dapzone\n \n 2023-03-29 21:54:08 UTC\n \n 2023-03-29 21:56:48 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1956\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 23:54:08',4,'2023-03-29 23:56:48',4,0,NULL,NULL,NULL,'46e76f2a-4fc0-40cf-be9d-61565edbe566'),(1957,'Ex Miner with HIV Positive on CPT/Dapzone','High risk population of Ex Miner with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Ex Miner with HIV Positive on CPT/Dapzone\n High risk population of Ex Miner with HIV Positive on CPT/Dapzone\n \n 2023-03-29 21:58:20 UTC\n \n 2023-03-29 21:59:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1957\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 23:58:20',4,'2023-03-29 23:59:20',4,0,NULL,NULL,NULL,'348df991-95e1-4724-8df6-e4d905d67b11'),(1958,'Factory Workers with HIV Positive on CPT/Dapzone','High risk population of Factory Workers with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Factory Workers with HIV Positive on CPT/Dapzone\n High risk population of Factory Workers with HIV Positive on CPT/Dapzone\n \n 2023-03-29 22:00:58 UTC\n \n 2023-03-29 22:02:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1958\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-30 00:00:58',4,'2023-03-30 00:02:05',4,0,NULL,NULL,NULL,'5ce50877-ee92-48de-bfa7-a863b735975e'),(1959,'Health workers with HIV Positive on CPT/Dapzone','High risk population of Health workers with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Health workers with HIV Positive on CPT/Dapzone\n High risk population of Health workers with HIV Positive on CPT/Dapzone\n \n 2023-03-29 22:03:33 UTC\n \n 2023-03-29 22:06:16 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1959\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-30 00:03:33',4,'2023-03-30 00:06:16',4,0,NULL,NULL,NULL,'e47447de-6a64-422f-abe3-c281d2b4431c'),(1960,'HHCM with HIV Positive on CPT/Dapzone','High risk population of HHCM with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM with HIV Positive on CPT/Dapzone\n High risk population of HHCM with HIV Positive on CPT/Dapzone\n \n 2023-03-29 22:08:00 UTC\n \n 2023-03-29 22:09:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1960\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-30 00:08:00',4,'2023-03-30 00:09:04',4,0,NULL,NULL,NULL,'02d9a185-dc0e-4852-8176-c4da69705d5d'),(1961,'HHXM with HIV Positive on CPT/Dapzone','High risk population of HHXM with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM with HIV Positive on CPT/Dapzone\n High risk population of HHXM with HIV Positive on CPT/Dapzone\n \n 2023-03-29 22:10:38 UTC\n \n 2023-03-29 22:11:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1961\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-30 00:10:38',4,'2023-03-30 00:11:51',4,0,NULL,NULL,NULL,'c86cc664-d513-4afe-97b9-8163b4bb39d1'),(1962,'Miners with HIV Positive on CPT/Dapzone','High risk population Miners with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Miners with HIV Positive on CPT/Dapzone\n High risk population Miners with HIV Positive on CPT/Dapzone\n \n 2023-03-29 22:13:17 UTC\n \n 2023-03-29 22:15:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1962\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-30 00:13:17',4,'2023-03-30 00:15:15',4,0,NULL,NULL,NULL,'7751e110-9e34-453e-bd9f-792272cbd895'),(1963,'New and Relapse with HIV Positive on CPT/Dapzone','High risk population of New and Relapse with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n New and Relapse with HIV Positive on CPT/Dapzone\n High risk population of New and Relapse with HIV Positive on CPT/Dapzone\n \n 2023-03-29 22:16:42 UTC\n \n 2023-03-29 22:18:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1963\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-30 00:16:42',4,'2023-03-30 00:18:40',4,0,NULL,NULL,NULL,'2ebc8503-89e4-41f4-bdaf-e9e1d041a147'),(1964,'Public transport operators with HIV Positive on CPT/Dapzone','High risk population of Public transport operators with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Public transport operators with HIV Positive on CPT/Dapzone\n High risk population of Public transport operators with HIV Positive on CPT/Dapzone\n \n 2023-03-30 08:39:11 UTC\n \n 2023-03-30 08:40:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1964\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-30 10:39:11',4,'2023-03-30 10:40:29',4,0,NULL,NULL,NULL,'575068b5-f0ca-4d5b-8181-663b5feded65'),(1965,'Retreatment with HIV Positive on CPT/Dapzone','Retreatment Excl. Relapse with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Retreatment with HIV Positive on CPT/Dapzone\n Retreatment Excl. Relapse with HIV Positive on CPT/Dapzone\n \n 2023-03-30 08:41:45 UTC\n \n 2023-03-30 08:48:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1965\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-30 10:41:45',4,'2023-03-30 10:48:08',4,0,NULL,NULL,NULL,'22dbd0dd-a4ca-42a5-986e-6c0012eb55b1'),(1966,'HHXM with Documented HIV Status','High risk population of HHXM with Documented HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM with Documented HIV Status\n High risk population of HHXM with Documented HIV Status\n \n 2023-03-30 09:03:54 UTC\n \n 2023-03-30 09:06:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1966\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-30 11:03:54',4,'2023-03-30 11:06:14',4,0,NULL,NULL,NULL,'e5de47f6-aa7a-4b2d-bd72-83e5458977d6'),(1967,'TB Notification - Block 4','TB Notification - Block 4','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Notification - Block 4\n TB Notification - Block 4\n \n 2023-03-30 09:18:19 UTC\n \n 2023-03-30 20:54:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1967\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-03-30 11:18:19',4,'2023-03-30 22:54:40',4,0,NULL,NULL,NULL,'0b9affca-ad93-42fb-bd49-57380f721a08'),(1968,'TBNotification - Block 4 Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TBNotification - Block 4 Data Set\n \n 2023-03-30 09:18:47 UTC\n \n 2023-03-30 20:50:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1968\n \n \n DM_Sex\n \n \n \n \n \n \n \n \n ARTChild_F\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n \n \n \n ARTChild_M\n \n \n \n \n DM_Sex\n Males\n \n \n \n \n \n ARTCo&In_F\n \n \n \n \n \n \n \n \n \n ARTCo&In_M\n \n \n \n \n \n \n ARTFacW_F\n \n \n \n \n \n \n \n \n \n ARTFacW_M\n \n \n \n \n \n \n ARTHHCM_F\n \n \n \n \n \n \n \n \n \n ARTHHCM_M\n \n \n \n \n \n \n ARTHHXM_F\n \n \n \n \n \n \n \n \n \n ARTHHXM_M\n \n \n \n \n \n \n ARTHeaW_F\n \n \n \n \n \n \n \n \n \n ARTHeaW_M\n \n \n \n \n \n \n ARTMiner_F\n \n \n \n \n \n \n \n \n \n ARTMiner_M\n \n \n \n \n \n \n ARTNw&Rl_F\n \n \n \n \n \n \n \n \n \n ARTNw&Rl_M\n \n \n \n \n \n \n ARTRetr_F\n \n \n \n \n \n \n \n \n \n ARTRetr_M\n \n \n \n \n \n \n ARTTrans_F\n \n \n \n \n \n \n \n \n \n ARTTrans_M\n \n \n \n \n \n \n ARTXMine_F\n \n \n \n \n \n \n \n \n \n ARTXMine_M\n \n \n \n \n \n \n DapChild_F\n \n \n \n \n \n \n \n \n \n DapChild_M\n \n \n \n \n \n \n DapCo&In_F\n \n \n \n \n \n \n \n \n \n DapCo&In_M\n \n \n \n \n \n \n DapFacW_F\n \n \n \n \n \n \n \n \n \n DapFacW_M\n \n \n \n \n \n \n DapHHCM_F\n \n \n \n \n \n \n \n \n \n DapHHCM_M\n \n \n \n \n \n \n DapHHXM_F\n \n \n \n \n \n \n \n \n \n DapHHXM_M\n \n \n \n \n \n \n DapHeaW_F\n \n \n \n \n \n \n \n \n \n DapHeaW_M\n \n \n \n \n \n \n DapMiner_F\n \n \n \n \n \n \n \n \n \n DapMiner_M\n \n \n \n \n \n \n DapNw&Rl_F\n \n \n \n \n \n \n \n \n \n DapNw&Rl_M\n \n \n \n \n \n \n DapRetre_F\n \n \n \n \n \n \n \n \n \n DapRetre_M\n \n \n \n \n \n \n DapTrans_F\n \n \n \n \n \n \n \n \n \n DapTrans_M\n \n \n \n \n \n \n DapXMine_F\n \n \n \n \n \n \n \n \n \n DapXMine_M\n \n \n \n \n \n \n PosChild_F\n \n \n \n \n \n \n \n \n \n PosChild_M\n \n \n \n \n \n \n PosCo&In_F\n \n \n \n \n \n \n \n \n \n PosCo&In_M\n \n \n \n \n \n \n PosFacW_F\n \n \n \n \n \n \n \n \n \n PosFacW_M\n \n \n \n \n \n \n PosHHCM_F\n \n \n \n \n \n \n \n \n \n PosHHCM_M\n \n \n \n \n \n \n PosHHXM_F\n \n \n \n \n \n \n \n \n \n PosHHXM_M\n \n \n \n \n \n \n PosHeaW_F\n \n \n \n \n \n \n \n \n \n PosHeaW_M\n \n \n \n \n \n \n PosMiner_F\n \n \n \n \n \n \n \n \n \n PosMiner_M\n \n \n \n \n \n \n PosNw&Rs_F\n \n \n \n \n \n \n \n \n \n PosNw&Rs_M\n \n \n \n \n \n \n PosRetr_F\n \n \n \n \n \n \n \n \n \n PosRetr_M\n \n \n \n \n \n \n PosTrans_F\n \n \n \n \n \n \n \n \n \n PosTrans_M\n \n \n \n \n \n \n PosXMine_F\n \n \n \n \n \n \n \n \n \n PosXMine_M\n \n \n \n \n \n \n StsChild_F\n \n \n \n \n \n \n \n \n \n StsChild_M\n \n \n \n \n \n \n StsCo&In_F\n \n \n \n \n \n \n \n \n \n StsCo&In_M\n \n \n \n \n \n \n StsFacW_F\n \n \n \n \n \n \n \n \n \n StsFacW_M\n \n \n \n \n \n \n StsHHCM_F\n \n \n \n \n \n \n \n \n \n StsHHCM_M\n \n \n \n \n \n \n StsHHXM_F\n \n \n \n \n \n \n \n \n \n StsHHXM_M\n \n \n \n \n \n \n StsHeaW_F\n \n \n \n \n \n \n \n \n \n StsHeaW_M\n \n \n \n \n \n \n StsMin_F\n \n \n \n \n \n \n \n \n \n StsMin_M\n \n \n \n \n \n \n StsNw&Rs_F\n \n \n \n \n \n \n \n \n \n StsNw&Rs_M\n \n \n \n \n \n \n StsRetre_F\n \n \n \n \n \n \n \n \n \n StsRetre_M\n \n \n \n \n \n \n StsTrans_F\n \n \n \n \n \n \n \n \n \n StsTrans_M\n \n \n \n \n \n \n StsXMin_F\n \n \n \n \n \n \n \n \n \n StsXMin_M\n \n \n \n \n \n \n','2023-03-30 11:18:47',4,'2023-03-30 22:50:08',4,0,NULL,NULL,NULL,'e08d273c-ba6d-4085-bf72-b7f6737396bf'),(1969,'TB_OUTCOMES','TB Outcomes','org.openmrs.module.reporting.indicator.dimension.Dimension','org.openmrs.module.reporting.indicator.dimension.CohortDefinitionDimension','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB_OUTCOMES\n TB Outcomes\n \n 2023-03-30 13:48:45 UTC\n \n 2023-03-30 14:06:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1969\n \n \n Competed\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-03-30 15:48:45',4,'2023-03-30 16:06:44',4,0,NULL,NULL,NULL,'2244b6f7-5dd0-4c8a-8a9e-67bac3fe7d9b'),(1970,'test','test','org.openmrs.module.reporting.indicator.dimension.Dimension','org.openmrs.module.reporting.indicator.dimension.CohortDefinitionDimension','org.openmrs.module.reporting.serializer.ReportingSerializer','\n test\n test\n \n 2023-03-30 14:06:01 UTC\n \n \n','2023-03-30 16:06:01',4,NULL,NULL,0,NULL,NULL,NULL,'a572d104-f644-42bb-ae58-7c83ac0747ad'),(1971,'TB New and Relapse Completed','TB New and Relapse Completed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB New and Relapse Completed\n TB New and Relapse Completed\n \n 2023-03-30 14:58:43 UTC\n \n 2023-03-30 14:59:47 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1971\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- TB History of previous treatment \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3785 and o.value_coded in (1034,1084) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 2242 and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 16:58:43',4,'2023-03-30 16:59:47',4,0,NULL,NULL,NULL,'1540870d-551a-4e11-baad-70ed9b13289a'),(1972,'TB New and Relapse Cured','TB New and Relapse Cured','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB New and Relapse Cured\n TB New and Relapse Cured\n \n 2023-03-30 15:04:42 UTC\n \n 2023-03-30 15:06:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1972\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- TB History of previous treatment(New AND Relapse) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3785 and o.value_coded in (1034,1084) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 1068 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 17:04:42',4,'2023-03-30 17:06:17',4,0,NULL,NULL,NULL,'22e1906b-16cd-4109-b529-a043e43ff3d4'),(1973,'TB New and Relapse Died','TB New and Relapse Died','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB New and Relapse Died\n TB New and Relapse Died\n \n 2023-03-30 15:08:32 UTC\n \n 2023-03-30 15:09:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1973\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- TB History of previous treatment(New AND Relapse) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3785 and o.value_coded in (1034,1084) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3650 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 17:08:32',4,'2023-03-30 17:09:15',4,0,NULL,NULL,NULL,'19636929-afd0-4ba0-acfa-bbe325e1f002'),(1974,'TB New and Relapse Lost to Follow-up','TB New and Relapse Lost to Follow-up','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB New and Relapse Lost to Follow-up\n TB New and Relapse Lost to Follow-up\n \n 2023-03-30 15:10:23 UTC\n \n 2023-03-30 15:10:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1974\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- TB History of previous treatment(New AND Relapse) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3785 and o.value_coded in (1034,1084) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 2302 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 17:10:23',4,'2023-03-30 17:10:58',4,0,NULL,NULL,NULL,'87260731-779f-4244-9480-f75169dd2fbf'),(1975,'TB New and Relapse Failed (Susceptible)','TB New and Relapse Failed (Susceptible)','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB New and Relapse Failed (Susceptible)\n TB New and Relapse Failed (Susceptible)\n \n 2023-03-30 15:11:55 UTC\n \n 2023-03-30 15:31:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1975\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- TB History of previous treatment(New AND Relapse) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3785 and o.value_coded in (1034,1084) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3793 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 17:11:55',4,'2023-03-30 17:31:39',4,0,NULL,NULL,NULL,'53aec520-fab0-4871-b46f-209c32b921c1'),(1976,'TB New and Relapse Not Evaluated','TB New and Relapse Not Evaluated','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB New and Relapse Not Evaluated\n TB New and Relapse Not Evaluated\n \n 2023-03-30 15:13:29 UTC\n \n 2023-03-30 16:05:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1976\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- TB History of previous treatment(New AND Relapse) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3785 and o.value_coded in (1034,1084) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id not in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded in (1068,2242,3650,2302,3793,3794) \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 17:13:29',4,'2023-03-30 18:05:12',4,0,NULL,NULL,NULL,'0af163fd-0d3c-4b6a-a84e-1648cd9bb042'),(1977,'exMiner_cured','Ex miner cured','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n exMiner_cured\n Ex miner cured\n \n 2023-03-30 15:21:40 UTC\n \n 2023-03-30 15:47:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1977\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3668 \n and ob.voided = 0 \n ) \n and o.person_id in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded = 1068 \n and b.voided = 0 \n ) \n\n','2023-03-30 17:21:40',4,'2023-03-30 17:47:23',4,0,NULL,NULL,NULL,'4c2c88ec-ee4e-4bad-962d-229983982f12'),(1978,'exMiner_completed','Ex miner completed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n exMiner_completed\n Ex miner completed\n \n 2023-03-30 15:24:54 UTC\n \n 2023-03-30 15:45:56 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1978\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3668 \n and ob.voided = 0 \n ) \n and o.person_id in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded = 2242 \n and b.voided = 0 \n ) \n\n','2023-03-30 17:24:54',4,'2023-03-30 17:45:56',4,0,NULL,NULL,NULL,'37afe774-0ef1-4152-8ab9-fe702f175f36'),(1979,'exMiner_died','Ex Miner died','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n exMiner_died\n Ex Miner died\n \n 2023-03-30 15:28:17 UTC\n \n 2023-04-03 07:35:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1979\n select distinct o.person_id \n \n \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3668 \n and ob.voided = 0 \n ) \n and o.person_id in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded = 3650 and b.voided = 0 \n ) \n\n','2023-03-30 17:28:17',4,'2023-04-03 09:35:05',4,0,NULL,NULL,NULL,'d08b3fb0-d1c2-455d-89a6-f3c9a1469a3e'),(1980,'TB New and Relapse Completed Moved to second line treatment','TB New and Relapse Completed Moved to second line treatment','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB New and Relapse Completed Moved to second line treatment\n TB New and Relapse Completed Moved to second line treatment\n \n 2023-03-30 15:33:00 UTC\n \n 2023-03-30 15:33:47 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1980\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- TB History of previous treatment(New AND Relapse) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3785 and o.value_coded in (1034,1084) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3794 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 17:33:00',4,'2023-03-30 17:33:47',4,0,NULL,NULL,NULL,'d2ff18e1-1cf3-4bff-9796-e35aaf019b40'),(1981,'exMiner_failedSusceptive','Ex miner failed suceptive','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n exMiner_failedSusceptive\n Ex miner failed suceptive\n \n 2023-03-30 15:40:13 UTC\n \n 2023-04-03 10:56:48 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1981\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3668 \n and ob.voided = 0 \n ) \n and o.person_id in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded = 3793 \n and b.voided = 0 \n ) \n\n','2023-03-30 17:40:13',4,'2023-04-03 12:56:48',4,0,NULL,NULL,NULL,'8c7c6720-c1aa-492a-be1b-47edc57cfd55'),(1982,'exMiner_lost','Ex miner lost','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n exMiner_lost\n Ex miner lost\n \n 2023-03-30 15:42:32 UTC\n \n 2023-03-30 15:49:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1982\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3668 \n and ob.voided = 0 \n ) \n and o.person_id in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded = 2302 \n and b.voided = 0 \n ) \n\n','2023-03-30 17:42:32',4,'2023-03-30 17:49:29',4,0,NULL,NULL,NULL,'cb57dd5b-22ae-42d9-a86a-6927e9aae9cb'),(1983,'TB Retreatment excluding Relapse and Completed','TB Retreatment excluding Relapse and Completed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Retreatment excluding Relapse and Completed\n TB Retreatment excluding Relapse and Completed\n \n 2023-03-30 15:43:38 UTC\n \n 2023-03-30 15:44:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1983\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- TB History of previous treatment(Retreatment Excluding Relapse) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3785 and o.value_coded in (3786,1037) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 2242 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 17:43:38',4,'2023-03-30 17:44:32',4,0,NULL,NULL,NULL,'93eefc43-0eba-4a27-8d7e-72958dc0b2f1'),(1984,'exMiner_movedSecondLIne','Ex miner moved to second line','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n exMiner_movedSecondLIne\n Ex miner moved to second line\n \n 2023-03-30 15:44:13 UTC\n \n 2023-03-30 15:44:34 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1984\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3668 \n and ob.voided = 0 \n ) \n and o.person_id in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded = 3794 \n and b.voided = 0 \n ) \n\n','2023-03-30 17:44:13',4,'2023-03-30 17:44:34',4,0,NULL,NULL,NULL,'846e0252-747b-4457-b0f4-6f23ed244706'),(1985,'TB Retreatment excluding Relapse and Cured','TB Retreatment excluding Relapse and Cured','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Retreatment excluding Relapse and Cured\n TB Retreatment excluding Relapse and Cured\n \n 2023-03-30 15:45:00 UTC\n \n 2023-03-30 15:45:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1985\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- TB History of previous treatment(Retreatment Excluding Relapse) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3785 and o.value_coded in (3786,1037) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 1068 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 17:45:00',4,'2023-03-30 17:45:29',4,0,NULL,NULL,NULL,'1cd8596a-21ba-4a7b-b3c6-c82fb756bf8f'),(1986,'TB Retreatment excluding Relapse and Died','TB Retreatment excluding Relapse and Died','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Retreatment excluding Relapse and Died\n TB Retreatment excluding Relapse and Died\n \n 2023-03-30 15:45:57 UTC\n \n 2023-03-30 15:46:22 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1986\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- TB History of previous treatment(Retreatment Excluding Relapse) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3785 and o.value_coded in (3786,1037) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3650 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 17:45:57',4,'2023-03-30 17:46:22',4,0,NULL,NULL,NULL,'50001a13-545a-4de2-9617-86c8b262eb9d'),(1987,'TB Retreatment excluding Relapse and Lost to Follow up','TB Retreatment excluding Relapse and Lost to Follow up','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Retreatment excluding Relapse and Lost to Follow up\n TB Retreatment excluding Relapse and Lost to Follow up\n \n 2023-03-30 15:47:18 UTC\n \n 2023-03-30 15:47:57 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1987\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- TB History of previous treatment(Retreatment Excluding Relapse) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3785 and o.value_coded in (3786,1037) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 2302 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 17:47:18',4,'2023-03-30 17:47:57',4,0,NULL,NULL,NULL,'46fbbe80-0f0e-4cf5-8f4d-04444b70d3bc'),(1988,'TB Retreatment excluding Relapse and Failed (Susceptible)','TB Retreatment excluding Relapse and Failed (Susceptible)','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Retreatment excluding Relapse and Failed (Susceptible)\n TB Retreatment excluding Relapse and Failed (Susceptible)\n \n 2023-03-30 15:49:14 UTC\n \n 2023-03-30 15:49:46 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1988\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- TB History of previous treatment(Retreatment Excluding Relapse) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3785 and o.value_coded in (3786,1037) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3793 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 17:49:14',4,'2023-03-30 17:49:46',4,0,NULL,NULL,NULL,'0b97c9a2-f4f0-460c-9a6a-943f0d0b9bac'),(1989,'TB Retreatment excluding Relapse and Not Evaluated','TB Retreatment excluding Relapse and Not Evaluated','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Retreatment excluding Relapse and Not Evaluated\n TB Retreatment excluding Relapse and Not Evaluated\n \n 2023-03-30 15:51:27 UTC\n \n 2023-03-30 16:03:56 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1989\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- TB History of previous treatment(Retreatment Excluding Relapse) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3785 and o.value_coded in (3786,1037) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id not in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded in (1068,2242,3650,2302,3793,3794) \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 17:51:27',4,'2023-03-30 18:03:56',4,0,NULL,NULL,NULL,'36e8a6f3-f70c-4d36-ab76-87fba12b426b'),(1990,'exMiner_notEvaluated','Ex miner not evaluated','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n exMiner_notEvaluated\n Ex miner not evaluated\n \n 2023-03-30 15:53:42 UTC\n \n 2023-03-30 16:13:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1990\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3668 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2302,1068,2242,3650,3793,3794) \n and b.voided = 0 \n ) \n\n','2023-03-30 17:53:42',4,'2023-03-30 18:13:01',4,0,NULL,NULL,NULL,'af666d60-a3d1-4f0f-8ac2-1ea8fddbf8cd'),(1991,'FactoryWorker_notEvaluated','Factory worker not evaluated ','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n FactoryWorker_notEvaluated\n Factory worker not evaluated \n \n 2023-03-30 16:17:17 UTC\n \n 2023-03-30 16:18:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1991\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3669 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2302,1068,2242,3650,3793,3794) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:17:17',4,'2023-03-30 18:18:05',4,0,NULL,NULL,NULL,'83566c8a-550c-447e-9745-0df04c89de07'),(1992,'FactoryWorker_curred','Factory worker curred','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n FactoryWorker_curred\n Factory worker curred\n \n 2023-03-30 16:18:46 UTC\n \n 2023-03-30 16:19:13 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1992\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3669 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (1068) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:18:46',4,'2023-03-30 18:19:13',4,0,NULL,NULL,NULL,'40dd9f46-8d30-4426-bffd-0eb772046374'),(1993,'All TB HIV Pos and Completed ','All TB HIV Pos and Completed ','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Pos and Completed \n All TB HIV Pos and Completed \n \n 2023-03-30 16:19:51 UTC\n \n 2023-03-30 16:20:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1993\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All HIV Positives \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 4666 and o.value_coded in (4323,4664) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 2242 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:19:51',4,'2023-03-30 18:20:08',4,0,NULL,NULL,NULL,'6b7c8fdf-00e6-4f52-b0fe-fab2cd9cc15e'),(1994,'FactoryWorker_completed','Factory worker copleted','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n FactoryWorker_completed\n Factory worker copleted\n \n 2023-03-30 16:19:51 UTC\n \n 2023-03-30 16:20:13 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1994\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3669 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2242) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:19:51',4,'2023-03-30 18:20:13',4,0,NULL,NULL,NULL,'4fb972d7-5378-4413-8faf-e9dfc9454cd6'),(1995,'All TB HIV Pos and Cured','All TB HIV Pos and Cured','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Pos and Cured\n All TB HIV Pos and Cured\n \n 2023-03-30 16:20:26 UTC\n \n 2023-03-30 16:20:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1995\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All HIV Positives \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 4666 and o.value_coded in (4323,4664) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 1068 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:20:26',4,'2023-03-30 18:20:55',4,0,NULL,NULL,NULL,'5bd61f52-4224-4de9-82cd-2c6334f665b1'),(1996,'FactoryWorker_died','Factory worker died','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n FactoryWorker_died\n Factory worker died\n \n 2023-03-30 16:21:09 UTC\n \n 2023-03-30 16:21:24 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1996\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3669 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3650) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:21:09',4,'2023-03-30 18:21:24',4,0,NULL,NULL,NULL,'f4cf99eb-4bb4-45c0-a403-086fd4b51c44'),(1997,'All TB HIV Pos and Died','All TB HIV Pos and Died','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Pos and Died\n All TB HIV Pos and Died\n \n 2023-03-30 16:21:20 UTC\n \n 2023-03-30 16:21:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1997\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All HIV Positives \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 4666 and o.value_coded in (4323,4664) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3650 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:21:20',4,'2023-03-30 18:21:50',4,0,NULL,NULL,NULL,'b41362c1-57e7-48a0-99ed-a6241cd9fb3d'),(1998,'FactoryWorker_lost','Factort worker lost to follow up','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n FactoryWorker_lost\n Factort worker lost to follow up\n \n 2023-03-30 16:22:18 UTC\n \n 2023-03-30 16:22:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1998\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3669 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2302) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:22:18',4,'2023-03-30 18:22:39',4,0,NULL,NULL,NULL,'f915f74e-1e06-4639-9070-6d1fa301b432'),(1999,'All TB HIV Pos and Lost to Follow up','All TB HIV Pos and Lost to Follow up','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Pos and Lost to Follow up\n All TB HIV Pos and Lost to Follow up\n \n 2023-03-30 16:22:31 UTC\n \n 2023-03-30 16:22:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1999\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All HIV Positives \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 4666 and o.value_coded in (4323,4664) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 2302 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:22:31',4,'2023-03-30 18:22:58',4,0,NULL,NULL,NULL,'16efd94d-da75-4a5c-8ca9-6364f2fc8396'),(2000,'All TB HIV Pos and Failed (Susceptible)','All TB HIV Pos and Failed (Susceptible)','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Pos and Failed (Susceptible)\n All TB HIV Pos and Failed (Susceptible)\n \n 2023-03-30 16:23:33 UTC\n \n 2023-03-30 16:24:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2000\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All HIV Positives \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 4666 and o.value_coded in (4323,4664) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3793 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:23:33',4,'2023-03-30 18:24:00',4,0,NULL,NULL,NULL,'4dc42500-c285-4548-92ff-842d1b357342'),(2001,'prison_worker_lost','Prison worker lost','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n prison_worker_lost\n Prison worker lost\n \n 2023-03-30 16:24:03 UTC\n \n 2023-03-30 16:24:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2001\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3779 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2302) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:24:03',4,'2023-03-30 18:24:36',4,0,NULL,NULL,NULL,'624478ae-cc98-4b93-b138-4e619755b41a'),(2002,'All TB HIV Pos and Not Evaluated','All TB HIV Pos and Not Evaluated','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Pos and Not Evaluated\n All TB HIV Pos and Not Evaluated\n \n 2023-03-30 16:24:48 UTC\n \n 2023-03-30 16:26:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2002\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All HIV Positives \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 4666 and o.value_coded in (4323,4664) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id not in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded in (1068,2242,3650,2302,3793,3794) \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:24:48',4,'2023-03-30 18:26:26',4,0,NULL,NULL,NULL,'4fe00951-413a-468e-ac7e-016dcf41bed6'),(2003,'FactoryWorker_moved','Facotory worker moved to second line','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n FactoryWorker_moved\n Facotory worker moved to second line\n \n 2023-03-30 16:26:31 UTC\n \n 2023-03-30 16:34:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2003\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3669 \n and ob.voided = 0 \n ) \n and o.person_id in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3794) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:26:31',4,'2023-03-30 18:34:39',4,0,NULL,NULL,NULL,'1a7a972b-4113-414d-8810-46c8df8137e7'),(2004,'All TB HIV Pos and Moved to Secondline','All TB HIV Pos and Moved to Secondline','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Pos and Moved to Secondline\n All TB HIV Pos and Moved to Secondline\n \n 2023-03-30 16:27:16 UTC\n \n 2023-03-30 16:27:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2004\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All HIV Positives \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 4666 and o.value_coded in (4323,4664) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3794 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:27:16',4,'2023-03-30 18:27:43',4,0,NULL,NULL,NULL,'57ddf49d-b53d-48ce-a67d-3ce6398f3e2c'),(2005,'All TB HIV Neg and Completed','All TB HIV Neg and Completed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Neg and Completed\n All TB HIV Neg and Completed\n \n 2023-03-30 16:29:02 UTC\n \n 2023-03-30 16:30:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2005\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All HIV Negatives \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 4666 and o.value_coded in (4324,4665) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 2242 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:29:02',4,'2023-03-30 18:30:27',4,0,NULL,NULL,NULL,'63a92814-2f34-4018-b7d0-47659892369d'),(2006,'All TB HIV Neg and Cured','All TB HIV Neg and Cured','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Neg and Cured\n All TB HIV Neg and Cured\n \n 2023-03-30 16:30:51 UTC\n \n 2023-03-30 16:31:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2006\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All HIV Negatives \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 4666 and o.value_coded in (4324,4665) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 1068 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:30:51',4,'2023-03-30 18:31:17',4,0,NULL,NULL,NULL,'8e552272-4654-43bb-b1af-20affab2de14'),(2007,'All TB HIV Neg and Died','All TB HIV Neg and Died','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Neg and Died\n All TB HIV Neg and Died\n \n 2023-03-30 16:31:44 UTC\n \n 2023-03-30 16:32:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2007\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All HIV Negatives \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 4666 and o.value_coded in (4324,4665) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3650 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:31:44',4,'2023-03-30 18:32:11',4,0,NULL,NULL,NULL,'3463adc8-19aa-4cc0-9daf-32ea09e0c1f0'),(2008,'All TB HIV Neg and Lost to Follow up','All TB HIV Neg and Lost to Follow up','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Neg and Lost to Follow up\n All TB HIV Neg and Lost to Follow up\n \n 2023-03-30 16:32:59 UTC\n \n 2023-03-30 16:33:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2008\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All HIV Negatives \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 4666 and o.value_coded in (4324,4665) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 2302 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:32:59',4,'2023-03-30 18:33:27',4,0,NULL,NULL,NULL,'06a5ff53-1949-444e-80b5-f4c99b38d5b1'),(2009,'All TB HIV Neg and Failed (Susceptible)','All TB HIV Neg and Failed (Susceptible)','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Neg and Failed (Susceptible)\n All TB HIV Neg and Failed (Susceptible)\n \n 2023-03-30 16:34:17 UTC\n \n 2023-03-30 16:35:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2009\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All HIV Negatives \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 4666 and o.value_coded in (4324,4665) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3793 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:34:17',4,'2023-03-30 18:35:01',4,0,NULL,NULL,NULL,'2ac7e18e-061b-4b34-bb63-63a2ec622a2b'),(2010,'All TB HIV Neg and Not Evaluated','All TB HIV Neg and Not Evaluated','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Neg and Not Evaluated\n All TB HIV Neg and Not Evaluated\n \n 2023-03-30 16:35:36 UTC\n \n 2023-03-30 16:37:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2010\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All HIV Negatives \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 4666 and o.value_coded in (4324,4665) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id not in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded in (1068,2242,3650,2302,3793,3794) \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:35:36',4,'2023-03-30 18:37:02',4,0,NULL,NULL,NULL,'c78c5a10-a320-43ce-b943-f9286e22ad1e'),(2011,'prison_worker_moved','Prison worker moved to second line','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n prison_worker_moved\n Prison worker moved to second line\n \n 2023-03-30 16:35:49 UTC\n \n 2023-03-30 16:36:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2011\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3779 \n and ob.voided = 0 \n ) \n and o.person_id in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3794) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:35:49',4,'2023-03-30 18:36:29',4,0,NULL,NULL,NULL,'76d5be40-a7e3-4f4f-968a-0346d0bd6513'),(2012,'prison_worker_died','Prison worker died','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n prison_worker_died\n Prison worker died\n \n 2023-03-30 16:37:07 UTC\n \n 2023-03-30 16:37:38 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2012\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3776 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3650) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:37:07',4,'2023-03-30 18:37:38',4,0,NULL,NULL,NULL,'c9a54e7c-34d1-4a1b-9214-0b9fa6eb6976'),(2013,'All TB HIV Neg and Moved to Secondline Treatment','All TB HIV Neg and Moved to Secondline Treatment','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Neg and Moved to Secondline Treatment\n All TB HIV Neg and Moved to Secondline Treatment\n \n 2023-03-30 16:37:41 UTC\n \n 2023-03-30 16:38:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2013\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All HIV Negatives \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 4666 and o.value_coded in (4324,4665) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3794 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:37:41',4,'2023-03-30 18:38:53',4,0,NULL,NULL,NULL,'2de9ce1c-6a79-43fe-ab19-1b9c9d2865d4'),(2014,'prison_worker_completed','Prison worker completed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n prison_worker_completed\n Prison worker completed\n \n 2023-03-30 16:38:29 UTC\n \n 2023-03-30 16:38:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2014\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3776 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2242) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:38:29',4,'2023-03-30 18:38:53',4,0,NULL,NULL,NULL,'9e174142-2794-43fc-95dd-9f3f92e4b379'),(2015,'prison_worker_curred','Prion worker curred','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n prison_worker_curred\n Prion worker curred\n \n 2023-03-30 16:40:22 UTC\n \n 2023-03-30 16:43:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2015\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3776 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (1068) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:40:22',4,'2023-03-30 18:43:23',4,0,NULL,NULL,NULL,'91f85b53-7dca-4730-a391-5198293d1cf9'),(2016,'All Childred and Completed','All Childred and Completed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All Childred and Completed\n All Childred and Completed\n \n 2023-03-30 16:43:19 UTC\n \n 2023-03-30 16:46:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2016\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All Children \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) < 15 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 2242 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:43:19',4,'2023-03-30 18:46:26',4,0,NULL,NULL,NULL,'f300ef4e-70b5-4c81-b993-7d45d23f299e'),(2017,'prison_worker_notEvaluated','Prison worker not evaluated','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n prison_worker_notEvaluated\n Prison worker not evaluated\n \n 2023-03-30 16:46:21 UTC\n \n 2023-03-30 16:46:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2017\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3776 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2302,1068,2242,3650,3793,3794) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:46:21',4,'2023-03-30 18:46:41',4,0,NULL,NULL,NULL,'1c0c7eab-e438-4787-982a-bfb448fe7455'),(2018,'All Childred and Cured','All Childred and Cured','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All Childred and Cured\n All Childred and Cured\n \n 2023-03-30 16:46:51 UTC\n \n 2023-03-30 16:47:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2018\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All Children \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) < 15 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 1068 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:46:51',4,'2023-03-30 18:47:08',4,0,NULL,NULL,NULL,'1f8f36b9-85d6-4e32-b078-6c7e098974b1'),(2019,'All Childred and Died','All Childred and Died','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All Childred and Died\n All Childred and Died\n \n 2023-03-30 16:47:31 UTC\n \n 2023-03-30 16:48:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2019\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All Children \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) < 15 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3650 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:47:31',4,'2023-03-30 18:48:00',4,0,NULL,NULL,NULL,'dd4822a7-86eb-4579-acda-bf0ff242eef5'),(2020,'health_worker_notEvaluated','Health worker not evaluated','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n health_worker_notEvaluated\n Health worker not evaluated\n \n 2023-03-30 16:47:35 UTC\n \n 2023-03-30 16:48:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2020\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3667 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2302,1068,2242,3650,3793,3794) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:47:35',4,'2023-03-30 18:48:03',4,0,NULL,NULL,NULL,'5d8bdedf-fc1e-46f8-b417-908519f3e645'),(2021,'All Childred and Lost to Follow up','All Childred and Lost to Follow up','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All Childred and Lost to Follow up\n All Childred and Lost to Follow up\n \n 2023-03-30 16:48:38 UTC\n \n 2023-03-30 16:49:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2021\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All Children \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) < 15 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 2302 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:48:38',4,'2023-03-30 18:49:04',4,0,NULL,NULL,NULL,'2665ef1b-edbd-4c9d-b9f6-3d2d2cc3b0ad'),(2022,'health_worker_curred','Health worker curred','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n health_worker_curred\n Health worker curred\n \n 2023-03-30 16:48:53 UTC\n \n 2023-03-30 16:49:19 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2022\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3667 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (1068) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:48:53',4,'2023-03-30 18:49:19',4,0,NULL,NULL,NULL,'63064b04-2cce-4944-b53d-ddb2cdce8a2d'),(2023,'All Childred and Failed (Susceptible)','All Childred and Failed (Susceptible)','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All Childred and Failed (Susceptible)\n All Childred and Failed (Susceptible)\n \n 2023-03-30 16:49:34 UTC\n \n 2023-03-30 16:50:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2023\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All Children \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) < 15 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3793 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:49:34',4,'2023-03-30 18:50:01',4,0,NULL,NULL,NULL,'1b710ad4-75b5-4b64-b916-1806dca0013d'),(2024,'health_worker_completed','Health worker completed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n health_worker_completed\n Health worker completed\n \n 2023-03-30 16:49:56 UTC\n \n 2023-04-03 20:37:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2024\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3667 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2242) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:49:56',4,'2023-04-03 22:37:45',4,0,NULL,NULL,NULL,'6555808c-1103-4a6d-b13f-fd0fad7ff09f'),(2025,'All Childred and Not evaluated','All Childred and Not evaluated','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All Childred and Not evaluated\n All Childred and Not evaluated\n \n 2023-03-30 16:50:30 UTC\n \n 2023-03-30 16:51:54 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2025\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All Children \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) < 15 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id not in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded in (1068,2242,3650,2302,3794,3793) \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:50:30',4,'2023-03-30 18:51:54',4,0,NULL,NULL,NULL,'1b9b16cf-f254-43b5-b952-4d54f431ae49'),(2026,'health_worker_died','Healh worker died','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n health_worker_died\n Healh worker died\n \n 2023-03-30 16:50:46 UTC\n \n 2023-03-30 16:51:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2026\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3667 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3650) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:50:46',4,'2023-03-30 18:51:00',4,0,NULL,NULL,NULL,'e9c9f85f-123c-4b2f-9951-7b8c2be340af'),(2027,'health_worker_lost','Health worker lost','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n health_worker_lost\n Health worker lost\n \n 2023-03-30 16:51:39 UTC\n \n 2023-03-30 16:51:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2027\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3667 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2302) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:51:39',4,'2023-03-30 18:51:55',4,0,NULL,NULL,NULL,'8b70ced1-8219-4206-b7ec-10c0242808c4'),(2028,'All Childred and Moved to Secondline Treatment','All Childred and Moved to Secondline Treatment','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All Childred and Moved to Secondline Treatment\n All Childred and Moved to Secondline Treatment\n \n 2023-03-30 16:52:27 UTC\n \n 2023-03-30 16:53:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2028\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All Children \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) < 15 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3794 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:52:27',4,'2023-03-30 18:53:11',4,0,NULL,NULL,NULL,'143c95e1-ae28-460c-92c2-3807e30dc704'),(2029,'health_worker_moved','Health worker moved to second line','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n health_worker_moved\n Health worker moved to second line\n \n 2023-03-30 16:52:49 UTC\n \n 2023-03-30 16:55:13 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2029\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3667 \n and ob.voided = 0 \n ) \n and o.person_id in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3794) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:52:49',4,'2023-03-30 18:55:13',4,0,NULL,NULL,NULL,'3a04d202-b320-463e-a233-40887022bfea'),(2030,'All TB Adolescent (10-19 yrs) and Completed ','All TB Adolescent (10-19 yrs) and Completed ','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Adolescent (10-19 yrs) and Completed \n All TB Adolescent (10-19 yrs) and Completed \n \n 2023-03-30 16:55:50 UTC\n \n 2023-03-30 16:56:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2030\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All Adolescent (10-19 yrs) \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) < 20 \n and floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) > 9 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 2242 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:55:50',4,'2023-03-30 18:56:27',4,0,NULL,NULL,NULL,'788061f8-b372-4d67-b493-c20b96b948bf'),(2031,'public_transport_Moved','Public Transport move to second line','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n public_transport_Moved\n Public Transport move to second line\n \n 2023-03-30 16:55:50 UTC\n \n 2023-03-30 16:56:22 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2031\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 4654 \n and ob.voided = 0 \n ) \n and o.person_id in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3794) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:55:50',4,'2023-03-30 18:56:22',4,0,NULL,NULL,NULL,'c2e7a54e-80e6-4535-a09f-32d93e8ce902'),(2032,'All TB Adolescent (10-19 yrs) and cured','All TB Adolescent (10-19 yrs) and cured','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Adolescent (10-19 yrs) and cured\n All TB Adolescent (10-19 yrs) and cured\n \n 2023-03-30 16:56:54 UTC\n \n 2023-03-30 16:57:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2032\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All Adolescent (10-19 yrs) \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) < 20 \n and floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) > 9 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 1068 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:56:54',4,'2023-03-30 18:57:31',4,0,NULL,NULL,NULL,'e620cd1b-bbe2-4c3d-93bb-fcbdc8b34d84'),(2033,'public_transport_lost','Public transport Lost','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n public_transport_lost\n Public transport Lost\n \n 2023-03-30 16:57:13 UTC\n \n 2023-03-30 16:57:37 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2033\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 4654 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2302) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:57:13',4,'2023-03-30 18:57:37',4,0,NULL,NULL,NULL,'0cc2e2d8-4cab-45c7-9b04-67c8bfd1bbfa'),(2034,'All TB Adolescent (10-19 yrs) and Died','All TB Adolescent (10-19 yrs) and Died','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Adolescent (10-19 yrs) and Died\n All TB Adolescent (10-19 yrs) and Died\n \n 2023-03-30 16:57:52 UTC\n \n 2023-03-30 16:58:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2034\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All Adolescent (10-19 yrs) \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) < 20 \n and floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) > 9 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3650 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:57:52',4,'2023-03-30 18:58:21',4,0,NULL,NULL,NULL,'53ef1628-fe11-4b21-bab5-897e27196e04'),(2035,'public_transport_died','Public transport died','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n public_transport_died\n Public transport died\n \n 2023-03-30 16:58:17 UTC\n \n 2023-03-30 16:58:34 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2035\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 4654 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3650) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:58:17',4,'2023-03-30 18:58:34',4,0,NULL,NULL,NULL,'bbc25dd6-f8ff-4c55-84e8-efd76d0ac281'),(2036,'All TB Adolescent (10-19 yrs) and Lost to Follow up','All TB Adolescent (10-19 yrs) and Lost to Follow up','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Adolescent (10-19 yrs) and Lost to Follow up\n All TB Adolescent (10-19 yrs) and Lost to Follow up\n \n 2023-03-30 16:58:49 UTC\n \n 2023-03-30 16:59:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2036\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All Adolescent (10-19 yrs) \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) < 20 \n and floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) > 9 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 2302 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:58:49',4,'2023-03-30 18:59:12',4,0,NULL,NULL,NULL,'509944d6-5988-405c-8aee-8a9329e1e141'),(2037,'public_transport_completed','Public transport completed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n public_transport_completed\n Public transport completed\n \n 2023-03-30 16:59:27 UTC\n \n 2023-03-30 17:00:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2037\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 4654 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2242) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:59:27',4,'2023-03-30 19:00:28',4,0,NULL,NULL,NULL,'d9a7884a-eabd-43cc-9757-64ae74a3cb9c'),(2038,'All TB Adolescent (10-19 yrs) and Failed (Susceptible)','All TB Adolescent (10-19 yrs) and Failed (Susceptible)','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Adolescent (10-19 yrs) and Failed (Susceptible)\n All TB Adolescent (10-19 yrs) and Failed (Susceptible)\n \n 2023-03-30 16:59:52 UTC\n \n 2023-03-30 17:00:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2038\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All Adolescent (10-19 yrs) \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) < 20 \n and floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) > 9 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3793 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:59:52',4,'2023-03-30 19:00:27',4,0,NULL,NULL,NULL,'dd3ac915-529a-44c4-b086-fe9e21bc7553'),(2039,'All TB Adolescent (10-19 yrs) and Moved to Secondline treatment','All TB Adolescent (10-19 yrs) and Moved to Secondline treatment','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Adolescent (10-19 yrs) and Moved to Secondline treatment\n All TB Adolescent (10-19 yrs) and Moved to Secondline treatment\n \n 2023-03-30 17:01:19 UTC\n \n 2023-03-30 17:01:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2039\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All Adolescent (10-19 yrs) \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) < 20 \n and floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) > 9 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3794 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 19:01:19',4,'2023-03-30 19:01:41',4,0,NULL,NULL,NULL,'216e1e3c-eed7-4802-96bb-fe3256161a08'),(2040,'public_transport_curred','Public transport curred','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n public_transport_curred\n Public transport curred\n \n 2023-03-30 17:01:20 UTC\n \n 2023-03-30 17:01:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2040\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 4654 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (1068) \n and b.voided = 0 \n ) \n\n','2023-03-30 19:01:20',4,'2023-03-30 19:01:41',4,0,NULL,NULL,NULL,'faf660cd-1ef3-48a9-86d5-805f14b23465'),(2041,'All TB Adolescent (10-19 yrs) and Not Evaluated','All TB Adolescent (10-19 yrs) and Not Evaluated','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Adolescent (10-19 yrs) and Not Evaluated\n All TB Adolescent (10-19 yrs) and Not Evaluated\n \n 2023-03-30 17:02:10 UTC\n \n 2023-03-30 17:03:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2041\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All Adolescent (10-19 yrs) \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) < 20 \n and floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) > 9 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id not in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded in (1068,2242,3650,2302,3794,3793) \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 19:02:10',4,'2023-03-30 19:03:44',4,0,NULL,NULL,NULL,'8fcd3cec-a879-4240-888f-42575228b47d'); +INSERT INTO `serialized_object` VALUES (1776,' Clients given 6B weighing 25-34.9kg',' Clients given 6B weighing 25-34.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6B weighing 25-34.9kg\n Clients given 6B weighing 25-34.9kg\n \n 2022-07-04 19:23:47 UTC\n \n 2022-07-04 19:27:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1776\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 00:53:47',4,'2022-07-05 00:57:17',4,0,NULL,NULL,NULL,'70621294-d632-4b66-8f10-0343433b8267'),(1777,' Clients given 6B weighing >= 35kg',' Clients given 6B weighing >= 35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6B weighing >= 35kg\n Clients given 6B weighing >= 35kg\n \n 2022-07-04 19:24:19 UTC\n \n 2022-07-04 19:27:33 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1777\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 00:54:19',4,'2022-07-05 00:57:33',4,0,NULL,NULL,NULL,'ed32ff5b-41ed-4933-a39e-bc4fb685b9eb'),(1778,'Clients given 6C weighing 0-3.9kg','Clients given 6C weighing 0-3.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C weighing 0-3.9kg\n Clients given 6C weighing 0-3.9kg\n \n 2022-07-05 06:03:11 UTC\n \n 2022-07-05 06:05:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1778\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:33:11',4,'2022-07-05 11:35:26',4,0,NULL,NULL,NULL,'7708c697-6d7d-42e7-aba6-613e36081fab'),(1779,'Clients given 6C weighing 4-5.9kg','Clients given 6C weighing 6-9.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C weighing 4-5.9kg\n Clients given 6C weighing 6-9.9kg\n \n 2022-07-05 06:03:33 UTC\n \n 2022-07-05 06:09:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1779\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:33:33',4,'2022-07-05 11:39:04',4,0,NULL,NULL,NULL,'95504660-becd-4eff-a280-5aa869762885'),(1780,'Clients given 6C weighing 6-9.9kg','Clients given 6C weighing 6-9.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C weighing 6-9.9kg\n Clients given 6C weighing 6-9.9kg\n \n 2022-07-05 06:03:55 UTC\n \n 2022-07-05 06:07:47 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1780\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:33:55',4,'2022-07-05 11:37:47',4,0,NULL,NULL,NULL,'d3ba1e90-03ce-4af3-8b68-9e4bb86a2fda'),(1781,'Clients given 6C weighing 10-13.9kg','Clients given 6C weighing 10-13.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C weighing 10-13.9kg\n Clients given 6C weighing 10-13.9kg\n \n 2022-07-05 06:09:31 UTC\n \n 2022-07-05 06:12:33 UTC\n \n \n location\n \n org.openmrs.Location\n true\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n 1781\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:39:31',4,'2022-07-05 11:42:33',4,0,NULL,NULL,NULL,'bd61f262-344c-4834-846b-dbfd4b8f8454'),(1782,'Clients given 6C weighing 14-19.9kg','Clients given 6C weighing 14-19.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C weighing 14-19.9kg\n Clients given 6C weighing 14-19.9kg\n \n 2022-07-05 06:11:03 UTC\n \n 2022-07-05 06:14:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1782\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:41:03',4,'2022-07-05 11:44:18',4,0,NULL,NULL,NULL,'ef452600-16ec-4d05-bf02-a2f5da8c503d'),(1783,'Clients given 6C weighing 20-24.9kg','Clients given 6C weighing 20-24.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C weighing 20-24.9kg\n Clients given 6C weighing 20-24.9kg\n \n 2022-07-05 06:12:09 UTC\n \n 2022-07-05 06:14:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1783\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:42:09',4,'2022-07-05 11:44:44',4,0,NULL,NULL,NULL,'84b7e946-ef4b-498c-aa99-a7469d841d89'),(1784,'Clients given 6C weighing 25-34.9kg','Clients given 6C weighing 25-34.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C weighing 25-34.9kg\n Clients given 6C weighing 25-34.9kg\n \n 2022-07-05 06:13:57 UTC\n \n 2022-07-05 06:17:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1784\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:43:57',4,'2022-07-05 11:47:03',4,0,NULL,NULL,NULL,'d0662ec5-9909-46a1-8d42-4f13c5e08f54'),(1785,'Clients given 6C weighing >= 35kg','Clients given 6C weighing >= 35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C weighing >= 35kg\n Clients given 6C weighing >= 35kg\n \n 2022-07-05 06:17:43 UTC\n \n 2022-07-05 06:20:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1785\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:47:43',4,'2022-07-05 11:50:43',4,0,NULL,NULL,NULL,'e469295b-caa7-4154-b5ac-e2d0a7042d5b'),(1786,'Clients given 6D weighing 0-3.9kg','Clients given 6D weighing 0-3.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D weighing 0-3.9kg\n Clients given 6D weighing 0-3.9kg\n \n 2022-07-05 06:18:16 UTC\n \n 2022-07-05 06:19:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1786\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:48:16',4,'2022-07-05 11:49:53',4,0,NULL,NULL,NULL,'a6985c5b-86f8-4647-86ea-ddd69097681e'),(1787,'Clients given 6D weighing 4-5.9kg','Clients given 6D weighing 4-5.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D weighing 4-5.9kg\n Clients given 6D weighing 4-5.9kg\n \n 2022-07-05 06:18:43 UTC\n \n 2022-07-05 06:20:24 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1787\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:48:43',4,'2022-07-05 11:50:24',4,0,NULL,NULL,NULL,'3eec1d07-6d91-43dd-a942-24d23e4a0f9c'),(1788,'Clients given 6D weighing 6-9.9kg','Clients given 6D weighing 6-9.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D weighing 6-9.9kg\n Clients given 6D weighing 6-9.9kg\n \n 2022-07-05 06:21:17 UTC\n \n 2022-07-05 06:22:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1788\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:51:17',4,'2022-07-05 11:52:45',4,0,NULL,NULL,NULL,'37509f55-cbd9-4096-8522-1e7918b1a48c'),(1789,'Clients given 6D weighing 10-13.9kg','Clients given 6D weighing 10-13.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D weighing 10-13.9kg\n Clients given 6D weighing 10-13.9kg\n \n 2022-07-05 06:21:34 UTC\n \n 2022-07-05 06:23:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1789\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:51:34',4,'2022-07-05 11:53:04',4,0,NULL,NULL,NULL,'477311cf-0367-47e1-9717-4732fc0752f0'),(1790,'Clients given 6D weighing 14-19.9kg','Clients given 6D weighing 14-19.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D weighing 14-19.9kg\n Clients given 6D weighing 14-19.9kg\n \n 2022-07-05 06:21:55 UTC\n \n 2022-07-05 06:23:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1790\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:51:55',4,'2022-07-05 11:53:21',4,0,NULL,NULL,NULL,'62232334-aa48-4e29-92fc-c4f931bcfb01'),(1791,'Clients given 6D weighing 20-24.9kg','Clients given 6D weighing 20-24.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D weighing 20-24.9kg\n Clients given 6D weighing 20-24.9kg\n \n 2022-07-05 06:23:43 UTC\n \n 2022-07-05 06:25:33 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1791\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:53:43',4,'2022-07-05 11:55:33',4,0,NULL,NULL,NULL,'8b171cf1-4052-49f3-9b28-76161872f1ac'),(1792,'Clients given 6D weighing 25-34.9kg','Clients given 6D weighing 25-34.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D weighing 25-34.9kg\n Clients given 6D weighing 25-34.9kg\n \n 2022-07-05 06:24:03 UTC\n \n 2022-07-05 06:25:47 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1792\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:54:03',4,'2022-07-05 11:55:47',4,0,NULL,NULL,NULL,'20d6a8c0-12ee-420c-a3f6-22d2e7a829bd'),(1793,'Clients given 6D weighing >= 35kg','Clients given 6D weighing >= 35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D weighing >= 35kg\n Clients given 6D weighing >= 35kg\n \n 2022-07-05 06:24:35 UTC\n \n 2022-07-05 06:26:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1793\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:54:35',4,'2022-07-05 11:56:11',4,0,NULL,NULL,NULL,'41d104fe-8277-4caa-b55e-07ea346801a7'),(1794,'Clients given 6E weighing 0-3.9 kg','Clients given 6E weighing 0-3.9 kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E weighing 0-3.9 kg\n Clients given 6E weighing 0-3.9 kg\n \n 2022-07-05 06:27:58 UTC\n \n 2022-07-05 06:30:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1794\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:57:58',4,'2022-07-05 12:00:43',4,0,NULL,NULL,NULL,'ddcdfef8-c5fd-4bd2-9963-4d5d48702f57'),(1795,'Clients given 6E weighing 4-5.9 kg','Clients given 6E weighing 4-5.9 kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E weighing 4-5.9 kg\n Clients given 6E weighing 4-5.9 kg\n \n 2022-07-05 06:28:17 UTC\n \n 2022-07-05 06:32:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1795\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 11:58:17',4,'2022-07-05 12:02:01',4,0,NULL,NULL,NULL,'52757686-f3a7-4d53-84bb-76aea347f4d3'),(1796,'Clients given 6E weighing 6-9.9 kg','Clients given 6E weighing 6-9.9 kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E weighing 6-9.9 kg\n Clients given 6E weighing 6-9.9 kg\n \n 2022-07-05 06:30:03 UTC\n \n 2022-07-05 06:31:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1796\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${endDate}\n \n \n \n','2022-07-05 12:00:03',4,'2022-07-05 12:01:15',4,0,NULL,NULL,NULL,'d0682189-7d23-4c17-9648-ae39ea0f6916'),(1797,'Clients given 6E weighing 10-13.9 kg','Clients given 6E weighing 10-13.9 kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E weighing 10-13.9 kg\n Clients given 6E weighing 10-13.9 kg\n \n 2022-07-05 06:32:34 UTC\n \n 2022-07-05 06:34:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1797\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 12:02:34',4,'2022-07-05 12:04:30',4,0,NULL,NULL,NULL,'ad8a6b3c-88dd-4328-b042-076242f1ce54'),(1798,'Clients given 6E weighing 14-19.9 kg','Clients given 6E weighing 14-19.9 kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E weighing 14-19.9 kg\n Clients given 6E weighing 14-19.9 kg\n \n 2022-07-05 06:33:01 UTC\n \n 2022-07-05 06:34:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1798\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 12:03:01',4,'2022-07-05 12:04:51',4,0,NULL,NULL,NULL,'d58c1b55-d21c-497a-b201-c1f544c8264c'),(1799,'Clients given 6E weighing 20-24.9 kg','Clients given 6E weighing 20-24.9 kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E weighing 20-24.9 kg\n Clients given 6E weighing 20-24.9 kg\n \n 2022-07-05 06:33:24 UTC\n \n 2022-07-05 06:35:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1799\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 12:03:24',4,'2022-07-05 12:05:10',4,0,NULL,NULL,NULL,'e38de12c-6c72-4188-a8b7-b6d912e7baf2'),(1800,'Clients given 6E weighing 25-34.9 kg','Clients given 6E weighing 25-34.9 kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E weighing 25-34.9 kg\n Clients given 6E weighing 25-34.9 kg\n \n 2022-07-05 06:35:31 UTC\n \n 2022-07-05 06:37:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1800\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 12:05:31',4,'2022-07-05 12:07:03',4,0,NULL,NULL,NULL,'24def27b-738c-424e-b397-689a9fc28dd0'),(1801,'Clients given 6E weighing >= 35 kg','Clients given 6E weighing >= 35 kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E weighing >= 35 kg\n Clients given 6E weighing >= 35 kg\n \n 2022-07-05 06:35:59 UTC\n \n 2022-07-05 06:37:19 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1801\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 12:05:59',4,'2022-07-05 12:07:19',4,0,NULL,NULL,NULL,'bc732e0d-7aa7-412d-855c-76442487b9c9'),(1802,'Clients given 6F weighing 4-5.9kg','Clients given 6F weighing 4-5.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F weighing 4-5.9kg\n Clients given 6F weighing 4-5.9kg\n \n 2022-07-05 06:38:03 UTC\n \n 2022-07-05 06:42:09 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1802\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 12:08:03',4,'2022-07-05 12:12:09',4,0,NULL,NULL,NULL,'31aaf13e-0c70-472d-9d6f-8d288c6545d7'),(1803,'Clients given 6F weighing 0-3.9kg','Clients given 6F weighing 0-3.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F weighing 0-3.9kg\n Clients given 6F weighing 0-3.9kg\n \n 2022-07-05 06:38:38 UTC\n \n 2022-07-05 06:43:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1803\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 12:08:38',4,'2022-07-05 12:13:27',4,0,NULL,NULL,NULL,'ec58cc67-3866-4031-a385-d5f40bf5fa80'),(1804,'Clients given 6F weighing 6-9.9kg','Clients given 6F weighing 6-9.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F weighing 6-9.9kg\n Clients given 6F weighing 6-9.9kg\n \n 2022-07-05 06:40:34 UTC\n \n 2022-07-05 06:42:24 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1804\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${endDate}\n \n \n \n','2022-07-05 12:10:34',4,'2022-07-05 12:12:24',4,0,NULL,NULL,NULL,'ece7781b-8125-44f0-8189-6f4f66258b2c'),(1805,'Clients given 6F weighing 10-13.9kg','Clients given 6F weighing 10-13.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F weighing 10-13.9kg\n Clients given 6F weighing 10-13.9kg\n \n 2022-07-05 06:44:04 UTC\n \n 2022-07-05 06:47:25 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1805\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 12:14:04',4,'2022-07-05 12:17:25',4,0,NULL,NULL,NULL,'6cd6003e-fd2a-4acd-acbf-8025ed274332'),(1806,'Clients given 6F weighing 14-19.9kg','Clients given 6F weighing 14-19.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F weighing 14-19.9kg\n Clients given 6F weighing 14-19.9kg\n \n 2022-07-05 06:44:30 UTC\n \n 2022-07-05 06:50:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1806\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 12:14:30',4,'2022-07-05 12:20:01',4,0,NULL,NULL,NULL,'c465345e-8ab1-45d7-972a-d39b87dd1ade'),(1807,'Clients given 6F weighing 20-24.9kg','Clients given 6F weighing 20-24.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F weighing 20-24.9kg\n Clients given 6F weighing 20-24.9kg\n \n 2022-07-05 06:44:51 UTC\n \n 2022-07-05 06:46:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1807\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 12:14:51',4,'2022-07-05 12:16:42',4,0,NULL,NULL,NULL,'383ecc01-a8e6-42b4-83f3-eb9c2e48386b'),(1808,'Clients given 6F weighing 25-34.9kg','Clients given 6F weighing 25-34.9kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F weighing 25-34.9kg\n Clients given 6F weighing 25-34.9kg\n \n 2022-07-05 06:49:35 UTC\n \n 2022-07-05 06:54:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1808\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 12:19:35',4,'2022-07-05 12:24:29',4,0,NULL,NULL,NULL,'bacab6c2-b1d6-4a10-9f0d-ffb24844bae5'),(1809,'Clients given 6F weighing >= 35kg','Clients given 6F weighing >= 35kg','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F weighing >= 35kg\n Clients given 6F weighing >= 35kg\n \n 2022-07-05 06:53:17 UTC\n \n 2022-07-05 06:56:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1809\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-07-05 12:23:17',4,'2022-07-05 12:26:41',4,0,NULL,NULL,NULL,'2614b81d-6441-4ee3-b4a7-a15f3ba36ace'),(1810,'Children ARV Regimen_2ndLine_2022','Children ARV Regimen_2ndLine','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_2022\n Children ARV Regimen_2ndLine\n \n 2022-07-06 07:16:05 UTC\n \n 2022-07-06 10:13:16 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1810\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2022-07-06 07:16:05',4,'2022-07-06 10:13:16',4,0,NULL,NULL,NULL,'dffce2c4-7adc-497e-8216-fa138d0201b1'),(1811,'Children ARV Regimen_2ndLine Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine Data Set\n \n 2022-07-06 07:16:44 UTC\n \n 2022-07-06 10:11:25 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1811\n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n 5A0to3.9\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Age\n Children 0to14\n \n \n \n \n \n 5A10to13.9\n \n \n \n \n \n \n \n \n \n 5A14to19.9\n \n \n \n \n \n \n \n \n \n 5A20to24.9\n \n \n \n \n \n \n \n \n \n 5A25to34.9\n \n \n \n \n \n \n \n \n \n 5A35plus\n \n \n \n \n \n \n \n \n \n 5A4to5.9\n \n \n \n \n \n \n \n \n \n 5A6to9.9\n \n \n \n \n \n \n \n \n \n 5B0to3.9\n \n \n \n \n \n \n \n \n \n 5B10to13.9\n \n \n \n \n \n \n \n \n \n 5B14to19.9\n \n \n \n \n \n \n \n \n \n 5B20to24.9\n \n \n \n \n \n \n \n \n \n 5B25to34.9\n \n \n \n \n \n \n \n \n \n 5B35plus\n \n \n \n \n \n \n \n \n \n 5B4to5.9\n \n \n \n \n \n \n \n \n \n 5B6to9.9\n \n \n \n \n \n \n \n \n \n 5C0to3.9\n \n \n \n \n \n \n \n \n \n 5C10to13.9\n \n \n \n \n \n \n \n \n \n 5C14to19.9\n \n \n \n \n \n \n \n \n \n 5C20to24.9\n \n \n \n \n \n \n \n \n \n 5C25to34.9\n \n \n \n \n \n \n \n \n \n 5C35plus\n \n \n \n \n \n \n \n \n \n 5C4to5.9\n \n \n \n \n \n \n \n \n \n 5C6to9.9\n \n \n \n \n \n \n \n \n \n 5D0to3.9\n \n \n \n \n \n \n \n \n \n 5D10to13.9\n \n \n \n \n \n \n \n \n \n 5D14to19.9\n \n \n \n \n \n \n \n \n \n 5D20to24.9\n \n \n \n \n \n \n \n \n \n 5D25to34.9\n \n \n \n \n \n \n \n \n \n 5D35plus\n \n \n \n \n \n \n \n \n \n 5D4to5.9\n \n \n \n \n \n \n \n \n \n 5D6to9.9\n \n \n \n \n \n \n \n \n \n 5E0to3.9\n \n \n \n \n \n \n \n \n \n 5E10to13.9\n \n \n \n \n \n \n \n \n \n 5E14to19.9\n \n \n \n \n \n \n \n \n \n 5E20to24.9\n \n \n \n \n \n \n \n \n \n 5E25to34.9\n \n \n \n \n \n \n \n \n \n 5E35plus\n \n \n \n \n \n \n \n \n \n 5E4to5.9\n \n \n \n \n \n \n \n \n \n 5E6to9.9\n \n \n \n \n \n \n \n \n \n 5F0to3.9\n \n \n \n \n \n \n \n \n \n 5F10to13.9\n \n \n \n \n \n \n \n \n \n 5F14to19.9\n \n \n \n \n \n \n 5F20to24.9\n \n \n \n \n \n \n \n \n \n 5F25to34.9\n \n \n \n \n \n \n \n \n \n 5F35plus\n \n \n \n \n \n \n \n \n \n 5F4to5.9\n \n \n \n \n \n \n \n \n \n 5F6to9.9\n \n \n \n \n \n \n \n \n \n 5G0to3.9\n \n \n \n \n \n \n \n \n \n 5G10to13.9\n \n \n \n \n \n \n \n \n \n 5G14to19.9\n \n \n \n \n \n \n \n \n \n 5G20to24.9\n \n \n \n \n \n \n \n \n \n 5G25to34.9\n \n \n \n \n \n \n \n \n \n 5G35plus\n \n \n \n \n \n \n \n \n \n 5G4to5.9\n \n \n \n \n \n \n \n \n \n 5G6to9.9\n \n \n \n \n \n \n \n \n \n 5H0to3.9\n \n \n \n \n \n \n \n \n \n 5H10to13.9\n \n \n \n \n \n \n \n \n \n 5H14to19.9\n \n \n \n \n \n \n \n \n \n 5H20to24.9\n \n \n \n \n \n \n \n \n \n 5H25to34.9\n \n \n \n \n \n \n \n \n \n 5H35plus\n \n \n \n \n \n \n \n \n \n 5H4to5.9\n \n \n \n \n \n \n \n \n \n 5H6to9.9\n \n \n \n \n \n \n \n \n \n','2022-07-06 07:16:44',4,'2022-07-06 10:11:25',4,0,NULL,NULL,NULL,'437a2414-1894-4eb5-8c13-356a8e2aa747'),(1812,'Children ARV Regimen_3rdLine_2022','Children ARV Regimen_3rdLine','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_2022\n Children ARV Regimen_3rdLine\n \n 2022-07-06 10:16:11 UTC\n \n 2022-07-06 10:16:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1812\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2022-07-06 10:16:11',4,'2022-07-06 10:16:23',4,0,NULL,NULL,NULL,'b6b0cf68-1305-49a2-8f43-30f3f175958d'),(1813,'Children ARV Regimen_3rdLine_2022 Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_2022 Data Set\n \n 2022-07-06 10:16:23 UTC\n \n 2022-07-06 14:44:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1813\n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n 6A0to3.9\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Age\n Children 0to14\n \n \n \n \n \n 6A10to13.9\n \n \n \n \n \n \n \n \n \n 6A14to19.9\n \n \n \n \n \n \n \n \n \n 6A20to24.9\n \n \n \n \n \n \n \n \n \n 6A25to34.9\n \n \n \n \n \n \n \n \n \n 6A35plus\n \n \n \n \n \n \n \n \n \n 6A4to5.9\n \n \n \n \n \n \n \n \n \n 6A6to9.9\n \n \n \n \n \n \n \n \n \n 6B0to3.9\n \n \n \n \n \n \n \n \n \n 6B10to13.9\n \n \n \n \n \n \n \n \n \n 6B14to19.9\n \n \n \n \n \n \n \n \n \n 6B20to24.9\n \n \n \n \n \n \n \n \n \n 6B25to34.9\n \n \n \n \n \n \n \n \n \n 6B35plus\n \n \n \n \n \n \n \n \n \n 6B4to5.9\n \n \n \n \n \n \n \n \n \n 6B6to9.9\n \n \n \n \n \n \n \n \n \n 6C0to3.9\n \n \n \n \n \n \n \n \n \n 6C10to13.9\n \n \n \n \n \n \n \n \n \n 6C14to19.9\n \n \n \n \n \n \n \n \n \n 6C20to24.9\n \n \n \n \n \n \n \n \n \n 6C25to34.9\n \n \n \n \n \n \n \n \n \n 6C35plus\n \n \n \n \n \n \n \n \n \n 6C4to5.9\n \n \n \n \n \n \n \n \n \n 6C6to9.9\n \n \n \n \n \n \n \n \n \n 6D0to3.9\n \n \n \n \n \n \n \n \n \n 6D10to13.9\n \n \n \n \n \n \n \n \n \n 6D14to19.9\n \n \n \n \n \n \n \n \n \n 6D20to24.9\n \n \n \n \n \n \n \n \n \n 6D25to34.9\n \n \n \n \n \n \n \n \n \n 6D35plus\n \n \n \n \n \n \n \n \n \n 6D4to5.9\n \n \n \n \n \n \n \n \n \n 6D6to9.9\n \n \n \n \n \n \n \n \n \n 6E0to3.9\n \n \n \n \n \n \n \n \n \n 6E10to13.9\n \n \n \n \n \n \n \n \n \n 6E14to19.9\n \n \n \n \n \n \n \n \n \n 6E20to24.9\n \n \n \n \n \n \n \n \n \n 6E25to34.9\n \n \n \n \n \n \n \n \n \n 6E35plus\n \n \n \n \n \n \n \n \n \n 6E4to5.9\n \n \n \n \n \n \n \n \n \n 6E6to9.9\n \n \n \n \n \n \n \n \n \n 6F0to3.9\n \n \n \n \n \n \n \n \n \n 6F10to13.9\n \n \n \n \n \n \n \n \n \n 6F14to19.9\n \n \n \n \n \n \n \n \n \n 6F20to24.9\n \n \n \n \n \n \n \n \n \n 6F25to34.9\n \n \n \n \n \n \n \n \n \n 6F35plus\n \n \n \n \n \n \n \n \n \n 6F4to5.9\n \n \n \n \n \n \n \n \n \n 6F6to9.9\n \n \n \n \n \n \n \n \n \n','2022-07-06 10:16:23',4,'2022-07-06 14:44:30',4,0,NULL,NULL,NULL,'3fa2b422-d556-4710-bfd7-bc8a5b0c9c0b'),(1814,'TX_ML-06 Clients who are current on ART at reporting period and experienced IIT_3-5 months','TX_ML-06 Clients who are current on ART at reporting period and experienced IIT_3-5 months','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TX_ML-06 Clients who are current on ART at reporting period and experienced IIT_3-5 months\n TX_ML-06 Clients who are current on ART at reporting period and experienced IIT_3-5 months\n \n 2022-08-10 11:03:51 UTC\n \n 2024-02-15 09:03:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1814\n select obs_ml_clients.person_id \nfrom obs os \ninner join location l on os.location_id = l.location_id \ninner join \n( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND patient.voided = 0 AND o.voided = 0 \n AND o.person_id in ( \n select person_id \n from \n (select oss.person_id, MAX(oss.obs_datetime) as max_observation, SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_datetime)), 20) AS latest_follow_up \n from obs oss \n inner join person p on oss.person_id=p.person_id and oss.concept_id = 3752 and oss.voided=0 \n and oss.obs_datetime < cast(:startDate as DATE) \n group by p.person_id \n having datediff(CAST(DATE_ADD(CAST(:startDate AS DATE), INTERVAL -1 DAY) AS DATE), latest_follow_up) < 29) as On_ART_Beginning_Quarter \n ) \n AND o.person_id in ( \n select person_id \n from \n (select oss.person_id, MAX(oss.obs_datetime) as max_observation, SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_datetime)), 20) AS latest_follow_up \n from obs oss \n inner join person p on oss.person_id=p.person_id and oss.concept_id = 3752 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as DATE) \n group by p.person_id \n having datediff(CAST(:endDate AS DATE), latest_follow_up) > 28) as Missed_Greater_Than_28Days \n ) \n INNER JOIN patient_identifier ON patient_identifier.patient_id = patient.patient_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n group by patient.patient_id \n UNION \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND patient.voided = 0 AND o.voided = 0 \n AND o.concept_id = 2249 and cast(o.value_datetime as date) >= cast(:startDate as DATE) and cast(o.value_datetime as date) <= cast(:endDate as DATE) \n AND o.person_id in ( \n select person_id \n from \n (select oss.person_id, MAX(oss.obs_datetime) as max_observation, SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_datetime)), 20) AS latest_follow_up \n from obs oss \n inner join person p on oss.person_id=p.person_id and oss.concept_id = 3752 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as DATE) \n group by p.person_id \n having datediff(CAST(:endDate AS DATE), latest_follow_up) > 28) as Missed_Greater_Than_28Days \n ) \n INNER JOIN patient_identifier ON patient_identifier.patient_id = patient.patient_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n group by patient.patient_id \n) as obs_ml_clients on os.person_id = obs_ml_clients.person_id \nINNER JOIN person ON person.person_id = obs_ml_clients.person_id AND person.voided = 0 \nINNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \nWHERE os.location_id =:location or parent_location =:location \n -- INITIATED ON ART BETWEEN 3 AND 5 MONTHS AGO \n AND obs_ml_clients.person_id in ( \n select distinct os.person_id \n from obs os \n where os.concept_id = 2249 \n AND datediff(CAST(:endDate AS DATE), os.value_datetime) BETWEEN 89 AND 180 \n ) \n -- NOT Transfered Out to Another Site \n AND obs_ml_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where os.concept_id = 4155 and os.value_coded = 2146 \n AND os.obs_datetime <= CAST(:endDate AS DATE) \n ) \n -- NOT DEAD \n AND obs_ml_clients.person_id not in ( \n select person_id \n from person \n where death_date <= CAST(:endDate AS DATE) \n and dead = 1 \n ) \nAND obs_ml_clients.person_id not in ( \n -- Visitors \n select o.person_id \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as examination_timing \n from obs oss \n where oss.concept_id = 3753 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where concept_id = 5416 \n and o.value_coded =1 and o.voided=0 \n and cast(o.obs_datetime as date) = cast(max_observation as date) \n )\n','2022-08-10 16:33:51',4,'2024-02-15 14:33:32',4,0,NULL,NULL,NULL,'e2a2e29e-040a-45b1-902d-fa25074d52a1'),(1815,'CI63:TxML IIT3-5','TxML IIT3-5','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CI63:TxML IIT3-5\n TxML IIT3-5\n \n 2022-08-10 11:07:17 UTC\n \n 2022-08-10 11:08:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1815\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-08-10 11:07:17',4,'2022-08-10 11:08:59',4,0,NULL,NULL,NULL,'781f34cd-9cce-41ef-acbe-b89b0e1257e4'),(1816,'TX_RTT-02 Clients with IIT for < 3 months in previous period who restarted ARV\'s during current period','TX_RTT-02 Clients with IIT for < 3 months in previous period who restarted ARV\'s during current period','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TX_RTT-02 Clients with IIT for < 3 months in previous period who restarted ARV's during current period\n TX_RTT-02 Clients with IIT for < 3 months in previous period who restarted ARV's during current period\n \n 2022-08-23 16:34:31 UTC\n \n 2024-02-15 08:22:47 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1816\n select distinct o.person_id \nfrom obs o \n-- PATIENTS WITH NO CLINICAL CONTACT OR ARV PICK-UP FOR GREATER THAN 28 DAYS \n-- SINCE THEIR LAST EXPECTED CONTACT WHO RESTARTED ARVs WITHIN THE REPORTING PERIOD \ninner join location l on o.location_id = l.location_id \nINNER JOIN patient ON o.person_id = patient.patient_id \nAND patient.voided = 0 AND o.voided = 0 \nAND o.person_id in ( \n select person_id \n from \n (select oss.person_id, MAX(oss.obs_datetime) as max_observation, SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_datetime)), 20) AS latest_follow_up \n from obs oss \n inner join person p on oss.person_id=p.person_id and oss.concept_id = 3752 and oss.voided=0 \n and oss.obs_datetime < cast(:startDate as DATE) \n group by p.person_id \n having datediff(CAST(DATE_ADD(CAST(:startDate AS DATE), INTERVAL -1 DAY) AS DATE), latest_follow_up) BETWEEN 29 and 90) as Missed_Greater_Than_28Days \n ) \n \n -- Client Seen: As either patient OR Treatment Buddy \n AND ( \n o.person_id in ( \n select distinct os.person_id \n from obs os \n where (os.concept_id = 3843 AND os.value_coded = 3841 OR os.value_coded = 3842) \n AND os.obs_datetime BETWEEN CAST(:startDate AS DATE) AND CAST(:endDate AS DATE) \n ) \n \n -- Client Seen and Date Restarted picked \n OR o.person_id in ( \n select distinct os.person_id \n from obs os \n where os.concept_id = 3708 AND os.value_datetime BETWEEN CAST(:startDate AS DATE) AND CAST(:endDate AS DATE) \n ) \n ) \n -- Still on treatment at the end of the reporting period \n AND o.person_id in ( \n select person_id \n from \n (select oss.person_id, MAX(oss.obs_datetime) as max_observation, SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_datetime)), 20) AS latest_follow_up \n from obs oss \n inner join person p on oss.person_id=p.person_id and oss.concept_id = 3752 and oss.voided=0 \n and oss.obs_datetime >= cast(:startDate as DATE) and oss.obs_datetime <= cast(:endDate as DATE) \n group by p.person_id \n having datediff(CAST(:endDate AS DATE), latest_follow_up) <= 28) as Still_On_Treatment_End_Period \n ) \n \n -- Transfered Out to Another Site during their latest encounter before the start date \n AND o.person_id not in ( \n select person_id \n from \n (select oss.person_id, MAX(oss.obs_datetime) as max_observation, SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) AS last_obs_tout \n from obs oss \n inner join person p on oss.person_id=p.person_id and oss.concept_id = 4155 and oss.voided=0 \n and oss.obs_datetime < cast(:startDate as DATE) \n group by p.person_id \n having last_obs_tout = 2146) as Transfered_Out_In_Last_Encounter \n ) \n \n-- NOT Transfered In from another Site \n AND o.person_id not in ( \n select os.person_id \n from obs os \n where (os.concept_id = 2253 AND DATE(os.value_datetime) BETWEEN CAST(:startDate AS DATE) AND CAST(:endDate AS DATE)) \n AND os.voided = 0 \n ) \n \n AND o.person_id not in ( \n select person_id \n from person \n where death_date <= CAST(:endDate AS DATE) \n and dead = 1 \n ) \n AND o.person_id not in ( \n -- Visitors \n select o.person_id \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as examination_timing \n from obs oss \n where oss.concept_id = 3753 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where concept_id = 5416 \n and o.value_coded =1 and o.voided=0 \n and cast(o.obs_datetime as date) = cast(max_observation as date) \n) \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \nWHERE (o.location_id =:location or parent_location =:location)\n','2022-08-23 22:04:31',4,'2024-02-15 13:52:47',4,0,NULL,NULL,NULL,'505841df-fa38-436c-8463-8a437f536b69'),(1817,'TX_RTT-03 Clients with IIT for 3-5 months in previous period who restarted ARV\'s during current period','TX_RTT-03 Clients with IIT for 3-5 months in previous period who restarted ARV\'s during current period','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TX_RTT-03 Clients with IIT for 3-5 months in previous period who restarted ARV's during current period\n TX_RTT-03 Clients with IIT for 3-5 months in previous period who restarted ARV's during current period\n \n 2022-08-23 16:42:57 UTC\n \n 2024-02-15 08:26:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1817\n select distinct o.person_id \nfrom obs o \n-- PATIENTS WITH NO CLINICAL CONTACT OR ARV PICK-UP FOR GREATER THAN 28 DAYS \n-- SINCE THEIR LAST EXPECTED CONTACT WHO RESTARTED ARVs WITHIN THE REPORTING PERIOD \ninner join location l on o.location_id = l.location_id \nINNER JOIN patient ON o.person_id = patient.patient_id \nAND patient.voided = 0 AND o.voided = 0 \nAND o.person_id in ( \n select person_id \n from \n (select oss.person_id, MAX(oss.obs_datetime) as max_observation, SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_datetime)), 20) AS latest_follow_up \n from obs oss \n inner join person p on oss.person_id=p.person_id and oss.concept_id = 3752 and oss.voided=0 \n and oss.obs_datetime < cast(:startDate as DATE) \n group by p.person_id \n having datediff(CAST(DATE_ADD(CAST(:startDate AS DATE), INTERVAL -1 DAY) AS DATE), latest_follow_up) BETWEEN 89 and 180) as Missed_Between_89_and_180Days \n ) \n \n -- Client Seen: As either patient OR Treatment Buddy \n AND ( \n o.person_id in ( \n select distinct os.person_id \n from obs os \n where (os.concept_id = 3843 AND os.value_coded = 3841 OR os.value_coded = 3842) \n AND os.obs_datetime BETWEEN CAST(:startDate AS DATE) AND CAST(:endDate AS DATE) \n ) \n \n -- Client Seen and Date Restarted picked \n OR o.person_id in ( \n select distinct os.person_id \n from obs os \n where os.concept_id = 3708 AND os.value_datetime BETWEEN CAST(:startDate AS DATE) AND CAST(:endDate AS DATE) \n ) \n ) \n -- Still on treatment at the end of the reporting period \n AND o.person_id in ( \n select person_id \n from \n (select oss.person_id, MAX(oss.obs_datetime) as max_observation, SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_datetime)), 20) AS latest_follow_up \n from obs oss \n inner join person p on oss.person_id=p.person_id and oss.concept_id = 3752 and oss.voided=0 \n and oss.obs_datetime >= cast(:startDate as DATE) and oss.obs_datetime <= cast(:endDate as DATE) \n group by p.person_id \n having datediff(CAST(:endDate AS DATE), latest_follow_up) <= 28) as Still_On_Treatment_End_Period \n ) \n \n -- Transfered Out to Another Site during their latest encounter before the start date \n AND o.person_id not in ( \n select person_id \n from \n (select oss.person_id, MAX(oss.obs_datetime) as max_observation, SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) AS last_obs_tout \n from obs oss \n inner join person p on oss.person_id=p.person_id and oss.concept_id = 4155 and oss.voided=0 \n and oss.obs_datetime < cast(:startDate as DATE) \n group by p.person_id \n having last_obs_tout = 2146) as Transfered_Out_In_Last_Encounter \n ) \n \n-- NOT Transfered In from another Site \n AND o.person_id not in ( \n select os.person_id \n from obs os \n where (os.concept_id = 2253 AND DATE(os.value_datetime) BETWEEN CAST(:startDate AS DATE) AND CAST(:endDate AS DATE)) \n AND os.voided = 0 \n ) \n \n AND o.person_id not in ( \n select person_id \n from person \n where death_date <= CAST(:endDate AS DATE) \n and dead = 1 \n ) \n AND o.person_id not in ( \n -- Visitors \n select o.person_id \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as examination_timing \n from obs oss \n where oss.concept_id = 3753 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where concept_id = 5416 \n and o.value_coded =1 and o.voided=0 \n and cast(o.obs_datetime as date) = cast(max_observation as date) \n ) \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \nWHERE (o.location_id =:location or parent_location =:location)\n','2022-08-23 22:12:57',4,'2024-02-15 13:56:51',4,0,NULL,NULL,NULL,'129f5049-8d6d-4cd9-8922-7cf72b623ab3'),(1818,' TX_RTT-04 Clients with IIT for >6 months in previous period who restarted ARV\'s during current period',' TX_RTT-04 Clients with IIT for >6 months in previous period who restarted ARV\'s during current period','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TX_RTT-04 Clients with IIT for >6 months in previous period who restarted ARV's during current period\n TX_RTT-04 Clients with IIT for >6 months in previous period who restarted ARV's during current period\n \n 2022-08-23 16:45:46 UTC\n \n 2024-02-15 08:42:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n endDateAS\n \n java.util.Date\n true\n \n \n 1818\n select distinct o.person_id \nfrom obs o \n-- PATIENTS WITH NO CLINICAL CONTACT OR ARV PICK-UP FOR GREATER THAN 28 DAYS \n-- SINCE THEIR LAST EXPECTED CONTACT WHO RESTARTED ARVs WITHIN THE REPORTING PERIOD \ninner join location l on o.location_id = l.location_id \nINNER JOIN patient ON o.person_id = patient.patient_id \nAND patient.voided = 0 AND o.voided = 0 \nAND o.person_id in ( \n select person_id \n from \n (select oss.person_id, MAX(oss.obs_datetime) as max_observation, SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_datetime)), 20) AS latest_follow_up \n from obs oss \n inner join person p on oss.person_id=p.person_id and oss.concept_id = 3752 and oss.voided=0 \n and oss.obs_datetime < cast(:startDate as DATE) \n group by p.person_id \n having datediff(CAST(DATE_ADD(CAST(:startDate AS DATE), INTERVAL -1 DAY) AS DATE), latest_follow_up) >= 180) as Missed_Greater_than_180Days \n ) \n \n -- Client Seen: As either patient OR Treatment Buddy \n AND ( \n o.person_id in ( \n select distinct os.person_id \n from obs os \n where (os.concept_id = 3843 AND os.value_coded = 3841 OR os.value_coded = 3842) \n AND os.obs_datetime BETWEEN CAST(:startDate AS DATE) AND CAST(:endDate AS DATE) \n ) \n \n -- Client Seen and Date Restarted picked \n OR o.person_id in ( \n select distinct os.person_id \n from obs os \n where os.concept_id = 3708 AND os.value_datetime BETWEEN CAST(:startDate AS DATE) AND CAST(:endDate AS DATE) \n ) \n ) \n -- Still on treatment at the end of the reporting period \n AND o.person_id in ( \n select person_id \n from \n (select oss.person_id, MAX(oss.obs_datetime) as max_observation, SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_datetime)), 20) AS latest_follow_up \n from obs oss \n inner join person p on oss.person_id=p.person_id and oss.concept_id = 3752 and oss.voided=0 \n and oss.obs_datetime >= cast(:startDate as DATE) and oss.obs_datetime <= cast(:endDate as DATE) \n group by p.person_id \n having datediff(CAST(:endDate AS DATE), latest_follow_up) <= 28) as Still_On_Treatment_End_Period \n ) \n \n -- Transfered Out to Another Site during their latest encounter before the start date \n AND o.person_id not in ( \n select person_id \n from \n (select oss.person_id, MAX(oss.obs_datetime) as max_observation, SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) AS last_obs_tout \n from obs oss \n inner join person p on oss.person_id=p.person_id and oss.concept_id = 4155 and oss.voided=0 \n and oss.obs_datetime < cast(:startDate as DATE) \n group by p.person_id \n having last_obs_tout = 2146) as Transfered_Out_In_Last_Encounter \n ) \n \n-- NOT Transfered In from another Site \n AND o.person_id not in ( \n select os.person_id \n from obs os \n where (os.concept_id = 2253 AND DATE(os.value_datetime) BETWEEN CAST(:startDate AS DATE) AND CAST(:endDate AS DATE)) \n AND os.voided = 0 \n ) \n \n AND o.person_id not in ( \n select person_id \n from person \n where death_date <= CAST(:endDate AS DATE) \n and dead = 1 \n ) \n AND o.person_id not in ( \n -- Visitors \n select o.person_id \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as examination_timing \n from obs oss \n where oss.concept_id = 3753 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where concept_id = 5416 \n and o.value_coded =1 and o.voided=0 \n and cast(o.obs_datetime as date) = cast(max_observation as date) \n ) \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \nWHERE (o.location_id =:location or parent_location =:location)\n','2022-08-23 22:15:46',4,'2024-02-15 14:12:31',4,0,NULL,NULL,NULL,'afc2a5d5-53e4-427a-9491-b3b1609bbe69'),(1819,'CI64:TxRTT IIT<3months','CI64:TxRTT IIT<3months','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CI64:TxRTT IIT<3months\n CI64:TxRTT IIT<3months\n \n 2022-08-24 07:46:14 UTC\n \n 2022-08-24 07:47:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1819\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-08-24 07:46:14',4,'2022-08-24 07:47:14',4,0,NULL,NULL,NULL,'6c4e2daf-e83f-4899-98f5-203f33ee4827'),(1820,'CI65:TxRTT IIT_3-5months','CI65:TxRTT IIT_3-5months','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CI65:TxRTT IIT_3-5months\n CI65:TxRTT IIT_3-5months\n \n 2022-08-24 07:47:56 UTC\n \n 2022-08-24 07:48:48 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1820\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-08-24 07:47:56',4,'2022-08-24 07:48:48',4,0,NULL,NULL,NULL,'714af509-9ade-48b5-b6f0-10d7499a6f15'),(1821,'CI66:TxRTT IIT_6+months','CI66:TxRTT IIT_6+months','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n CI66:TxRTT IIT_6+months\n CI66:TxRTT IIT_6+months\n \n 2022-08-24 07:49:18 UTC\n \n 2022-08-24 07:49:56 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1821\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2022-08-24 07:49:18',4,'2022-08-24 07:49:56',4,0,NULL,NULL,NULL,'271261f4-75c6-4c64-a6f0-7be2d40c33c3'),(1822,'Pulmonary Bacteriologically Confirmed New','New Pulmonary Bacteriologically Confirmed clients','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Pulmonary Bacteriologically Confirmed New\n New Pulmonary Bacteriologically Confirmed clients\n \n 2023-03-27 10:50:04 UTC\n \n 2023-03-29 16:41:33 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1822\n select distinct o.person_id \n \n from obs o \ninner join location l on o.location_id = l.location_id \n \n -- Relapsed TB Client \nWHERE (o.location_id =:location or parent_location =:location) \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n -- TB Start Date \n where ob.concept_id = 2237 \n and ob.value_datetime >= :startDate \n and ob.value_datetime <= :endDate \n and ob.voided = 0 \n ) \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- New Clients \n select distinct person_id \n from obs \n where concept_id = 3785 and value_coded = 1034 \n and obs_datetime >= :startDate \n and obs_datetime <= :endDate \n ) \n ) \n \n \n AND o.person_id not in ( \n select distinct os.person_id \n from obs os \n -- Patient must not be a tranfer in \n where os.concept_id = 3772 and os.value_coded =2095 \n AND (os.obs_datetime BETWEEN :startDate AND :endDate) \n AND os.voided = 0 \n )\n','2023-03-27 12:50:04',4,'2023-03-29 18:41:33',4,0,NULL,NULL,NULL,'5ab3fc4d-0d1e-4a30-b0c7-d35c68f7f19a'),(1823,'NewRelapse_Tb_Treatment_History','Tb Treatment History - New and Relapse Patients','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n NewRelapse_Tb_Treatment_History\n Tb Treatment History - New and Relapse Patients\n \n 2023-03-27 11:51:48 UTC\n \n 2023-03-27 20:29:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1823\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in( \nSELECT Id \nFROM \n((SELECT distinct Id, patientIdentifier AS "Patient_Identifier", patientName AS "Patient_Name", Age , Gender, age_group, 'New Patient' AS 'TB_Treatment_History' \n FROM \n \n (select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n person.gender AS Gender, \n observed_age_group.name AS age_group, \n observed_age_group.sort_order AS sort_order \n \n from obs o \n -- New TB Patient \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n -- TB Start Date \n where ob.concept_id = 2237 \n and ob.value_datetime >= CAST(:startDate AS DATE) \n and ob.value_datetime <= CAST(:endDate AS DATE) \n and ob.voided = 0 \n ) \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- New Clients \n select distinct person_id \n from obs \n where concept_id = 3785 and value_coded = 1034 \n and obs_datetime >= CAST(:startDate AS DATE) \n and obs_datetime <= CAST(:endDate AS DATE) \n ) \n ) \n \n \n AND o.person_id not in ( \n select distinct os.person_id \n from obs os \n -- Patient must not be a tranfer in \n where os.concept_id = 3772 and os.value_coded =2095 \n AND (os.obs_datetime BETWEEN CAST(:startDate AS DATE) AND CAST(:endDate AS DATE)) \n AND patient.voided = 0 AND os.voided = 0 \n ) \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages') AS NEW_TB_CLIENTS \n ORDER BY NEW_TB_CLIENTS.Age) \n \n \n UNION \n \n (SELECT distinct Id, patientIdentifier AS "Patient_Identifier", patientName AS "Patient_Name", Age , Gender, age_group, 'Relapsed Patient' AS 'TB_Treatment_History' \n FROM \n (select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n person.gender AS Gender, \n observed_age_group.name AS age_group, \n observed_age_group.sort_order AS sort_order \n \n from obs o \n -- Relapsed TB Client \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n -- TB Start Date \n where ob.concept_id = 2237 \n and ob.value_datetime >= CAST(:startDate AS DATE) \n and ob.value_datetime <= CAST(:endDate AS DATE) \n ) \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- Relapsed Clients \n select distinct person_id \n from obs \n where concept_id = 3785 and value_coded = 1084 \n and ob.value_datetime >= CAST(:startDate AS DATE) \n and ob.value_datetime <= CAST(:endDate AS DATE) \n ) \n ) \n \n \n \n AND o.person_id not in ( \n select distinct os.person_id \n from obs os \n -- Client must not be a transfer in \n where os.concept_id = 3772 and os.value_coded =2095 \n AND os.obs_datetime >= CAST(:startDate AS DATE) \n and os.obs_datetime <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND os.voided = 0 \n ) \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages') AS RELAPSE_TB_CLIENTS \n ORDER BY RELAPSE_TB_CLIENTS.Age) \n) AS NewRelapsed)\n','2023-03-27 17:21:48',4,'2023-03-28 01:59:53',4,0,NULL,NULL,NULL,'7f8a23bd-eec0-40a6-8181-cda3d0aab0bd'),(1824,'Pulmonary Bacteriologically Confirmed Relapse','Pulmonary Bacteriologically Confirmed Relapse','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Pulmonary Bacteriologically Confirmed Relapse\n Pulmonary Bacteriologically Confirmed Relapse\n \n 2023-03-27 12:10:01 UTC\n \n 2023-03-29 16:45:37 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1824\n select o.person_id \n from obs o \ninner join location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \nWHERE (o.location_id =:location or parent_location =:location) \nAND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n -- TB Start Date \n where ob.concept_id = 2237 \n and ob.value_datetime >= :startDate \n and ob.value_datetime <= :endDate \n ) \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- Relapsed Clients \n select distinct person_id \n from obs \n where concept_id = 3785 and value_coded = 1084 \n and ob.value_datetime >= :startDate \n and ob.value_datetime <= :endDate \n ) \n ) \n \n \n \n AND o.person_id not in ( \n select distinct os.person_id \n from obs os \n -- Client must not be a transfer in \n where os.concept_id = 3772 and os.value_coded =2095 \n AND os.obs_datetime >= :startDate \n and os.obs_datetime <= :endDate \n AND patient.voided = 0 AND os.voided = 0 \n )\n','2023-03-27 14:10:01',4,'2023-03-29 18:45:37',4,0,NULL,NULL,NULL,'e495a330-c538-4fa2-9279-e0c03ec69b51'),(1825,'Pulmonary Bacteriologically Confirmed Excluding Relapse','Pulmonary Bacteriologically Confirmed Excluding Relapse','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Pulmonary Bacteriologically Confirmed Excluding Relapse\n Pulmonary Bacteriologically Confirmed Excluding Relapse\n \n 2023-03-27 17:01:52 UTC\n \n 2023-03-29 16:38:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1825\n select distinct o.person_id \n from obs o \ninner join location l on o.location_id = l.location_id \n \n -- Relapsed TB Client \nWHERE (o.location_id =:location or parent_location =:location) \n AND o.concept_id = 3785 and o.value_coded in (3786,1037) \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n -- TB Start Date \n where ob.concept_id = 2237 \n and ob.value_datetime >= :startDate \n and ob.value_datetime <= :endDate \n ) \n \n AND o.person_id not in ( \n select distinct os.person_id \n from obs os \n -- Client must not be a transfer in \n where os.concept_id = 3772 and os.value_coded = 3786 \n AND os.obs_datetime >= :startDate \n and os.obs_datetime <= :endDate \n AND os.voided = 0) \n\n','2023-03-27 19:01:52',4,'2023-03-29 18:38:41',4,0,NULL,NULL,NULL,'23ba6606-91b7-4f7c-9142-73d6a43769a3'),(1826,'New and Relapse with document HIV Status','New and Relapse patients with document HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n New and Relapse with document HIV Status\n New and Relapse patients with document HIV Status\n \n 2023-03-27 19:38:11 UTC\n \n 2023-03-27 21:21:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1826\n SELECT DISTINCT o.person_id \n from obs o \n -- New and Relapse with Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3785 and ob.value_coded in (1034, 1084) -- New and Relapse \n and ob.voided = 0 \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE)\n','2023-03-28 01:08:11',4,'2023-03-28 02:51:39',4,0,NULL,NULL,NULL,'ee4e2170-5dd7-423e-bc84-f0c13c3a9b4f'),(1827,'Retreatment with documented HIV status','Retreatment Excl. Relapse client with documented HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Retreatment with documented HIV status\n Retreatment Excl. Relapse client with documented HIV Status\n \n 2023-03-27 19:50:19 UTC\n \n 2023-03-27 19:53:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1827\n SELECT DISTINCT o.person_id \n from obs o \n -- New and Relapse with Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3785 and ob.value_coded in (3786, 1037) -- Retreatmentafter LTFU/Failure \n and ob.voided = 0 \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 01:20:19',4,'2023-03-28 01:23:28',4,0,NULL,NULL,NULL,'17edcc8f-3d38-49dd-a6f4-a5384cdb7245'),(1828,'Children < 15 with Documented HIV Status','Children (0 - 14) with documented HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children < 15 with Documented HIV Status\n Children (0 - 14) with documented HIV Status\n \n 2023-03-27 20:10:47 UTC\n \n 2023-03-27 20:11:20 UTC\n \n \n endDate\n \n java.util.Date\n true\n \n \n startDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1828\n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Documented HIV, Status \n inner join location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 \n AND o.voided = 0 \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n having Age < 15\n','2023-03-28 01:40:47',4,'2023-03-28 01:41:20',4,0,NULL,NULL,NULL,'ca5b1d37-8229-474d-8125-2486520685fd'),(1829,'Pulmonary Clinically Diagnosed New','Pulmonary Clinically Diagnosed New','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Pulmonary Clinically Diagnosed New\n Pulmonary Clinically Diagnosed New\n \n 2023-03-27 20:39:34 UTC\n \n 2023-03-28 08:18:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1829\n select distinct o.person_id \n FROM obs o \ninner join location l on o.location_id = l.location_id \n -- Clinical Diagnosis X-Ray \n and o.concept_id = 4673 and o.value_coded = 4171 \nAND o.person_id in ( \nselect o.person_id from obs o \nwhere o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n -- TB Start Date \n where ob.concept_id = 2237 \n and ob.value_datetime >= :startDate \n and ob.value_datetime <= :endDate \n and ob.voided = 0 \n ) \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- New Clients \n select distinct person_id \n from obs \n where concept_id = 3785 and value_coded = 1034 \n and obs_datetime >= :startDate \n and obs_datetime <= :endDate \n ) \n ) \n \n \n AND o.person_id not in ( \n select distinct os.person_id \n from obs os \n -- Patient must not be a tranfer in \n where os.concept_id = 3772 and os.value_coded =2095 \n AND (os.obs_datetime BETWEEN :startDate AND :endDate) \n and os.voided = 0 \n ) \n \n) \n and o.obs_datetime >= :startDate \n and o.obs_datetime <= :endDate \n and o.voided = 0 \n and o.person_id in ( \n select ob.person_id \n FROM obs ob \n -- Pulmonary TB \n where ob.concept_id = 3788 and ob.value_coded = 1018 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.voided = 0 \n ) \n or o.person_id in ( \n select ob.person_id \n FROM obs ob \n -- Pulmonary TB, Clinically Diagnosed \n where ob.concept_id = 2236 and ob.value_coded = 2235 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.voided = 0 \n )\n','2023-03-28 02:09:34',4,'2023-03-28 13:48:26',4,0,NULL,NULL,NULL,'34bcf70d-0178-4dcc-ab38-9046e4bcedd1'),(1830,'Miners with Documented HIV Status','High risk population of miners with documented HIV','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Miners with Documented HIV Status\n High risk population of miners with documented HIV\n \n 2023-03-27 20:45:17 UTC\n \n 2023-03-27 20:46:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1830\n select distinct o.person_id \n from obs o \n -- Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded = 3667 -- Population (Miner) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 02:15:17',4,'2023-03-28 02:16:08',4,0,NULL,NULL,NULL,'001d7c51-fa6b-45d5-9690-cc6dce14a608'),(1831,'Ex-Miners with Documented HIV Status','High risk population of Ex Miners with Documented HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Ex-Miners with Documented HIV Status\n High risk population of Ex Miners with Documented HIV Status\n \n 2023-03-27 20:47:57 UTC\n \n 2023-03-28 09:17:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1831\n select distinct o.person_id \n from obs o \n -- Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded = 3668 -- Population (Ex-Miner) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 02:17:57',4,'2023-03-28 14:47:41',4,0,NULL,NULL,NULL,'10248e4b-2f29-447e-814a-6d5b10398656'),(1832,'Factory Workers with Documented HIV Status','High risk population of Factory Workers with Documented HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Factory Workers with Documented HIV Status\n High risk population of Factory Workers with Documented HIV Status\n \n 2023-03-27 20:54:48 UTC\n \n 2023-03-27 20:55:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1832\n select distinct o.person_id \n from obs o \n -- Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded = 3669 -- Population (Factory Workers) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 02:24:48',4,'2023-03-28 02:25:05',4,0,NULL,NULL,NULL,'bb934645-58c2-4c19-bbd7-0ebf35fa3f7a'),(1833,'Public transport operators with Documented HIV Status','High risk population of Public transport operators with Documented HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Public transport operators with Documented HIV Status\n High risk population of Public transport operators with Documented HIV Status\n \n 2023-03-27 20:58:19 UTC\n \n 2023-03-28 20:14:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1833\n select distinct o.person_id \n from obs o \n -- Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded = 4654 -- Population (Public transport operators) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 02:28:19',4,'2023-03-29 01:44:32',4,0,NULL,NULL,NULL,'0c91b258-01ae-4928-be76-91201cadad93'),(1834,'Health workers with Documented HIV Status','High risk population of Health workers with Documented HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Health workers with Documented HIV Status\n High risk population of Health workers with Documented HIV Status\n \n 2023-03-27 21:04:15 UTC\n \n 2023-03-27 21:04:38 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1834\n select distinct o.person_id \n from obs o \n -- Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded = 4670 -- Population (Health workers) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 02:34:15',4,'2023-03-28 02:34:38',4,0,NULL,NULL,NULL,'7736630e-9da2-4ec0-b131-fe9e2ef01e00'),(1835,'Correctional Staff and inmates with Documented HIV Status','High risk population of Correctional Staff and inmates with Documented HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Correctional Staff and inmates with Documented HIV Status\n High risk population of Correctional Staff and inmates with Documented HIV Status\n \n 2023-03-27 21:06:32 UTC\n \n 2023-03-27 21:10:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1835\n select distinct o.person_id \n from obs o \n -- Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded in (3779, 3671) -- Population (Correctional Staff and inmates) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 02:36:32',4,'2023-03-28 02:40:03',4,0,NULL,NULL,NULL,'58ac8a09-0a12-4ab0-acb4-1fe8d1d81b77'),(1836,'RetreatmentExRelapse_Tb_Treatment_History','Retreatment Exclusive Relapse Tb Treatment History','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n RetreatmentExRelapse_Tb_Treatment_History\n Retreatment Exclusive Relapse Tb Treatment History\n \n 2023-03-27 21:07:51 UTC\n \n 2023-03-27 21:12:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1836\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(SELECT Id \nFROM \n((SELECT distinct Id, patientIdentifier AS "Patient_Identifier", patientName AS "Patient_Name" \n FROM \n \n (select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n person.gender AS Gender, \n observed_age_group.name AS age_group, \n observed_age_group.sort_order AS sort_order \n \n from obs o \n -- TB Retreatment Exclusive Relapse \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- TB Retreatment Exclusive Relapse \n select distinct person_id \n from obs \n where concept_id = 3785 and value_coded in (3786,1037) \n and obs_datetime >= CAST(:startDate AS DATE) \n and obs_datetime <= CAST(:endDate AS DATE) \n ) \n ) \n \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages') AS NEW_TB_CLIENTS \n ORDER BY NEW_TB_CLIENTS.Age) \n \n) AS RetreatmentExRelapse)\n','2023-03-28 02:37:51',4,'2023-03-28 02:42:07',4,0,NULL,NULL,NULL,'7263505b-34d2-4167-9d3f-4cdae66218f8'),(1837,'NewRelapse_Tb_Treatment_History','NewRelapse_Tb_Treatment_History','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n NewRelapse_Tb_Treatment_History\n NewRelapse_Tb_Treatment_History\n \n 2023-03-27 21:17:20 UTC\n \n 2023-03-27 21:20:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1837\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-28 02:47:20',4,'2023-03-28 02:50:31',4,0,NULL,NULL,NULL,'20879b46-ecbd-4ff9-818a-3c761bcf5ebd'),(1838,'New and Relapse with Positive HIV Status','New and Relapse with Positive HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n New and Relapse with Positive HIV Status\n New and Relapse with Positive HIV Status\n \n 2023-03-27 21:20:17 UTC\n \n 2023-03-29 20:36:19 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1838\n SELECT DISTINCT o.person_id \n from obs o \n -- New and Relapse with Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3785 and ob.value_coded in (1034, 1084) -- New/Relapse with HIV Status \n and ob.voided = 0 \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-27 23:20:17',4,'2023-03-29 22:36:19',4,0,NULL,NULL,NULL,'02c505a1-b724-422b-8c31-69440e233a0d'),(1839,'RetreatmentExRelapse_Tb_Treatment_History','Retreatment Exclusive Relapse - Tb Treatment History','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n RetreatmentExRelapse_Tb_Treatment_History\n Retreatment Exclusive Relapse - Tb Treatment History\n \n 2023-03-27 21:25:15 UTC\n \n 2023-03-27 21:26:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1839\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-28 02:55:15',4,'2023-03-28 02:56:10',4,0,NULL,NULL,NULL,'f901b38b-95e7-4bcc-ace1-ce86030ba88e'),(1840,'TB Notification - Block 2','TB Notification - Block 2','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Notification - Block 2\n TB Notification - Block 2\n \n 2023-03-27 21:45:01 UTC\n \n 2023-03-27 21:45:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1840\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-03-28 03:15:01',4,'2023-03-28 03:15:21',4,0,NULL,NULL,NULL,'8ab1160e-aca4-4d59-bd02-0269e8a3889a'),(1841,'TB Notification - Block 2 Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Notification - Block 2 Data Set\n \n 2023-03-27 21:45:21 UTC\n \n 2024-02-29 14:25:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1841\n \n \n DM_Sex\n \n \n \n \n \n \n DM_TB_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n NwRlpsF1-4\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_TB_Age\n 01-04yrs\n \n \n \n \n \n NwRlpsF5-9\n \n \n \n \n DM_Sex\n Females\n \n \n DM_TB_Age\n 05-09yrs\n \n \n \n \n \n NwRlpsM1-4\n \n \n \n \n DM_Sex\n Males\n \n \n DM_TB_Age\n 01-04yrs\n \n \n \n \n \n NwRlpsM5-9\n \n \n \n \n DM_Sex\n Males\n \n \n DM_TB_Age\n 05-09yrs\n \n \n \n \n \n NwRlpseF<1\n \n \n \n \n DM_Sex\n Females\n \n \n DM_TB_Age\n Under1yr\n \n \n \n \n \n NwRlpseM<1\n \n \n \n \n DM_Sex\n Males\n \n \n DM_TB_Age\n Under1yr\n \n \n \n \n \n NwRsF10-14\n \n \n \n \n DM_Sex\n Females\n \n \n DM_TB_Age\n 10-14yrs\n \n \n \n \n \n NwRsF15-19\n \n \n \n \n DM_Sex\n Females\n \n \n DM_TB_Age\n 15-19yrs\n \n \n \n \n \n NwRsF20-24\n \n \n \n \n DM_Sex\n Females\n \n \n DM_TB_Age\n 20-24yrs\n \n \n \n \n \n NwRsF25-34\n \n \n \n \n DM_Sex\n Females\n \n \n DM_TB_Age\n 25-34yrs\n \n \n \n \n \n NwRsF35-44\n \n \n \n \n DM_Sex\n Females\n \n \n DM_TB_Age\n 35-44yrs\n \n \n \n \n \n NwRsF45-49\n \n \n \n \n DM_Sex\n Females\n \n \n DM_TB_Age\n 45-49yrs\n \n \n \n \n \n NwRsF50-64\n \n \n \n \n DM_Sex\n Females\n \n \n DM_TB_Age\n 50-64yrs\n \n \n \n \n \n NwRsF65+\n \n \n \n \n DM_Sex\n Females\n \n \n DM_TB_Age\n 65Plus\n \n \n \n \n \n NwRsM10-14\n \n \n \n \n DM_Sex\n Males\n \n \n DM_TB_Age\n 10-14yrs\n \n \n \n \n \n NwRsM15-19\n \n \n \n \n DM_Sex\n Males\n \n \n DM_TB_Age\n 15-19yrs\n \n \n \n \n \n NwRsM20-24\n \n \n \n \n DM_Sex\n Males\n \n \n DM_TB_Age\n 20-24yrs\n \n \n \n \n \n NwRsM25-34\n \n \n \n \n DM_Sex\n Males\n \n \n DM_TB_Age\n 25-34yrs\n \n \n \n \n \n NwRsM35-44\n \n \n \n \n DM_Sex\n Males\n \n \n DM_TB_Age\n 35-44yrs\n \n \n \n \n \n NwRsM45-49\n \n \n \n \n DM_Sex\n Males\n \n \n DM_TB_Age\n 45-49yrs\n \n \n \n \n \n NwRsM50-64\n \n \n \n \n DM_Sex\n Males\n \n \n DM_TB_Age\n 50-64yrs\n \n \n \n \n \n NwRsM65+\n \n \n \n \n DM_Sex\n Males\n \n \n DM_TB_Age\n 65Plus\n \n \n \n \n \n RetreatF<1\n \n \n \n \n \n \n \n \n \n RetreatM<1\n \n \n \n \n \n \n RetrtF1-4\n \n \n \n \n \n \n RetrtF5-9\n \n \n \n \n \n \n RetrtM1-4\n \n \n \n \n \n \n RetrtM5-9\n \n \n \n \n \n \n RtrtF10-14\n \n \n \n \n \n \n RtrtF15-19\n \n \n \n \n \n \n RtrtF20-24\n \n \n \n \n \n \n RtrtF25-34\n \n \n \n \n \n \n RtrtF35-44\n \n \n \n \n \n \n RtrtF45-49\n \n \n \n \n \n \n RtrtF50-64\n \n \n \n \n \n \n RtrtF65+\n \n \n \n \n \n \n RtrtM10-14\n \n \n \n \n \n \n RtrtM15-19\n \n \n \n \n \n \n RtrtM20-24\n \n \n \n \n \n \n RtrtM25-34\n \n \n \n \n \n \n RtrtM35-44\n \n \n \n \n \n \n RtrtM45-49\n \n \n \n \n \n \n RtrtM50-64\n \n \n \n \n \n \n RtrtM65+\n \n \n \n \n \n \n','2023-03-28 03:15:21',4,'2024-02-29 19:55:50',4,0,NULL,NULL,NULL,'68f0aaca-a6a0-4cb5-aebb-e57d5ce5b2cd'),(1844,'Retreatment with Positive HIV status','Retreatment Excl. Relapse with Positive HIV status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Retreatment with Positive HIV status\n Retreatment Excl. Relapse with Positive HIV status\n \n 2023-03-28 08:28:56 UTC\n \n 2023-03-28 08:30:38 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1844\n SELECT DISTINCT o.person_id \n from obs o \n -- New and Relapse with Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3785 and ob.value_coded in (3786, 1037) -- Retreatmentafter LTFU/Failure with HIV Status \n and ob.voided = 0 \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 13:58:56',4,'2023-03-28 14:00:38',4,0,NULL,NULL,NULL,'d48e3545-1e4d-4d7a-a812-5fb7111cbf72'),(1845,'Pulmonary Clinically Diagnosed Relapse','Pulmonary Clinically Diagnosed Relapse','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Pulmonary Clinically Diagnosed Relapse\n Pulmonary Clinically Diagnosed Relapse\n \n 2023-03-28 08:30:26 UTC\n \n 2023-03-28 09:14:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1845\n select distinct o.person_id \n FROM obs o \n \n where o.concept_id = 4673 and o.value_coded = 4171 \n and o.obs_datetime >= :startDate \n and o.obs_datetime <= :endDate \n and o.person_id in ( \n select distinct o.person_id \n from obs o \n -- Relapsed TB Client \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n -- TB Start Date \n where ob.concept_id = 2237 \n and ob.value_datetime >= :startDate \n and ob.value_datetime <= :endDate \n ) \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- Relapsed Clients \n select distinct person_id \n from obs \n where concept_id = 3785 and value_coded = 1084 \n and ob.value_datetime >= :startDate \n and ob.value_datetime <= :endDate \n ) \n ) \n \n \n \n AND o.person_id not in ( \n select distinct os.person_id \n from obs os \n -- Client must not be a transfer in \n where os.concept_id = 3772 and os.value_coded =2095 \n AND os.obs_datetime >= :startDate \n and os.obs_datetime <= :endDate \n and os.voided = 0 \n ) \n ) \n \n and o.voided = 0 \n and o.person_id in ( \n select ob.person_id \n FROM obs ob \n -- Pulmonary TB \n where ob.concept_id = 3788 and ob.value_coded = 1018 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.voided = 0 \n ) \n or o.person_id in ( \n select ob.person_id \n FROM obs ob \n -- Pulmonary TB, Clinically Diagnosed \n where ob.concept_id = 2236 and ob.value_coded = 2235 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.voided = 0 \n ) \n \n \n','2023-03-28 14:00:26',4,'2023-03-28 14:44:26',4,0,NULL,NULL,NULL,'5d45f128-1037-42d6-939d-3ae6929bfd6c'),(1846,'DM_TB_Age','DM_TB_Age','org.openmrs.module.reporting.indicator.dimension.Dimension','org.openmrs.module.reporting.indicator.dimension.CohortDefinitionDimension','org.openmrs.module.reporting.serializer.ReportingSerializer','\n DM_TB_Age\n DM_TB_Age\n \n 2023-03-28 08:34:09 UTC\n \n 2024-02-29 14:04:18 UTC\n \n \n endDate\n \n java.util.Date\n true\n \n \n 1846\n \n \n 01-04yrs\n \n \n \n \n maxAge\n 4\n \n \n minAge\n 1\n \n \n effectiveDate\n ${endDate}\n \n \n \n \n \n 05-09yrs\n \n \n \n \n maxAge\n 9\n \n \n minAge\n 5\n \n \n effectiveDate\n ${endDate}\n \n \n \n \n \n 10-14yrs\n \n \n \n \n maxAge\n 14\n \n \n minAge\n 10\n \n \n effectiveDate\n ${endDate}\n \n \n \n \n \n 15-19yrs\n \n \n \n \n maxAge\n 19\n \n \n minAge\n 15\n \n \n effectiveDate\n ${endDate}\n \n \n \n \n \n 20-24yrs\n \n \n \n \n maxAge\n 24\n \n \n minAge\n 20\n \n \n effectiveDate\n ${endDate}\n \n \n \n \n \n 25-34yrs\n \n \n \n \n maxAge\n 34\n \n \n minAge\n 25\n \n \n effectiveDate\n ${endDate}\n \n \n \n \n \n 35-44yrs\n \n \n \n \n maxAge\n 44\n \n \n minAge\n 35\n \n \n effectiveDate\n ${endDate}\n \n \n \n \n \n 45-49yrs\n \n \n \n \n maxAge\n 49\n \n \n minAge\n 45\n \n \n effectiveDate\n ${endDate}\n \n \n \n \n \n 50-64yrs\n \n \n \n \n maxAge\n 64\n \n \n minAge\n 50\n \n \n effectiveDate\n ${endDate}\n \n \n \n \n \n 65Plus\n \n \n \n \n maxAge\n 120\n \n \n minAge\n 65\n \n \n effectiveDate\n ${endDate}\n \n \n \n \n \n Under1yr\n \n \n \n \n maxAge\n 0\n \n \n minAge\n 0\n \n \n effectiveDate\n ${endDate}\n \n \n \n \n \n','2023-03-28 14:04:09',4,'2024-02-29 19:34:18',4,0,NULL,NULL,NULL,'68d03856-4b9b-4d8d-ba8f-bc698222c9f2'),(1847,'Children < 15 with Positive HIV Status','High risk population for Children < 15 with Positive HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children < 15 with Positive HIV Status\n High risk population for Children < 15 with Positive HIV Status\n \n 2023-03-28 08:43:51 UTC\n \n 2023-03-28 08:54:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1847\n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- HIV PositiveStatus \n inner join location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n having Age < 15\n','2023-03-28 14:13:51',4,'2023-03-28 14:24:04',4,0,NULL,NULL,NULL,'63b6abab-6261-4d20-9601-74454ea10cd6'),(1848,'Miners with Positive HIV Status','High risk population of miners with Positive HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Miners with Positive HIV Status\n High risk population of miners with Positive HIV Status\n \n 2023-03-28 08:58:19 UTC\n \n 2023-03-28 09:01:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1848\n select distinct o.person_id \n from obs o \n -- Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded = 3667 -- Population (Miner) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 14:28:19',4,'2023-03-28 14:31:36',4,0,NULL,NULL,NULL,'d4d85343-09fc-473b-a650-50f444deee3e'),(1849,'Ex-Miners with Positive HIV Status',' High risk population of Ex Miners with Positive HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Ex-Miners with Positive HIV Status\n High risk population of Ex Miners with Positive HIV Status\n \n 2023-03-28 09:10:47 UTC\n \n 2023-03-28 09:17:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1849\n select distinct o.person_id \n from obs o \n -- Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded = 3668 -- Population (Ex-Miner) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 14:40:47',4,'2023-03-28 14:47:26',4,0,NULL,NULL,NULL,'33fa2a02-6cb8-4850-8d80-18d86f0516a8'),(1850,'Pulmonary Clinically Diagnosed Excluding Relapse','Pulmonary Clinically Diagnosed Excluding Relapse','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Pulmonary Clinically Diagnosed Excluding Relapse\n Pulmonary Clinically Diagnosed Excluding Relapse\n \n 2023-03-28 09:16:40 UTC\n \n 2023-03-28 09:55:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1850\n select distinct o.person_id \n FROM obs o \n \n where o.obs_datetime >= :startDate \n and o.obs_datetime <= :endDate \n AND o.concept_id = 3785 and o.value_coded in (3786,1037) \n and o.voided = 0 \n and o.person_id in ( \n select ob.person_id \n FROM obs ob \n -- Pulmonary TB \n where ob.concept_id = 3788 and ob.value_coded = 1018 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.voided = 0 \n ) \n or o.person_id in ( \n select ob.person_id \n FROM obs ob \n -- Pulmonary TB, Clinically Diagnosed \n where ob.concept_id = 2236 and ob.value_coded = 2235 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.voided = 0 \n ) \n \n \n','2023-03-28 14:46:40',4,'2023-03-28 15:25:11',4,0,NULL,NULL,NULL,'8a1f3d92-c5ec-4892-920b-5bae45020424'),(1851,'Factory Workers with Positive HIV Status','High risk population of Factory Workers with Positive HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Factory Workers with Positive HIV Status\n High risk population of Factory Workers with Positive HIV Status\n \n 2023-03-28 09:22:07 UTC\n \n 2023-03-28 09:23:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1851\n select distinct o.person_id \n from obs o \n -- Positive HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded = 3669 -- Population (Factory Workers) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 14:52:07',4,'2023-03-28 14:53:45',4,0,NULL,NULL,NULL,'e7f0599c-bb8c-4d2d-94a7-4b99e0f1f7af'),(1852,'Public transport with Positive HIV Status','High risk population of Public transport operators with Positive HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Public transport with Positive HIV Status\n High risk population of Public transport operators with Positive HIV Status\n \n 2023-03-28 09:26:12 UTC\n \n 2023-03-28 09:28:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1852\n select distinct o.person_id \n from obs o \n -- Positive HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded = 4654 -- Population (Public transport operators) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 14:56:12',4,'2023-03-28 14:58:18',4,0,NULL,NULL,NULL,'17f9486c-aefe-4a21-b3ad-d5c685280640'),(1853,'Health workers with Positive HIV Status',' High risk population of Health workers with Positive HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Health workers with Positive HIV Status\n High risk population of Health workers with Positive HIV Status\n \n 2023-03-28 09:31:54 UTC\n \n 2023-03-28 09:32:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1853\n select distinct o.person_id \n from obs o \n -- Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded = 4670 -- Population (Health workers) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 15:01:54',4,'2023-03-28 15:02:36',4,0,NULL,NULL,NULL,'e071852e-15c9-4eb6-92a9-c1c8157db41d'),(1854,'Correctional Staff and inmates with Positive HIV Status','High risk population of Correctional Staff and inmates with Positive HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Correctional Staff and inmates with Positive HIV Status\n High risk population of Correctional Staff and inmates with Positive HIV Status\n \n 2023-03-28 09:35:03 UTC\n \n 2023-03-28 09:35:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1854\n select distinct o.person_id \n from obs o \n -- Positive HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded in (3779, 3671) -- Population (Correctional Staff and inmates) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 15:05:03',4,'2023-03-28 15:05:43',4,0,NULL,NULL,NULL,'d6df7665-4e94-4ae6-886e-c1fb05a4a0b1'),(1855,'Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - New','Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - New','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - New\n Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - New\n \n 2023-03-28 10:05:40 UTC\n \n 2023-03-29 16:14:16 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1855\n select distinct ob.person_id \n FROM obs ob \ninner join location l on ob.location_id = l.location_id \n \n where ob.concept_id = 3788 and ob.value_coded = 2233 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.person_id in \n ( \n select distinct o.person_id \n \n from obs o \n -- New TB Patient \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n -- TB Start Date \n where ob.concept_id = 2237 \n and ob.value_datetime >= :startDate \n and ob.value_datetime <= :endDate \n and ob.voided = 0 \n ) \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- New Clients \n select distinct person_id \n from obs \n where concept_id = 3785 and value_coded = 1034 \n and obs_datetime >= :startDate \n and obs_datetime <= :endDate \n ) \n ) \n \n \n AND o.person_id not in ( \n select distinct os.person_id \n from obs os \n -- Patient must not be a tranfer in \n where os.concept_id = 3772 and os.value_coded =2095 \n AND (os.obs_datetime BETWEEN :startDate AND :endDate) \n ) \n ) \n and ob.voided = 0 \n or ob.person_id in ( \n select ob.person_id \n FROM obs ob \n -- Extra Pulmonary TB in ART Intake \n where ob.concept_id = 2236 and ob.value_coded = 2233 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.voided = 0 \n ) \n \n','2023-03-28 12:05:40',4,'2023-03-29 18:14:16',4,0,NULL,NULL,NULL,'155d4939-e304-4aa0-a2d4-efc18644affa'),(1856,'HHCM with Documented HIV Status','High risk population of HHCM with Documented HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM with Documented HIV Status\n High risk population of HHCM with Documented HIV Status\n \n 2023-03-28 10:39:40 UTC\n \n 2023-03-28 10:42:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1856\n select distinct o.person_id \n from obs o \n -- Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded =3777 -- Population (Household member of current miner) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 16:09:40',4,'2023-03-28 16:12:42',4,0,NULL,NULL,NULL,'6584ebef-9d17-4b53-80ba-7396b170919f'),(1857,'HHXM with Documented HIV Status','High risk population of HHXM with Documented HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM with Documented HIV Status\n High risk population of HHXM with Documented HIV Status\n \n 2023-03-28 10:46:20 UTC\n \n 2023-03-28 10:48:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1857\n select distinct o.person_id \n from obs o \n -- Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded =3778 -- Population (Household member of Ex miner) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 16:16:20',4,'2023-03-28 16:18:26',4,0,NULL,NULL,NULL,'f06272eb-e3f7-4d7e-82d1-1e3a391a8b9e'),(1858,'HHCM with Positive HIV Status','High risk population of HHCM with Positive HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM with Positive HIV Status\n High risk population of HHCM with Positive HIV Status\n \n 2023-03-28 10:54:07 UTC\n \n 2023-03-28 10:59:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1858\n select distinct o.person_id \n from obs o \n -- Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded =3777 -- Population (Household member of current miner) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 16:24:07',4,'2023-03-28 16:29:14',4,0,NULL,NULL,NULL,'2b06bd4f-a633-48d8-9a9a-12ae5f84001b'),(1859,'HHXM with Positive HIV Status','High risk population of HHXM with Positive HIV Status','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM with Positive HIV Status\n High risk population of HHXM with Positive HIV Status\n \n 2023-03-28 11:03:32 UTC\n \n 2023-03-28 11:08:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1859\n select distinct o.person_id \n from obs o \n -- Positive, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded =3778 -- Population (Household member of Ex miner) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 16:33:32',4,'2023-03-28 16:38:06',4,0,NULL,NULL,NULL,'46bd9d48-49d2-4fd5-b433-f1123f217588'),(1860,'Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - Relapse','Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - Relapse','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - Relapse\n Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - Relapse\n \n 2023-03-28 11:42:29 UTC\n \n 2023-03-29 16:33:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1860\n select distinct ob.person_id \n FROM obs ob \ninner join location l on ob.location_id = l.location_id \n \n where ob.concept_id = 3788 and ob.value_coded = 2233 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.person_id in \n ( \n select distinct o.person_id \n \n from obs o \n -- New TB Patient \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n -- TB Start Date \n where ob.concept_id = 2237 \n and ob.value_datetime >= :startDate \n and ob.value_datetime <= :endDate \n and ob.voided = 0 \n ) \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- New Clients \n select distinct person_id \n from obs \n where concept_id = 3785 and value_coded = 1034 \n and obs_datetime >= :startDate \n and obs_datetime <= :endDate \n ) \n ) \n \n \n AND o.person_id not in ( \n select distinct os.person_id \n from obs os \n -- Patient must not be a tranfer in \n where os.concept_id = 3772 and os.value_coded =2095 \n AND (os.obs_datetime BETWEEN :startDate AND :endDate) \n ) \n ) \n and ob.voided = 0 \n or ob.person_id in ( \n select ob.person_id \n FROM obs ob \n -- Extra Pulmonary TB in ART Intake \n where ob.concept_id = 2236 and ob.value_coded = 2233 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.voided = 0 \n ) \n \n','2023-03-28 13:42:29',4,'2023-03-29 18:33:58',4,0,NULL,NULL,NULL,'b2905cf9-63d5-4b7b-9a72-0f76caf70da3'),(1861,'HHXM with HIV Positive on CPT/Dapzone','High risk population of HHXM with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM with HIV Positive on CPT/Dapzone\n High risk population of HHXM with HIV Positive on CPT/Dapzone\n \n 2023-03-28 13:51:41 UTC\n \n 2023-03-28 13:52:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1861\n select distinct o.person_id \n from obs o \n -- Positive, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded =3778 -- Population (Household member of Ex miner) \n AND ob.voided = 0 \n \n ) \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 5415 and ob.value_coded in (2330,4619) -- On Dapsone/CPT AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 19:21:41',4,'2023-03-28 19:22:17',4,0,NULL,NULL,NULL,'0133ee85-0abd-494a-86b7-6818670bd37b'),(1862,'Extra-pulmonary (bacteriologically confirmed or clinically diagnosed) - Exlude relapse','Extra-pulmonary (bacteriologically confirmed or clinically diagnosed) - Exlude relapse','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Extra-pulmonary (bacteriologically confirmed or clinically diagnosed) - Exlude relapse\n Extra-pulmonary (bacteriologically confirmed or clinically diagnosed) - Exlude relapse\n \n 2023-03-28 14:29:38 UTC\n \n 2023-03-29 16:36:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1862\n select distinct ob.person_id \n FROM obs ob \n \ninner join location l on ob.location_id = l.location_id \n \n -- Relapsed TB Client \nWHERE (ob.location_id =:location or parent_location =:location) \nand ob.concept_id = 3788 and ob.value_coded = 2233 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.person_id in \n ( \n select o.person_id \n from obs o \n where o.concept_id = 3785 and o.value_coded in (3786,1037) \n and o.obs_datetime >= :startDate \n and o.obs_datetime <= :endDate \n ) \n and ob.voided = 0 \n or ob.person_id in ( \n select ob.person_id \n FROM obs ob \n -- Extra Pulmonary TB in ART Intake \n where ob.concept_id = 2236 and ob.value_coded = 2233 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.voided = 0 \n ) \n \n','2023-03-28 16:29:38',4,'2023-03-29 18:36:39',4,0,NULL,NULL,NULL,'5023a0c3-15b8-4d16-ac54-09a77d01648d'),(1863,'HHCM with HIV Positive on CPT/Dapzone','High risk population of HHCM with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM with HIV Positive on CPT/Dapzone\n High risk population of HHCM with HIV Positive on CPT/Dapzone\n \n 2023-03-28 15:05:16 UTC\n \n 2023-03-28 15:09:54 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1863\n select distinct o.person_id \n from obs o \n -- Positive, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded =3777 -- Population (Household member of miner) \n AND ob.voided = 0 \n \n ) \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 5415 and ob.value_coded in (2330,4619) -- On Dapsone/CPT AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 20:35:16',4,'2023-03-28 20:39:54',4,0,NULL,NULL,NULL,'6365d73a-6fde-4e27-a75b-b5010023ddea'),(1864,'New and Relapse with HIV Positive on CPT/Dapzone','High risk population of New and Relapse with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n New and Relapse with HIV Positive on CPT/Dapzone\n High risk population of New and Relapse with HIV Positive on CPT/Dapzone\n \n 2023-03-28 15:14:37 UTC\n \n 2023-03-28 15:16:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1864\n select distinct o.person_id \n from obs o \n -- Positive, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded in (1034, 1084) -- Population (New and Relapse) \n AND ob.voided = 0 \n \n ) \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 5415 and ob.value_coded in (2330,4619) -- On Dapsone/CPT AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 20:44:37',4,'2023-03-28 20:46:55',4,0,NULL,NULL,NULL,'14343630-0c58-4f34-8bb5-1744e1618c31'),(1865,'Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : New','Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : New','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : New\n Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : New\n \n 2023-03-28 15:16:26 UTC\n \n 2023-03-29 16:47:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1865\n select distinct o.person_id \n FROM obs o \ninner join location l on o.location_id = l.location_id \n -- Bacteriologically confirmed Genotypic test results and Phenotypic test results \n where (o.location_id =:location or parent_location =:location) \n and o.concept_id in (3814, 3815) \n and o.obs_datetime >= :startDate \n and o.obs_datetime <= :endDate \n and o.voided = 0 \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- New Clients \n select distinct person_id \n from obs \n where concept_id = 3785 and value_coded = 1034 \n and obs_datetime >= :startDate \n and obs_datetime <= :endDate \n ) \n ) \n and o.person_id in ( \n select person_id \n from obs where concept_id = 3789 and value_coded= 3791 \n and obs_datetime >= :startDate \n and obs_datetime <= :endDate \n ) \n and o.person_id in ( \n select ob.person_id \n FROM obs ob \n -- Pulmonary TB \n where ob.concept_id = 3788 and ob.value_coded = 1018 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.voided = 0 \n ) \n or o.person_id in ( \n select ob.person_id \n FROM obs ob \n -- Pulmonary TB, Bacteriologically Confirmed \n where ob.concept_id = 2236 and ob.value_coded = 2234 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.voided = 0 \n )\n','2023-03-28 17:16:26',4,'2023-03-29 18:47:04',4,0,NULL,NULL,NULL,'273f38fa-7a41-4323-ac9d-24fd27c0c4cf'),(1866,'Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : Relapse','Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : Relapse','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : Relapse\n Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : Relapse\n \n 2023-03-28 15:21:59 UTC\n \n 2023-03-29 16:47:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1866\n select distinct o.person_id \n FROM obs o \n \ninner join location l on o.location_id = l.location_id \nWHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (3814, 3815) \n and o.obs_datetime >= :startDate \n and o.obs_datetime <= :endDate \n and o.voided = 0 \n AND o.person_id in \n ( \n \n -- Relapsed Clients \n select distinct oo.person_id \n from obs oo \n where oo.concept_id = 3785 and oo.value_coded = 1084 \n and oo.obs_datetime >= :startDate \n and oo.obs_datetime <= :endDate \n ) \n and o.person_id in ( \n select person_id \n from obs where concept_id = 3789 and value_coded= 3791 \n and obs_datetime >= :startDate \n and obs_datetime <= :endDate \n ) \n and o.person_id in ( \n select ob.person_id \n FROM obs ob \n -- Pulmonary TB \n where ob.concept_id = 3788 and ob.value_coded = 1018 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.voided = 0 \n ) \n or o.person_id in ( \n select ob.person_id \n FROM obs ob \n -- Pulmonary TB, Bacteriologically Confirmed \n where ob.concept_id = 2236 and ob.value_coded = 2234 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.voided = 0 \n )\n','2023-03-28 17:21:59',4,'2023-03-29 18:47:31',4,0,NULL,NULL,NULL,'300b2de6-1987-4ae2-a742-c2907f6bc2b7'),(1867,'Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : Excluding Relapse','Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : Excluding Relapse','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : Excluding Relapse\n Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : Excluding Relapse\n \n 2023-03-28 15:25:40 UTC\n \n 2023-03-30 15:34:09 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1867\n select distinct o.person_id \n FROM obs o \ninner join location l on o.location_id = l.location_id \nWHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (3814, 3815) \n and o.obs_datetime >= :startDate \n and o.obs_datetime <= :endDate \n and o.voided = 0 \n AND o.person_id in ( \n select person_id from obs \n where concept_id = 3788 and value_coded = 2233 \n and obs_datetime >= :startDate \n and obs_datetime <= :endDate \n \n ) \n AND o.person_id not in \n ( \n \n -- Relapsed Clients \n select distinct person_id \n from obs \n where concept_id = 3785 and value_coded = 1084 \n and obs_datetime >= :startDate \n and obs_datetime <= :endDate \n ) \n and o.person_id in ( \n select person_id \n from obs where concept_id = 3789 and value_coded= 3791 \n and obs_datetime >= :startDate \n and obs_datetime <= :endDate \n ) \n and o.person_id in ( \n select ob.person_id \n FROM obs ob \n -- Pulmonary TB \n where ob.concept_id = 3788 and ob.value_coded = 1018 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.voided = 0 \n ) \n or o.person_id in ( \n select ob.person_id \n FROM obs ob \n -- Pulmonary TB, Bacteriologically Confirmed \n where ob.concept_id = 2236 and ob.value_coded = 2234 \n and ob.obs_datetime >= :startDate \n and ob.obs_datetime <= :endDate \n and ob.voided = 0 \n )\n','2023-03-28 17:25:40',4,'2023-03-30 17:34:09',4,0,NULL,NULL,NULL,'fc1f07c9-e4d5-4d2f-97fb-98b26e6f66d0'),(1868,'Retreatment with HIV Positive on CPT/Dapzone','Retreatment Excl. Relapse with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Retreatment with HIV Positive on CPT/Dapzone\n Retreatment Excl. Relapse with HIV Positive on CPT/Dapzone\n \n 2023-03-28 15:28:13 UTC\n \n 2023-03-28 15:30:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1868\n select distinct o.person_id \n from obs o \n -- Positive, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded in (3786, 1037) -- Population (Retreatment Excl. Relapse) \n AND ob.voided = 0 \n \n ) \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 5415 and ob.value_coded in (2330,4619) -- On Dapsone/CPT AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 20:58:13',4,'2023-03-28 21:00:05',4,0,NULL,NULL,NULL,'fc64e900-ad46-45b3-9514-3d9aaefbd2cf'),(1869,'Children < 15 with Positive HIV on CPT/Dapzone','Children < 15 with Positive HIV on CPT/Dapzone','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children < 15 with Positive HIV on CPT/Dapzone\n Children < 15 with Positive HIV on CPT/Dapzone\n \n 2023-03-28 15:51:27 UTC\n \n 2023-03-29 21:44:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1869\n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- HIV Positive Status \n inner join location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 5415 and ob.value_coded in (2330,4619) -- On Dapsone/CPT AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n having Age < 15\n','2023-03-28 17:51:27',4,'2023-03-29 23:44:53',4,0,NULL,NULL,NULL,'36fe954a-f05e-431b-9037-4772a4b28383'),(1870,'Miners with HIV Positive on CPT/Dapzone','High risk population Miners with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Miners with HIV Positive on CPT/Dapzone\n High risk population Miners with HIV Positive on CPT/Dapzone\n \n 2023-03-28 15:55:23 UTC\n \n 2023-03-28 15:56:49 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1870\n select distinct o.person_id \n from obs o \n -- Positive, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded =3667 -- Population (miner) \n AND ob.voided = 0 \n \n ) \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 5415 and ob.value_coded in (2330,4619) -- On Dapsone/CPT AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 21:25:23',4,'2023-03-28 21:26:49',4,0,NULL,NULL,NULL,'354da83b-27c3-4124-9198-d1902fefb417'),(1871,'Ex Miner with HIV Positive on CPT/Dapzone',' High risk population of Ex Miner with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Ex Miner with HIV Positive on CPT/Dapzone\n High risk population of Ex Miner with HIV Positive on CPT/Dapzone\n \n 2023-03-28 16:02:40 UTC\n \n 2023-03-28 16:06:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1871\n select distinct o.person_id \n from obs o \n -- Positive, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded =3668 -- Population (Ex miner) \n AND ob.voided = 0 \n \n ) \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 5415 and ob.value_coded in (2330,4619) -- On Dapsone/CPT AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 21:32:40',4,'2023-03-28 21:36:28',4,0,NULL,NULL,NULL,'ff703f75-36cc-4487-afab-65df0ccbff68'),(1872,'Factory Workers with HIV Positive on CPT/Dapzone','High risk population of Factory Workers with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Factory Workers with HIV Positive on CPT/Dapzone\n High risk population of Factory Workers with HIV Positive on CPT/Dapzone\n \n 2023-03-28 16:08:16 UTC\n \n 2023-03-28 16:09:25 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1872\n select distinct o.person_id \n from obs o \n -- Positive, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded =3770 -- Population (Factory Workers) \n AND ob.voided = 0 \n \n ) \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 5415 and ob.value_coded in (2330,4619) -- On Dapsone/CPT AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 21:38:16',4,'2023-03-28 21:39:25',4,0,NULL,NULL,NULL,'ff030c28-e12b-45ed-80b0-330e353fdd29'),(1873,'Public transport operators with HIV Positive on CPT/Dapzone','High risk population of Public transport operators with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Public transport operators with HIV Positive on CPT/Dapzone\n High risk population of Public transport operators with HIV Positive on CPT/Dapzone\n \n 2023-03-28 16:14:01 UTC\n \n 2023-03-28 16:14:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1873\n select distinct o.person_id \n from obs o \n -- Positive, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded =4654 -- Population (Public transport operators) \n AND ob.voided = 0 \n \n ) \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 5415 and ob.value_coded in (2330,4619) -- On Dapsone/CPT AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 21:44:01',4,'2023-03-28 21:44:45',4,0,NULL,NULL,NULL,'b116d4a0-174f-49a7-be0f-3d5f79581b05'),(1874,'Health workers with HIV Positive on CPT/Dapzone',' High risk population of Health workers with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Health workers with HIV Positive on CPT/Dapzone\n High risk population of Health workers with HIV Positive on CPT/Dapzone\n \n 2023-03-28 16:16:21 UTC\n \n 2023-03-28 16:17:38 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1874\n select distinct o.person_id \n from obs o \n -- Positive, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded =3470 -- Population (Health workers) \n AND ob.voided = 0 \n \n ) \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 5415 and ob.value_coded in (2330,4619) -- On Dapsone/CPT AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 21:46:21',4,'2023-03-28 21:47:38',4,0,NULL,NULL,NULL,'4c4aa324-1728-4001-a94e-e857574126b1'),(1875,'Correctional Staff and inmates with HIV Positive on CPT/Dapzone','High risk population of Correctional Staff and inmates with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Correctional Staff and inmates with HIV Positive on CPT/Dapzone\n High risk population of Correctional Staff and inmates with HIV Positive on CPT/Dapzone\n \n 2023-03-28 16:20:31 UTC\n \n 2023-03-28 16:27:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1875\n select distinct o.person_id \n from obs o \n -- Positive, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded in (3779, 3671) -- Population (Correctional Staff and inmates) \n AND ob.voided = 0 \n \n ) \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 5415 and ob.value_coded in (2330,4619) -- On Dapsone/CPT AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-28 21:50:31',4,'2023-03-28 21:57:26',4,0,NULL,NULL,NULL,'423a7240-f359-41a2-929d-7b1cd7010807'),(1876,'TB among Miners','TB among Key Population Group Miners','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB among Miners\n TB among Key Population Group Miners\n \n 2023-03-28 17:11:27 UTC\n \n 2023-03-28 17:34:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1876\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in( \nSELECT Id \nFROM \n((SELECT distinct Id, patientIdentifier AS "Patient_Identifier", patientName AS "Patient_Name" \n FROM \n \n (select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n person.gender AS Gender, \n observed_age_group.name AS age_group, \n observed_age_group.sort_order AS sort_order \n \n from obs o \n -- Miners \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- Miners \n select distinct person_id \n from obs \n where concept_id = 3776 and value_coded = 3667 \n and obs_datetime >= CAST(:startDate AS DATE) \n and obs_datetime <= CAST(:endDate AS DATE) \n ) \n ) \n \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages') AS NEW_TB_CLIENTS \n ORDER BY NEW_TB_CLIENTS.Age) \n \n) AS Miner \n)\n','2023-03-28 22:41:27',4,'2023-03-28 23:04:23',4,0,NULL,NULL,NULL,'273e3515-f928-4164-be82-fc5235d66188'),(1877,'TB among Exminers','TB among Key Population Group Exminers','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB among Exminers\n TB among Key Population Group Exminers\n \n 2023-03-28 17:40:01 UTC\n \n 2023-03-28 17:41:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1877\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in( \nSELECT Id \nFROM \n((SELECT distinct Id, patientIdentifier AS "Patient_Identifier", patientName AS "Patient_Name" \n FROM \n \n (select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n person.gender AS Gender, \n observed_age_group.name AS age_group, \n observed_age_group.sort_order AS sort_order \n \n from obs o \n -- Exminers \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- Exminers \n select distinct person_id \n from obs \n where concept_id = 3776 and value_coded = 3668 \n and obs_datetime >= CAST(:startDate AS DATE) \n and obs_datetime <= CAST(:endDate AS DATE) \n ) \n ) \n \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages') AS NEW_TB_CLIENTS \n ORDER BY NEW_TB_CLIENTS.Age) \n \n) AS Exminer \n)\n','2023-03-28 23:10:01',4,'2023-03-28 23:11:15',4,0,NULL,NULL,NULL,'ecb47cb2-6af4-4932-8fee-076ba40afa87'),(1878,'TB among HHCM','TB among Key Population Group HHCM','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB among HHCM\n TB among Key Population Group HHCM\n \n 2023-03-28 19:19:59 UTC\n \n 2023-03-28 19:26:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1878\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in( \nSELECT Id \nFROM \n((SELECT distinct Id, patientIdentifier AS "Patient_Identifier", patientName AS "Patient_Name" \n FROM \n \n (select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n person.gender AS Gender, \n observed_age_group.name AS age_group, \n observed_age_group.sort_order AS sort_order \n \n from obs o \n -- HHCM \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- HHCM \n select distinct person_id \n from obs \n where concept_id = 3776 and value_coded = 3777 \n and obs_datetime >= CAST(:startDate AS DATE) \n and obs_datetime <= CAST(:endDate AS DATE) \n ) \n ) \n \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages') AS NEW_TB_CLIENTS \n ORDER BY NEW_TB_CLIENTS.Age) \n \n) As HHCM \n)\n','2023-03-29 00:49:59',4,'2023-03-29 00:56:17',4,0,NULL,NULL,NULL,'0da939c1-ae87-45c8-80ed-e56b82e5a62e'),(1879,'Correctional Staff and inmates on HIV Positive on ART','High risk population of Correctional Staff and inmates on HIV Positive on ART','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Correctional Staff and inmates on HIV Positive on ART\n High risk population of Correctional Staff and inmates on HIV Positive on ART\n \n 2023-03-28 19:25:59 UTC\n \n 2023-03-29 20:58:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1879\n select distinct o.person_id \n from obs o \n -- On ART \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4667 and o.value_coded in (4670, 4669) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded in (3779, 3671) -- Population (Correctional Staff and inmates) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \nAND o.obs_datetime >= CAST(:endDate AS DATE) \n\n','2023-03-28 21:25:59',4,'2023-03-29 22:58:43',4,0,NULL,NULL,NULL,'a6ebd7a8-631b-4e0e-bdfb-8be1b9fb9eec'),(1880,'New and Relapse with HIV Positive on ART','High risk population of New and Relapse with HIV Positive on ART','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n New and Relapse with HIV Positive on ART\n High risk population of New and Relapse with HIV Positive on ART\n \n 2023-03-28 19:29:52 UTC\n \n 2023-03-28 19:32:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1880\n SELECT DISTINCT o.person_id \n from obs o \n -- New and Relapse On ART \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4667 and o.value_coded in (4670, 4669) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3785 and ob.value_coded in (1034, 1084) -- New and Relapse \n and ob.voided = 0 \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE)\n','2023-03-29 00:59:52',4,'2023-03-29 01:02:02',4,0,NULL,NULL,NULL,'8067c849-4c81-475a-a26e-68a2e58b8067'),(1882,'Retreatment with HIV Positive on ART','High risk population of Retreatment Excl. Relapse HIV Positive on ART','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Retreatment with HIV Positive on ART\n High risk population of Retreatment Excl. Relapse HIV Positive on ART\n \n 2023-03-28 19:34:51 UTC\n \n 2023-03-28 19:45:46 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1882\n SELECT DISTINCT o.person_id \n from obs o \n -- Retreatmentafter LTFU/Failure on ART \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4667 and o.value_coded in (4670, 4669) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3785 and ob.value_coded in (3786, 1037) -- Retreatmentafter LTFU/Failure \n and ob.voided = 0 \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-29 01:04:51',4,'2023-03-29 01:15:46',4,0,NULL,NULL,NULL,'fe4f73c9-4b24-4458-9ae1-9d3fcad9f9cb'),(1883,'TB among HHXM','TB among Key Population Group HHXM','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB among HHXM\n TB among Key Population Group HHXM\n \n 2023-03-28 19:35:03 UTC\n \n 2023-03-28 19:37:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1883\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in( \nSELECT Id \nFROM \n((SELECT distinct Id, patientIdentifier AS "Patient_Identifier", patientName AS "Patient_Name" \n FROM \n \n (select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n person.gender AS Gender, \n observed_age_group.name AS age_group, \n observed_age_group.sort_order AS sort_order \n \n from obs o \n -- HHXM \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- HHXM \n select distinct person_id \n from obs \n where concept_id = 3776 and value_coded = 3778 \n and obs_datetime >= CAST(:startDate AS DATE) \n and obs_datetime <= CAST(:endDate AS DATE) \n ) \n ) \n \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages') AS NEW_TB_CLIENTS \n ORDER BY NEW_TB_CLIENTS.Age) \n \n) AS HHXM \n)\n','2023-03-29 01:05:03',4,'2023-03-29 01:07:06',4,0,NULL,NULL,NULL,'4715bb07-7b64-4001-b5cb-ea555b425a07'),(1884,'TB among Factory Workers','TB among Key Population Group Factory Workers','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB among Factory Workers\n TB among Key Population Group Factory Workers\n \n 2023-03-28 19:43:14 UTC\n \n 2023-03-28 19:45:00 UTC\n \n \n endDate\n \n java.util.Date\n true\n \n \n startDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1884\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in( \nSELECT Id \nFROM \n((SELECT distinct Id, patientIdentifier AS "Patient_Identifier", patientName AS "Patient_Name" \n FROM \n \n (select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n person.gender AS Gender, \n observed_age_group.name AS age_group, \n observed_age_group.sort_order AS sort_order \n \n from obs o \n -- FactoryWorkers \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- FactoryWorkers \n select distinct person_id \n from obs \n where concept_id = 3776 and value_coded = 3669 \n and obs_datetime >= CAST(:startDate AS DATE) \n and obs_datetime <= CAST(:endDate AS DATE) \n ) \n ) \n \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages') AS NEW_TB_CLIENTS \n ORDER BY NEW_TB_CLIENTS.Age) \n \n) AS FactoryWorkers \n)\n','2023-03-29 01:13:14',4,'2023-03-29 01:15:01',4,0,NULL,NULL,NULL,'6bed2c03-ba40-477b-9a9a-67f3fcd50ea3'),(1885,'TB among Correctional Staff & Inmates','TB among Key Population Group Correctional Staff & Inmates','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB among Correctional Staff & Inmates\n TB among Key Population Group Correctional Staff & Inmates\n \n 2023-03-28 19:47:06 UTC\n \n 2023-03-28 19:49:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1885\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in( \nSELECT Id \nFROM \n((SELECT distinct Id, patientIdentifier AS "Patient_Identifier", patientName AS "Patient_Name" \n FROM \n \n (select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n person.gender AS Gender, \n observed_age_group.name AS age_group, \n observed_age_group.sort_order AS sort_order \n \n from obs o \n -- Correctional Staff & Inmates \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- Correctional Staff & Inmates \n select distinct person_id \n from obs \n where concept_id = 3776 and value_coded in (3779,3671) \n and obs_datetime >= CAST(:startDate AS DATE) \n and obs_datetime <= CAST(:endDate AS DATE) \n ) \n ) \n \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages') AS NEW_TB_CLIENTS \n ORDER BY NEW_TB_CLIENTS.Age) \n \n) AS Correctional \n)\n','2023-03-29 01:17:06',4,'2023-03-29 01:19:30',4,0,NULL,NULL,NULL,'9016d0ef-4556-49e7-99bd-2bf2e7f5188f'),(1886,'Children < 15 with HIV Positive on ART','High risk population for Children < 15 with HIV Positive on ART','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children < 15 with HIV Positive on ART\n High risk population for Children < 15 with HIV Positive on ART\n \n 2023-03-28 19:47:46 UTC\n \n 2023-03-28 19:50:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1886\n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- HIV Positive on ART \n inner join location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4667 and o.value_coded in (4670, 4669) \n AND o.voided = 0 \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n having Age < 15\n','2023-03-29 01:17:46',4,'2023-03-29 01:20:02',4,0,NULL,NULL,NULL,'e724e30e-b9e1-4a19-afa9-d19aa8dc42f4'),(1887,'TB among Public Transport Operators ','TB among Key Population Group Public Transport Operators','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB among Public Transport Operators \n TB among Key Population Group Public Transport Operators\n \n 2023-03-28 19:51:36 UTC\n \n 2023-03-28 19:53:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1887\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in( \nSELECT Id \nFROM \n((SELECT distinct Id, patientIdentifier AS "Patient_Identifier", patientName AS "Patient_Name" \n FROM \n \n (select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n person.gender AS Gender, \n observed_age_group.name AS age_group, \n observed_age_group.sort_order AS sort_order \n \n from obs o \n -- Transport \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- Transport \n select distinct person_id \n from obs \n where concept_id = 3776 and value_coded = 4654 \n and obs_datetime >= CAST(:startDate AS DATE) \n and obs_datetime <= CAST(:endDate AS DATE) \n ) \n ) \n \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages') AS NEW_TB_CLIENTS \n ORDER BY NEW_TB_CLIENTS.Age) \n \n) AS Transport \n)\n','2023-03-29 01:21:36',4,'2023-03-29 01:23:32',4,0,NULL,NULL,NULL,'4aac5017-e28a-4f36-8805-0812476a9d7b'),(1888,'Miners with HIV Positive on ART','High risk population of Miners with HIV Positive on ART','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Miners with HIV Positive on ART\n High risk population of Miners with HIV Positive on ART\n \n 2023-03-28 19:55:27 UTC\n \n 2023-03-28 19:56:16 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1888\n select distinct o.person_id \n from obs o \n -- HIV Positive on ART \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 and o.value_coded in (4323, 4664) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded = 3667 -- Population (Miner) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-29 01:25:27',4,'2023-03-29 01:26:16',4,0,NULL,NULL,NULL,'a37a95b7-1365-4d73-8d21-28dd2e77196e'),(1889,'TB among Health Workers','TB among Key Population Group Health Workers','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB among Health Workers\n TB among Key Population Group Health Workers\n \n 2023-03-28 19:55:49 UTC\n \n 2023-03-28 19:57:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1889\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in( \nSELECT Id \nFROM \n((SELECT distinct Id, patientIdentifier AS "Patient_Identifier", patientName AS "Patient_Name" \n FROM \n \n (select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n person.gender AS Gender, \n observed_age_group.name AS age_group, \n observed_age_group.sort_order AS sort_order \n \n from obs o \n -- HealthWorkers \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in \n ( \n select distinct ob.person_id \n from obs ob \n where ob.person_id in ( \n -- HealthWorkers \n select distinct person_id \n from obs \n where concept_id = 3776 and value_coded = 3670 \n and obs_datetime >= CAST(:startDate AS DATE) \n and obs_datetime <= CAST(:endDate AS DATE) \n ) \n ) \n \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages') AS NEW_TB_CLIENTS \n ORDER BY NEW_TB_CLIENTS.Age) \n \n) AS HealthWorkers \n)\n','2023-03-29 01:25:49',4,'2023-03-29 01:27:20',4,0,NULL,NULL,NULL,'04590a3f-4e59-45fe-a5c3-f5ae76ef805b'),(1890,'Ex Miner with with HIV Positive on ART','High risk population of Ex Miner with with HIV Positive on ART','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Ex Miner with with HIV Positive on ART\n High risk population of Ex Miner with with HIV Positive on ART\n \n 2023-03-28 19:58:00 UTC\n \n 2023-03-28 19:59:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1890\n select distinct o.person_id \n from obs o \n -- HIV Positive on ART \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4667 and o.value_coded in (4670, 4669) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded = 3668 -- Population (Ex-Miner) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-29 01:28:00',4,'2023-03-29 01:29:01',4,0,NULL,NULL,NULL,'1edf0f21-2fad-48c7-a24a-e21367f334c1'),(1891,'HHCM with with HIV Positive on ART','High risk population of HHCM with with HIV Positive on ART','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM with with HIV Positive on ART\n High risk population of HHCM with with HIV Positive on ART\n \n 2023-03-28 20:00:28 UTC\n \n 2023-03-28 20:03:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1891\n select distinct o.person_id \n from obs o \n -- HIV Positive on ART \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4667 and o.value_coded in (4670, 4669) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded =3777 -- Population (Household member of current miner) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-29 01:30:28',4,'2023-03-29 01:33:58',4,0,NULL,NULL,NULL,'14b8879f-49ef-492c-aeb0-fdd62fde084a'),(1892,'TB among Miners','TB among Key Population Group Miners','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB among Miners\n TB among Key Population Group Miners\n \n 2023-03-28 20:05:03 UTC\n \n 2023-03-28 20:12:22 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1892\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 01:35:03',4,'2023-03-29 01:42:22',4,0,NULL,NULL,NULL,'526100b3-2b2a-4f15-862e-4be06d73bdb3'),(1893,'HHXM with HIV Positive on ART','High risk population of HHXM with HIV Positive on ART','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM with HIV Positive on ART\n High risk population of HHXM with HIV Positive on ART\n \n 2023-03-28 20:05:19 UTC\n \n 2023-03-28 20:08:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1893\n select distinct o.person_id \n from obs o \n -- Positive, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4667 and o.value_coded in (4670, 4669) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded =3778 -- Population (Household member of Ex miner) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-29 01:35:19',4,'2023-03-29 01:38:02',4,0,NULL,NULL,NULL,'0d7e9652-b8fa-4264-859b-0b681452c462'),(1894,'Factory Workers with HIV Positive on ART','High risk population of Factory Workers with HIV Positive on ART','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Factory Workers with HIV Positive on ART\n High risk population of Factory Workers with HIV Positive on ART\n \n 2023-03-28 20:09:30 UTC\n \n 2023-03-28 20:10:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1894\n select distinct o.person_id \n from obs o \n -- Positive HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4667 and o.value_coded in (4670, 4669) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded = 3669 -- Population (Factory Workers) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-29 01:39:30',4,'2023-03-29 01:40:27',4,0,NULL,NULL,NULL,'67233a82-27bf-4615-948b-28fad7ad6322'),(1895,'Public transport operators with HIV Positive on ART','High risk population of Public transport operators with HIV Positive on ART','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Public transport operators with HIV Positive on ART\n High risk population of Public transport operators with HIV Positive on ART\n \n 2023-03-28 20:12:15 UTC\n \n 2023-03-28 20:14:34 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1895\n select distinct o.person_id \n from obs o \n -- Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4666 \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded = 4654 -- Population (Public transport operators) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-29 01:42:15',4,'2023-03-29 01:44:34',4,0,NULL,NULL,NULL,'63418340-29fe-4106-83ad-a09538397f5f'),(1896,'TB among Exminers','TB among Key Population Group Ex Miners','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB among Exminers\n TB among Key Population Group Ex Miners\n \n 2023-03-28 20:13:33 UTC\n \n 2023-03-28 20:18:09 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1896\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 01:43:33',4,'2023-03-29 01:48:09',4,0,NULL,NULL,NULL,'2dcbfff3-70b6-4ed5-b727-a51fea71b8aa'),(1897,'Health workers with HIV Positive on ART','High risk population of Health workers with HIV Positive on ART','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Health workers with HIV Positive on ART\n High risk population of Health workers with HIV Positive on ART\n \n 2023-03-28 20:18:06 UTC\n \n 2023-03-28 20:18:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1897\n select distinct o.person_id \n from obs o \n -- Documented HIV, Status \n INNER JOIN location l on o.location_id = l.location_id \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.concept_id = 4667 and o.value_coded in (4670, 4669) \n AND o.voided = 0 \n AND o.person_id in \n ( \n Select ob.person_id \n from obs ob \n where ob.concept_id = 3776 and ob.value_coded = 4670 -- Population (Health workers) \n AND ob.voided = 0 \n \n ) \n AND o.obs_datetime >= CAST(:startDate AS DATE) \n AND o.obs_datetime <= CAST(:endDate AS DATE) \n','2023-03-29 01:48:06',4,'2023-03-29 01:48:39',4,0,NULL,NULL,NULL,'1340548d-896a-4473-ae26-4c8960dec630'),(1898,'TB among HHCM','TB among Key Population Group HHCM','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB among HHCM\n TB among Key Population Group HHCM\n \n 2023-03-28 20:19:17 UTC\n \n 2023-03-28 20:20:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1898\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 01:49:17',4,'2023-03-29 01:50:21',4,0,NULL,NULL,NULL,'dd0ada55-f903-426e-a60e-f83ceeb15cab'),(1899,'TB among HHXM','TB among Key Population Group HHXM','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB among HHXM\n TB among Key Population Group HHXM\n \n 2023-03-28 20:21:08 UTC\n \n 2023-03-28 20:23:24 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1899\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 01:51:08',4,'2023-03-29 01:53:24',4,0,NULL,NULL,NULL,'9558eb96-47f5-4cdd-ad4f-d07257529259'),(1900,'Pulmonary Bacteriologically Confirmed - Exlude Relapse','Pulmonary Bacteriologically Confirmed - Exlude Relapse','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Pulmonary Bacteriologically Confirmed - Exlude Relapse\n Pulmonary Bacteriologically Confirmed - Exlude Relapse\n \n 2023-03-29 03:39:55 UTC\n \n 2023-03-29 17:21:25 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1900\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 05:39:55',4,'2023-03-29 19:21:25',4,0,NULL,NULL,NULL,'8315a536-5b6e-4da8-bcf7-860b6b6bd8aa'),(1902,'Pulmonary Bacteriologically Confirmed New','Pulmonary Bacteriologically Confirmed New','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Pulmonary Bacteriologically Confirmed New\n Pulmonary Bacteriologically Confirmed New\n \n 2023-03-29 04:12:11 UTC\n \n 2023-03-29 05:37:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1902\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 09:42:11',4,'2023-03-29 11:07:28',4,0,NULL,NULL,NULL,'15e06979-0f27-4aba-87fb-bc5a6dc28da4'),(1903,'Pulmonary Clinically Diagnosed Excluding Relapse','Pulmonary Clinically Diagnosed Excluding Relapse','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Pulmonary Clinically Diagnosed Excluding Relapse\n Pulmonary Clinically Diagnosed Excluding Relapse\n \n 2023-03-29 06:06:35 UTC\n \n 2023-03-29 08:12:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1903\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 11:36:35',4,'2023-03-29 13:42:28',4,0,NULL,NULL,NULL,'b0ff3ba5-25df-46e4-8eae-bfca7d86b9dd'),(1904,'Pulmonary Bacteriologically Confirmed Relapse','Pulmonary Bacteriologically Confirmed Relapse','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Pulmonary Bacteriologically Confirmed Relapse\n Pulmonary Bacteriologically Confirmed Relapse\n \n 2023-03-29 06:08:27 UTC\n \n 2023-03-29 08:11:19 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1904\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 11:38:27',4,'2023-03-29 13:41:19',4,0,NULL,NULL,NULL,'f6797c59-e7e3-4492-ad5f-a67bf5e683bc'),(1905,'Pulmonary Clinically Diagnosed New','Pulmonary Clinically Diagnosed New','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Pulmonary Clinically Diagnosed New\n Pulmonary Clinically Diagnosed New\n \n 2023-03-29 08:14:51 UTC\n \n 2023-03-29 08:17:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1905\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 13:44:51',4,'2023-03-29 13:47:31',4,0,NULL,NULL,NULL,'63333694-f766-4047-830b-087496f8e5a8'),(1906,'Pulmonary Clinically Diagnosed Relapse','Pulmonary Clinically Diagnosed Relapse','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Pulmonary Clinically Diagnosed Relapse\n Pulmonary Clinically Diagnosed Relapse\n \n 2023-03-29 08:15:08 UTC\n \n 2023-03-29 08:18:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1906\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 13:45:08',4,'2023-03-29 13:48:31',4,0,NULL,NULL,NULL,'2ff007c1-993d-48fc-8df6-9ed7c66b42d3'),(1907,'Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - New','Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - New','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - New\n Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - New\n \n 2023-03-29 08:25:10 UTC\n \n 2023-03-29 08:49:47 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1907\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 13:55:10',4,'2023-03-29 14:19:47',4,0,NULL,NULL,NULL,'d1ce1a2c-338a-4926-a1d4-f7f79ac2b875'),(1908,'TB among Factory Workers','TB among Key Population Group Factory Workers','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB among Factory Workers\n TB among Key Population Group Factory Workers\n \n 2023-03-29 08:26:00 UTC\n \n 2023-03-29 08:52:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1908\n COUNT\n \n \n \n \n endDate\n ${startDate}\n \n \n location\n ${location}\n \n \n startDate\n ${endDate}\n \n \n \n','2023-03-29 13:56:00',4,'2023-03-29 14:22:40',4,0,NULL,NULL,NULL,'071a7d7a-f944-4965-978c-bfe740051b9a'),(1909,'Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - Relapse','Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - Relapse','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - Relapse\n Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - Relapse\n \n 2023-03-29 08:52:39 UTC\n \n 2023-03-29 08:54:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1909\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 14:22:39',4,'2023-03-29 14:24:28',4,0,NULL,NULL,NULL,'20c9a6fc-f845-4569-b018-b5f59c39948c'),(1910,'Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - Excluging Relapse','Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - Excluging Relapse','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - Excluging Relapse\n Extra Pulmonary : (bacteriologically confirmed or clinically diagnosed) - Excluging Relapse\n \n 2023-03-29 08:53:19 UTC\n \n 2023-03-29 08:54:54 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1910\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 14:23:19',4,'2023-03-29 14:24:54',4,0,NULL,NULL,NULL,'422afe85-5763-4700-8a8b-bf17328901a8'),(1911,'TB among Correctional Staff & Inmates','TB among Key Population Group Correctional Staff & Inmates','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB among Correctional Staff & Inmates\n TB among Key Population Group Correctional Staff & Inmates\n \n 2023-03-29 08:53:58 UTC\n \n 2023-03-29 08:56:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1911\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 14:23:58',4,'2023-03-29 14:26:06',4,0,NULL,NULL,NULL,'8ac11f64-421a-4f48-9ac3-048ee6912eda'),(1912,'Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : Excluding Relapse','Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : Excluding Relapse','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : Excluding Relapse\n Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : Excluding Relapse\n \n 2023-03-29 08:55:36 UTC\n \n 2023-03-29 09:04:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1912\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 14:25:36',4,'2023-03-29 14:34:23',4,0,NULL,NULL,NULL,'83125cb9-0324-4e21-8f4d-b9fd51049909'),(1913,'TB among Public Transport Operators ','TB among Key Population Group Public Transport Operators','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB among Public Transport Operators \n TB among Key Population Group Public Transport Operators\n \n 2023-03-29 08:57:05 UTC\n \n 2023-03-29 08:59:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1913\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 14:27:05',4,'2023-03-29 14:29:07',4,0,NULL,NULL,NULL,'f3aabc74-880c-4502-94af-ff9fd0b95906'),(1914,'Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : New','Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : New','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : New\n Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : New\n \n 2023-03-29 08:59:37 UTC\n \n 2023-03-29 09:04:54 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1914\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 14:29:37',4,'2023-03-29 14:34:54',4,0,NULL,NULL,NULL,'c5e34544-e98f-42ce-82d1-3708ce5e5b80'),(1915,'TB among Health Workers','TB among Key Population Group Health Workers','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB among Health Workers\n TB among Key Population Group Health Workers\n \n 2023-03-29 09:02:15 UTC\n \n 2023-03-29 09:04:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1915\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 14:32:15',4,'2023-03-29 14:34:59',4,0,NULL,NULL,NULL,'76adf56b-486f-4a4c-b309-5c43372d94eb'),(1916,'TB Notification - Block 3','TB Notification - Block 3','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Notification - Block 3\n TB Notification - Block 3\n \n 2023-03-29 09:08:01 UTC\n \n 2023-03-29 09:08:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1916\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-03-29 14:38:01',4,'2023-03-29 14:38:31',4,0,NULL,NULL,NULL,'5a51f412-3b6f-4808-ae32-ed90141bb7e2'),(1917,'TB Notification - Block 3 Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Notification - Block 3 Data Set\n \n 2023-03-29 09:08:31 UTC\n \n 2023-03-29 10:08:22 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1917\n \n \n \n TB-HHCM\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n \n \n TB-HHXM\n \n \n \n \n \n \n \n \n \n TBExMiners\n \n \n \n \n \n \n \n \n \n TBFactoryW\n \n \n \n \n \n \n \n \n \n TBHealthW\n \n \n \n \n \n \n \n \n \n TBInmates\n \n \n \n \n \n \n \n \n \n TBMiners\n \n \n \n \n \n \n \n \n \n TBTrans\n \n \n \n \n \n \n \n \n \n','2023-03-29 14:38:31',4,'2023-03-29 15:38:22',4,0,NULL,NULL,NULL,'4e91ef91-ad5f-4717-b782-9ac61d52dc40'),(1919,'Block 1: All TB Patients diagnosed with TB during the current quarter, by history of treatment and anatomic site of disease Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Block 1: All TB Patients diagnosed with TB during the current quarter, by history of treatment and anatomic site of disease Data Set\n \n 2023-03-29 09:46:48 UTC\n \n 2023-03-29 15:30:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1919\n \n \n \n died1\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n \n \n died2\n \n \n \n \n \n \n \n \n \n died3\n \n \n \n \n \n \n \n \n \n extra1\n \n \n \n \n \n \n \n \n \n extra2\n \n \n \n \n \n \n \n \n \n extra3\n \n \n \n \n \n \n \n \n \n pul_ExPulm\n \n \n \n \n \n \n \n \n \n pul_clin1\n \n \n \n \n \n \n \n \n \n pul_diag2\n \n \n \n \n \n \n \n \n \n pul_new \n \n \n \n \n \n \n \n \n \n pul_newex\n \n \n \n \n \n \n \n \n \n pul_relaps\n \n \n \n \n \n \n \n \n \n','2023-03-29 11:46:48',4,'2023-03-29 17:30:32',4,0,NULL,NULL,NULL,'b7c3203a-888a-4139-9c3f-e9a8939bc811'),(1920,'New and Relapse with document HIV Status','','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n New and Relapse with document HIV Status\n \n \n 2023-03-29 14:22:45 UTC\n \n 2023-03-29 14:30:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1920\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 19:52:45',4,'2023-03-29 20:00:02',4,0,NULL,NULL,NULL,'18152a92-ded2-4f5a-af93-5dd01b51c839'),(1921,'Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : Relapse','Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : Relapse','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : Relapse\n Bacteriologically confirmed not started on treatment (m) ticked Died before treatment or Lost to follow up : Relapse\n \n 2023-03-29 15:26:50 UTC\n \n 2023-03-29 15:28:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1921\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 17:26:50',4,'2023-03-29 17:28:11',4,0,NULL,NULL,NULL,'61cb2cc7-ee32-4da9-9c82-7bbc85f3e43c'),(1922,'TB Notification - Block 1 ','TB Notification - Block 1 ','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Notification - Block 1 \n TB Notification - Block 1 \n \n 2023-03-29 17:06:10 UTC\n \n 2023-03-29 17:06:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1922\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-03-29 19:06:10',4,'2023-03-29 19:06:58',4,0,NULL,NULL,NULL,'c7604f80-13cf-4773-abf5-b95f35fa1c92'),(1923,'TB Notification - Block 1 Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Notification - Block 1 Data Set\n \n 2023-03-29 17:06:58 UTC\n \n 2024-03-01 08:33:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1923\n \n \n \n Bacter_Rel\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n \n \n Bacter_Ret\n \n \n \n \n \n \n \n \n \n Bacterio_N\n \n \n \n \n \n \n \n \n \n Diedb4T_ER\n \n \n \n \n \n \n \n \n \n Diedb4T_N\n \n \n \n \n \n \n \n \n \n Diedb4T_R\n \n \n \n \n \n \n \n \n \n EP_New\n \n \n \n \n \n \n \n \n \n EP_Relapse\n \n \n \n \n \n \n \n \n \n EP_Retreat\n \n \n \n \n \n \n \n \n \n','2023-03-29 22:36:58',4,'2024-03-01 14:03:28',4,0,NULL,NULL,NULL,'d74aa49a-aa20-49e1-939a-5f1fb0c78d81'),(1924,'Children < 15 with Documented HIV Status','Children (0 - 14) with documented HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children < 15 with Documented HIV Status\n Children (0 - 14) with documented HIV Status\n \n 2023-03-29 17:07:40 UTC\n \n 2023-03-29 17:08:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1924\n COUNT\n \n \n \n \n endDate\n ${startDate}\n \n \n location\n ${location}\n \n \n startDate\n ${endDate}\n \n \n \n','2023-03-29 19:07:40',4,'2023-03-29 19:08:45',4,0,NULL,NULL,NULL,'777854f8-1e75-4b4c-9eb5-2b2a23acd1fd'),(1925,'Correctional Staff and inmates with Documented HIV Status','High risk population of Correctional Staff and inmates with Documented HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Correctional Staff and inmates with Documented HIV Status\n High risk population of Correctional Staff and inmates with Documented HIV Status\n \n 2023-03-29 17:11:52 UTC\n \n 2023-03-29 17:16:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1925\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 19:11:52',4,'2023-03-29 19:16:20',4,0,NULL,NULL,NULL,'8e2ae589-9a13-4aa5-bf9d-3cf376a59bf6'),(1926,'Ex-Miners with Documented HIV Status','High risk population of Ex Miners with Documented HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Ex-Miners with Documented HIV Status\n High risk population of Ex Miners with Documented HIV Status\n \n 2023-03-29 17:20:28 UTC\n \n 2023-03-29 17:23:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1926\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 19:20:28',4,'2023-03-29 19:23:06',4,0,NULL,NULL,NULL,'b2541e20-b6b8-4985-bd4a-9a980ee5ebf8'),(1927,'Factory Workers with Documented HIV Status','High risk population of Factory Workers with Documented HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Factory Workers with Documented HIV Status\n High risk population of Factory Workers with Documented HIV Status\n \n 2023-03-29 17:25:11 UTC\n \n 2023-03-29 17:29:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1927\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 19:25:11',4,'2023-03-29 19:29:17',4,0,NULL,NULL,NULL,'e95e9d48-01d5-4826-ab2c-82dbd2dfce44'),(1928,'Health workers with Documented HIV Status','High risk population of Health workers with Documented HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Health workers with Documented HIV Status\n High risk population of Health workers with Documented HIV Status\n \n 2023-03-29 17:31:28 UTC\n \n 2023-03-29 17:33:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1928\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 19:31:28',4,'2023-03-29 19:33:36',4,0,NULL,NULL,NULL,'38dd8693-21f8-40c2-ba3a-9f5d1a63959c'),(1929,'HHCM with Documented HIV Status','High risk population of HHCM with Documented HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM with Documented HIV Status\n High risk population of HHCM with Documented HIV Status\n \n 2023-03-29 17:34:59 UTC\n \n 2023-03-29 17:36:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1929\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 19:34:59',4,'2023-03-29 19:36:32',4,0,NULL,NULL,NULL,'12a86c02-9e39-4d69-8082-ecff9269d106'),(1930,'Miners with Documented HIV Status','High risk population of miners with documented HIV','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Miners with Documented HIV Status\n High risk population of miners with documented HIV\n \n 2023-03-29 17:39:04 UTC\n \n 2023-03-29 17:42:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1930\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 19:39:04',4,'2023-03-29 19:42:27',4,0,NULL,NULL,NULL,'625cc3fd-4dc5-4aee-9fba-2559b31470c8'),(1931,'Public transport operators with Documented HIV Status','High risk population of Public transport operators with Documented HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Public transport operators with Documented HIV Status\n High risk population of Public transport operators with Documented HIV Status\n \n 2023-03-29 19:32:07 UTC\n \n 2023-03-29 19:33:35 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1931\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 21:32:07',4,'2023-03-29 21:33:35',4,0,NULL,NULL,NULL,'9e48b5ef-99df-44e7-8946-2728727e08a1'),(1932,'Retreatment with documented HIV status','Retreatment Excl. Relapse client with documented HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Retreatment with documented HIV status\n Retreatment Excl. Relapse client with documented HIV Status\n \n 2023-03-29 19:35:36 UTC\n \n 2023-03-29 19:36:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1932\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 21:35:36',4,'2023-03-29 21:36:55',4,0,NULL,NULL,NULL,'5cc834ec-7c90-4063-b684-2c9da8ddc83e'),(1933,'Children < 15 with Positive HIV Status','High risk population for Children < 15 with Positive HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children < 15 with Positive HIV Status\n High risk population for Children < 15 with Positive HIV Status\n \n 2023-03-29 19:40:57 UTC\n \n 2023-03-29 19:42:25 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1933\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 21:40:57',4,'2023-03-29 21:42:25',4,0,NULL,NULL,NULL,'9ceb1ec0-0b28-49d8-a6ba-90297cae2968'),(1934,'Correctional Staff and inmates with Positive HIV Status',' High risk population of Correctional Staff and inmates with Positive HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Correctional Staff and inmates with Positive HIV Status\n High risk population of Correctional Staff and inmates with Positive HIV Status\n \n 2023-03-29 19:44:28 UTC\n \n 2023-03-29 19:45:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1934\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 21:44:28',4,'2023-03-29 21:45:44',4,0,NULL,NULL,NULL,'c9be5185-942d-41ae-8e15-c3ddea7bb22f'),(1935,'Ex-Miners with Positive HIV Status','High risk population of Ex Miners with Positive HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Ex-Miners with Positive HIV Status\n High risk population of Ex Miners with Positive HIV Status\n \n 2023-03-29 19:47:14 UTC\n \n 2023-03-29 19:50:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1935\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 21:47:14',4,'2023-03-29 21:50:01',4,0,NULL,NULL,NULL,'51933c5f-9020-417a-91fe-77cb0412d9ee'),(1936,'Factory Workers with Positive HIV Status','High risk population of Factory Workers with Positive HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Factory Workers with Positive HIV Status\n High risk population of Factory Workers with Positive HIV Status\n \n 2023-03-29 19:52:48 UTC\n \n 2023-03-29 19:56:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1936\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 21:52:48',4,'2023-03-29 21:56:43',4,0,NULL,NULL,NULL,'a72725b5-eac8-4f97-b285-3a9db174ab39'),(1937,'Health workers with Positive HIV Status',' High risk population of Health workers with Positive HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Health workers with Positive HIV Status\n High risk population of Health workers with Positive HIV Status\n \n 2023-03-29 19:59:20 UTC\n \n 2023-03-29 20:04:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1937\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 21:59:20',4,'2023-03-29 22:04:12',4,0,NULL,NULL,NULL,'317c0cce-c0d7-44da-9272-62cc9279a76c'),(1938,'HHCM with Positive HIV Status',' High risk population of HHCM with Positive HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM with Positive HIV Status\n High risk population of HHCM with Positive HIV Status\n \n 2023-03-29 20:05:19 UTC\n \n 2023-03-29 20:09:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1938\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 22:05:19',4,'2023-03-29 22:09:51',4,0,NULL,NULL,NULL,'7a7dee7e-a318-4819-96e9-a1c8fe3e0a4f'),(1939,'HHXM with Positive HIV Status','High risk population of HHXM with Positive HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM with Positive HIV Status\n High risk population of HHXM with Positive HIV Status\n \n 2023-03-29 20:10:54 UTC\n \n 2023-03-29 20:11:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1939\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 22:10:54',4,'2023-03-29 22:11:59',4,0,NULL,NULL,NULL,'4a4bc063-3233-4b3f-9776-8949a2a3104c'),(1940,'Miners with Positive HIV Status','High risk population of miners with Positive HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Miners with Positive HIV Status\n High risk population of miners with Positive HIV Status\n \n 2023-03-29 20:13:09 UTC\n \n 2023-03-29 20:15:52 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1940\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 22:13:09',4,'2023-03-29 22:15:52',4,0,NULL,NULL,NULL,'a555cd0b-41bf-4ba0-bc0a-bb84952305d7'),(1941,'New and Relapse with Positive HIV Status','New and Relapse with Positive HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n New and Relapse with Positive HIV Status\n New and Relapse with Positive HIV Status\n \n 2023-03-29 20:17:12 UTC\n \n 2023-03-29 20:37:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1941\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 22:17:12',4,'2023-03-29 22:37:39',4,0,NULL,NULL,NULL,'5212b24d-abdf-416a-812e-72b4f64b342d'),(1942,'Public transport with Positive HIV Status','High risk population of Public transport operators with Positive HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Public transport with Positive HIV Status\n High risk population of Public transport operators with Positive HIV Status\n \n 2023-03-29 20:38:50 UTC\n \n 2023-03-29 20:39:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1942\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 22:38:50',4,'2023-03-29 22:39:44',4,0,NULL,NULL,NULL,'3ada2309-e8f6-4301-ae89-63837fb6f36b'),(1943,'Retreatment with Positive HIV status','Retreatment Excl. Relapse with Positive HIV status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Retreatment with Positive HIV status\n Retreatment Excl. Relapse with Positive HIV status\n \n 2023-03-29 20:41:12 UTC\n \n 2023-03-29 20:42:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1943\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 22:41:12',4,'2023-03-29 22:42:06',4,0,NULL,NULL,NULL,'ee1b5901-9777-44c1-affd-37e3aba4746a'),(1944,'Children < 15 with HIV Positive on ART','High risk population for Children < 15 with HIV Positive on ART','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children < 15 with HIV Positive on ART\n High risk population for Children < 15 with HIV Positive on ART\n \n 2023-03-29 20:43:47 UTC\n \n 2023-03-29 20:55:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1944\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 22:43:47',4,'2023-03-29 22:55:26',4,0,NULL,NULL,NULL,'f636be9d-0527-4054-9822-6ab005267560'),(1945,'Correctional Staff and inmates on HIV Positive on ART','High risk population of Correctional Staff and inmates on HIV Positive on ART','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Correctional Staff and inmates on HIV Positive on ART\n High risk population of Correctional Staff and inmates on HIV Positive on ART\n \n 2023-03-29 20:56:54 UTC\n \n 2023-03-29 20:59:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1945\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 22:56:54',4,'2023-03-29 22:59:44',4,0,NULL,NULL,NULL,'2c07cd7e-cc23-4974-9964-602e576ef80d'),(1946,'Ex Miner with with HIV Positive on ART','High risk population of Ex Miner with with HIV Positive on ART','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Ex Miner with with HIV Positive on ART\n High risk population of Ex Miner with with HIV Positive on ART\n \n 2023-03-29 21:01:08 UTC\n \n 2023-03-29 21:05:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1946\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 23:01:08',4,'2023-03-29 23:05:53',4,0,NULL,NULL,NULL,'8df71093-9cb8-4d1d-9885-fb4415f8c1b2'),(1947,'Factory Workers with HIV Positive on ART','High risk population of Factory Workers with HIV Positive on ART','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Factory Workers with HIV Positive on ART\n High risk population of Factory Workers with HIV Positive on ART\n \n 2023-03-29 21:07:39 UTC\n \n 2023-03-29 21:11:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1947\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 23:07:39',4,'2023-03-29 23:11:51',4,0,NULL,NULL,NULL,'6d1a75ee-e860-483d-ad80-4308d1009c22'),(1948,'Health workers with HIV Positive on ART',' High risk population of Health workers with HIV Positive on ART','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Health workers with HIV Positive on ART\n High risk population of Health workers with HIV Positive on ART\n \n 2023-03-29 21:13:26 UTC\n \n 2023-03-29 21:17:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1948\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 23:13:26',4,'2023-03-29 23:17:08',4,0,NULL,NULL,NULL,'b3813228-7114-4e37-b997-6acebccd724a'),(1949,'HHCM with with HIV Positive on ART','High risk population of HHCM with with HIV Positive on ART','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM with with HIV Positive on ART\n High risk population of HHCM with with HIV Positive on ART\n \n 2023-03-29 21:18:20 UTC\n \n 2023-03-29 21:19:22 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1949\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 23:18:20',4,'2023-03-29 23:19:22',4,0,NULL,NULL,NULL,'360494e1-ccad-4e72-bf80-c564f2cfe18b'),(1950,'HHXM with HIV Positive on ART','High risk population of HHXM with HIV Positive on ART','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM with HIV Positive on ART\n High risk population of HHXM with HIV Positive on ART\n \n 2023-03-29 21:20:51 UTC\n \n 2023-03-29 21:25:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1950\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 23:20:51',4,'2023-03-29 23:25:50',4,0,NULL,NULL,NULL,'ce4eaae7-7985-4e89-ab65-3b0c1686f80e'),(1951,'Miners with HIV Positive on ART','High risk population of Miners with HIV Positive on ART','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Miners with HIV Positive on ART\n High risk population of Miners with HIV Positive on ART\n \n 2023-03-29 21:27:27 UTC\n \n 2023-03-29 21:30:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1951\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 23:27:27',4,'2023-03-29 23:30:27',4,0,NULL,NULL,NULL,'19d13a38-7625-4136-b870-a7facc92ecb3'),(1952,'New and Relapse with HIV Positive on ART','High risk population of New and Relapse with HIV Positive on ART','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n New and Relapse with HIV Positive on ART\n High risk population of New and Relapse with HIV Positive on ART\n \n 2023-03-29 21:33:41 UTC\n \n 2023-03-29 21:36:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1952\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 23:33:41',4,'2023-03-29 23:36:00',4,0,NULL,NULL,NULL,'86db5b09-049a-4be4-a35f-f02f9de644f6'),(1953,'Public transport operators with HIV Positive on ART','High risk population of Public transport operators with HIV Positive on ART','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Public transport operators with HIV Positive on ART\n High risk population of Public transport operators with HIV Positive on ART\n \n 2023-03-29 21:37:07 UTC\n \n 2023-03-29 21:38:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1953\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 23:37:07',4,'2023-03-29 23:38:05',4,0,NULL,NULL,NULL,'ebbb00b2-3779-47b8-8265-c8afea8a5ac1'),(1954,'Retreatment with HIV Positive on ART','High risk population of Retreatment Excl. Relapse HIV Positive on ART','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Retreatment with HIV Positive on ART\n High risk population of Retreatment Excl. Relapse HIV Positive on ART\n \n 2023-03-29 21:39:16 UTC\n \n 2023-03-29 21:40:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1954\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 23:39:16',4,'2023-03-29 23:40:08',4,0,NULL,NULL,NULL,'2ffdb12c-d02b-4e9a-a1dc-6e4974093b5a'),(1955,'Children < 15 with Positive HIV on CPT/Dapzone','Children < 15 with Positive HIV on CPT/Dapzone','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children < 15 with Positive HIV on CPT/Dapzone\n Children < 15 with Positive HIV on CPT/Dapzone\n \n 2023-03-29 21:44:42 UTC\n \n 2023-03-29 21:47:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1955\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 23:44:42',4,'2023-03-29 23:47:53',4,0,NULL,NULL,NULL,'78313782-541c-4568-956c-9fb7bf92c08b'),(1956,'Correctional Staff and inmates with HIV Positive on CPT/Dapzone','High risk population of Correctional Staff and inmates with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Correctional Staff and inmates with HIV Positive on CPT/Dapzone\n High risk population of Correctional Staff and inmates with HIV Positive on CPT/Dapzone\n \n 2023-03-29 21:54:08 UTC\n \n 2023-03-29 21:56:48 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1956\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 23:54:08',4,'2023-03-29 23:56:48',4,0,NULL,NULL,NULL,'46e76f2a-4fc0-40cf-be9d-61565edbe566'),(1957,'Ex Miner with HIV Positive on CPT/Dapzone','High risk population of Ex Miner with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Ex Miner with HIV Positive on CPT/Dapzone\n High risk population of Ex Miner with HIV Positive on CPT/Dapzone\n \n 2023-03-29 21:58:20 UTC\n \n 2023-03-29 21:59:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1957\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-29 23:58:20',4,'2023-03-29 23:59:20',4,0,NULL,NULL,NULL,'348df991-95e1-4724-8df6-e4d905d67b11'),(1958,'Factory Workers with HIV Positive on CPT/Dapzone','High risk population of Factory Workers with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Factory Workers with HIV Positive on CPT/Dapzone\n High risk population of Factory Workers with HIV Positive on CPT/Dapzone\n \n 2023-03-29 22:00:58 UTC\n \n 2023-03-29 22:02:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1958\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-30 00:00:58',4,'2023-03-30 00:02:05',4,0,NULL,NULL,NULL,'5ce50877-ee92-48de-bfa7-a863b735975e'),(1959,'Health workers with HIV Positive on CPT/Dapzone','High risk population of Health workers with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Health workers with HIV Positive on CPT/Dapzone\n High risk population of Health workers with HIV Positive on CPT/Dapzone\n \n 2023-03-29 22:03:33 UTC\n \n 2023-03-29 22:06:16 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1959\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-30 00:03:33',4,'2023-03-30 00:06:16',4,0,NULL,NULL,NULL,'e47447de-6a64-422f-abe3-c281d2b4431c'),(1960,'HHCM with HIV Positive on CPT/Dapzone','High risk population of HHCM with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM with HIV Positive on CPT/Dapzone\n High risk population of HHCM with HIV Positive on CPT/Dapzone\n \n 2023-03-29 22:08:00 UTC\n \n 2023-03-29 22:09:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1960\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-30 00:08:00',4,'2023-03-30 00:09:04',4,0,NULL,NULL,NULL,'02d9a185-dc0e-4852-8176-c4da69705d5d'),(1961,'HHXM with HIV Positive on CPT/Dapzone','High risk population of HHXM with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM with HIV Positive on CPT/Dapzone\n High risk population of HHXM with HIV Positive on CPT/Dapzone\n \n 2023-03-29 22:10:38 UTC\n \n 2023-03-29 22:11:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1961\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-30 00:10:38',4,'2023-03-30 00:11:51',4,0,NULL,NULL,NULL,'c86cc664-d513-4afe-97b9-8163b4bb39d1'),(1962,'Miners with HIV Positive on CPT/Dapzone','High risk population Miners with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Miners with HIV Positive on CPT/Dapzone\n High risk population Miners with HIV Positive on CPT/Dapzone\n \n 2023-03-29 22:13:17 UTC\n \n 2023-03-29 22:15:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1962\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-30 00:13:17',4,'2023-03-30 00:15:15',4,0,NULL,NULL,NULL,'7751e110-9e34-453e-bd9f-792272cbd895'),(1963,'New and Relapse with HIV Positive on CPT/Dapzone','High risk population of New and Relapse with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n New and Relapse with HIV Positive on CPT/Dapzone\n High risk population of New and Relapse with HIV Positive on CPT/Dapzone\n \n 2023-03-29 22:16:42 UTC\n \n 2023-03-29 22:18:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1963\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-30 00:16:42',4,'2023-03-30 00:18:40',4,0,NULL,NULL,NULL,'2ebc8503-89e4-41f4-bdaf-e9e1d041a147'),(1964,'Public transport operators with HIV Positive on CPT/Dapzone','High risk population of Public transport operators with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Public transport operators with HIV Positive on CPT/Dapzone\n High risk population of Public transport operators with HIV Positive on CPT/Dapzone\n \n 2023-03-30 08:39:11 UTC\n \n 2023-03-30 08:40:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1964\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-30 10:39:11',4,'2023-03-30 10:40:29',4,0,NULL,NULL,NULL,'575068b5-f0ca-4d5b-8181-663b5feded65'),(1965,'Retreatment with HIV Positive on CPT/Dapzone','Retreatment Excl. Relapse with HIV Positive on CPT/Dapzone','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Retreatment with HIV Positive on CPT/Dapzone\n Retreatment Excl. Relapse with HIV Positive on CPT/Dapzone\n \n 2023-03-30 08:41:45 UTC\n \n 2023-03-30 08:48:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1965\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-30 10:41:45',4,'2023-03-30 10:48:08',4,0,NULL,NULL,NULL,'22dbd0dd-a4ca-42a5-986e-6c0012eb55b1'),(1966,'HHXM with Documented HIV Status','High risk population of HHXM with Documented HIV Status','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM with Documented HIV Status\n High risk population of HHXM with Documented HIV Status\n \n 2023-03-30 09:03:54 UTC\n \n 2023-03-30 09:06:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1966\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-03-30 11:03:54',4,'2023-03-30 11:06:14',4,0,NULL,NULL,NULL,'e5de47f6-aa7a-4b2d-bd72-83e5458977d6'),(1967,'TB Notification - Block 4','TB Notification - Block 4','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Notification - Block 4\n TB Notification - Block 4\n \n 2023-03-30 09:18:19 UTC\n \n 2023-03-30 20:54:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1967\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-03-30 11:18:19',4,'2023-03-30 22:54:40',4,0,NULL,NULL,NULL,'0b9affca-ad93-42fb-bd49-57380f721a08'),(1968,'TBNotification - Block 4 Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TBNotification - Block 4 Data Set\n \n 2023-03-30 09:18:47 UTC\n \n 2023-03-30 20:50:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1968\n \n \n DM_Sex\n \n \n \n \n \n \n \n \n ARTChild_F\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n \n \n \n ARTChild_M\n \n \n \n \n DM_Sex\n Males\n \n \n \n \n \n ARTCo&In_F\n \n \n \n \n \n \n \n \n \n ARTCo&In_M\n \n \n \n \n \n \n ARTFacW_F\n \n \n \n \n \n \n \n \n \n ARTFacW_M\n \n \n \n \n \n \n ARTHHCM_F\n \n \n \n \n \n \n \n \n \n ARTHHCM_M\n \n \n \n \n \n \n ARTHHXM_F\n \n \n \n \n \n \n \n \n \n ARTHHXM_M\n \n \n \n \n \n \n ARTHeaW_F\n \n \n \n \n \n \n \n \n \n ARTHeaW_M\n \n \n \n \n \n \n ARTMiner_F\n \n \n \n \n \n \n \n \n \n ARTMiner_M\n \n \n \n \n \n \n ARTNw&Rl_F\n \n \n \n \n \n \n \n \n \n ARTNw&Rl_M\n \n \n \n \n \n \n ARTRetr_F\n \n \n \n \n \n \n \n \n \n ARTRetr_M\n \n \n \n \n \n \n ARTTrans_F\n \n \n \n \n \n \n \n \n \n ARTTrans_M\n \n \n \n \n \n \n ARTXMine_F\n \n \n \n \n \n \n \n \n \n ARTXMine_M\n \n \n \n \n \n \n DapChild_F\n \n \n \n \n \n \n \n \n \n DapChild_M\n \n \n \n \n \n \n DapCo&In_F\n \n \n \n \n \n \n \n \n \n DapCo&In_M\n \n \n \n \n \n \n DapFacW_F\n \n \n \n \n \n \n \n \n \n DapFacW_M\n \n \n \n \n \n \n DapHHCM_F\n \n \n \n \n \n \n \n \n \n DapHHCM_M\n \n \n \n \n \n \n DapHHXM_F\n \n \n \n \n \n \n \n \n \n DapHHXM_M\n \n \n \n \n \n \n DapHeaW_F\n \n \n \n \n \n \n \n \n \n DapHeaW_M\n \n \n \n \n \n \n DapMiner_F\n \n \n \n \n \n \n \n \n \n DapMiner_M\n \n \n \n \n \n \n DapNw&Rl_F\n \n \n \n \n \n \n \n \n \n DapNw&Rl_M\n \n \n \n \n \n \n DapRetre_F\n \n \n \n \n \n \n \n \n \n DapRetre_M\n \n \n \n \n \n \n DapTrans_F\n \n \n \n \n \n \n \n \n \n DapTrans_M\n \n \n \n \n \n \n DapXMine_F\n \n \n \n \n \n \n \n \n \n DapXMine_M\n \n \n \n \n \n \n PosChild_F\n \n \n \n \n \n \n \n \n \n PosChild_M\n \n \n \n \n \n \n PosCo&In_F\n \n \n \n \n \n \n \n \n \n PosCo&In_M\n \n \n \n \n \n \n PosFacW_F\n \n \n \n \n \n \n \n \n \n PosFacW_M\n \n \n \n \n \n \n PosHHCM_F\n \n \n \n \n \n \n \n \n \n PosHHCM_M\n \n \n \n \n \n \n PosHHXM_F\n \n \n \n \n \n \n \n \n \n PosHHXM_M\n \n \n \n \n \n \n PosHeaW_F\n \n \n \n \n \n \n \n \n \n PosHeaW_M\n \n \n \n \n \n \n PosMiner_F\n \n \n \n \n \n \n \n \n \n PosMiner_M\n \n \n \n \n \n \n PosNw&Rs_F\n \n \n \n \n \n \n \n \n \n PosNw&Rs_M\n \n \n \n \n \n \n PosRetr_F\n \n \n \n \n \n \n \n \n \n PosRetr_M\n \n \n \n \n \n \n PosTrans_F\n \n \n \n \n \n \n \n \n \n PosTrans_M\n \n \n \n \n \n \n PosXMine_F\n \n \n \n \n \n \n \n \n \n PosXMine_M\n \n \n \n \n \n \n StsChild_F\n \n \n \n \n \n \n \n \n \n StsChild_M\n \n \n \n \n \n \n StsCo&In_F\n \n \n \n \n \n \n \n \n \n StsCo&In_M\n \n \n \n \n \n \n StsFacW_F\n \n \n \n \n \n \n \n \n \n StsFacW_M\n \n \n \n \n \n \n StsHHCM_F\n \n \n \n \n \n \n \n \n \n StsHHCM_M\n \n \n \n \n \n \n StsHHXM_F\n \n \n \n \n \n \n \n \n \n StsHHXM_M\n \n \n \n \n \n \n StsHeaW_F\n \n \n \n \n \n \n \n \n \n StsHeaW_M\n \n \n \n \n \n \n StsMin_F\n \n \n \n \n \n \n \n \n \n StsMin_M\n \n \n \n \n \n \n StsNw&Rs_F\n \n \n \n \n \n \n \n \n \n StsNw&Rs_M\n \n \n \n \n \n \n StsRetre_F\n \n \n \n \n \n \n \n \n \n StsRetre_M\n \n \n \n \n \n \n StsTrans_F\n \n \n \n \n \n \n \n \n \n StsTrans_M\n \n \n \n \n \n \n StsXMin_F\n \n \n \n \n \n \n \n \n \n StsXMin_M\n \n \n \n \n \n \n','2023-03-30 11:18:47',4,'2023-03-30 22:50:08',4,0,NULL,NULL,NULL,'e08d273c-ba6d-4085-bf72-b7f6737396bf'),(1969,'TB_OUTCOMES','TB Outcomes','org.openmrs.module.reporting.indicator.dimension.Dimension','org.openmrs.module.reporting.indicator.dimension.CohortDefinitionDimension','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB_OUTCOMES\n TB Outcomes\n \n 2023-03-30 13:48:45 UTC\n \n 2023-03-30 14:06:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1969\n \n \n Competed\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-03-30 15:48:45',4,'2023-03-30 16:06:44',4,0,NULL,NULL,NULL,'2244b6f7-5dd0-4c8a-8a9e-67bac3fe7d9b'),(1970,'test','test','org.openmrs.module.reporting.indicator.dimension.Dimension','org.openmrs.module.reporting.indicator.dimension.CohortDefinitionDimension','org.openmrs.module.reporting.serializer.ReportingSerializer','\n test\n test\n \n 2023-03-30 14:06:01 UTC\n \n \n','2023-03-30 16:06:01',4,NULL,NULL,0,NULL,NULL,NULL,'a572d104-f644-42bb-ae58-7c83ac0747ad'),(1971,'TB New and Relapse Completed','TB New and Relapse Completed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB New and Relapse Completed\n TB New and Relapse Completed\n \n 2023-03-30 14:58:43 UTC\n \n 2023-03-30 14:59:47 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1971\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- TB History of previous treatment \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3785 and o.value_coded in (1034,1084) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 2242 and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 16:58:43',4,'2023-03-30 16:59:47',4,0,NULL,NULL,NULL,'1540870d-551a-4e11-baad-70ed9b13289a'),(1972,'TB New and Relapse Cured','TB New and Relapse Cured','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB New and Relapse Cured\n TB New and Relapse Cured\n \n 2023-03-30 15:04:42 UTC\n \n 2023-03-30 15:06:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1972\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- TB History of previous treatment(New AND Relapse) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3785 and o.value_coded in (1034,1084) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 1068 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 17:04:42',4,'2023-03-30 17:06:17',4,0,NULL,NULL,NULL,'22e1906b-16cd-4109-b529-a043e43ff3d4'),(1973,'TB New and Relapse Died','TB New and Relapse Died','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB New and Relapse Died\n TB New and Relapse Died\n \n 2023-03-30 15:08:32 UTC\n \n 2023-03-30 15:09:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1973\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- TB History of previous treatment(New AND Relapse) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3785 and o.value_coded in (1034,1084) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3650 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 17:08:32',4,'2023-03-30 17:09:15',4,0,NULL,NULL,NULL,'19636929-afd0-4ba0-acfa-bbe325e1f002'),(1974,'TB New and Relapse Lost to Follow-up','TB New and Relapse Lost to Follow-up','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB New and Relapse Lost to Follow-up\n TB New and Relapse Lost to Follow-up\n \n 2023-03-30 15:10:23 UTC\n \n 2023-03-30 15:10:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1974\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- TB History of previous treatment(New AND Relapse) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3785 and o.value_coded in (1034,1084) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 2302 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 17:10:23',4,'2023-03-30 17:10:58',4,0,NULL,NULL,NULL,'87260731-779f-4244-9480-f75169dd2fbf'),(1975,'TB New and Relapse Failed (Susceptible)','TB New and Relapse Failed (Susceptible)','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB New and Relapse Failed (Susceptible)\n TB New and Relapse Failed (Susceptible)\n \n 2023-03-30 15:11:55 UTC\n \n 2023-03-30 15:31:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1975\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- TB History of previous treatment(New AND Relapse) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3785 and o.value_coded in (1034,1084) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3793 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 17:11:55',4,'2023-03-30 17:31:39',4,0,NULL,NULL,NULL,'53aec520-fab0-4871-b46f-209c32b921c1'),(1976,'TB New and Relapse Not Evaluated','TB New and Relapse Not Evaluated','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB New and Relapse Not Evaluated\n TB New and Relapse Not Evaluated\n \n 2023-03-30 15:13:29 UTC\n \n 2023-03-30 16:05:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1976\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- TB History of previous treatment(New AND Relapse) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3785 and o.value_coded in (1034,1084) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id not in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded in (1068,2242,3650,2302,3793,3794) \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 17:13:29',4,'2023-03-30 18:05:12',4,0,NULL,NULL,NULL,'0af163fd-0d3c-4b6a-a84e-1648cd9bb042'),(1977,'exMiner_cured','Ex miner cured','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n exMiner_cured\n Ex miner cured\n \n 2023-03-30 15:21:40 UTC\n \n 2023-03-30 15:47:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1977\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3668 \n and ob.voided = 0 \n ) \n and o.person_id in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded = 1068 \n and b.voided = 0 \n ) \n\n','2023-03-30 17:21:40',4,'2023-03-30 17:47:23',4,0,NULL,NULL,NULL,'4c2c88ec-ee4e-4bad-962d-229983982f12'),(1978,'exMiner_completed','Ex miner completed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n exMiner_completed\n Ex miner completed\n \n 2023-03-30 15:24:54 UTC\n \n 2023-03-30 15:45:56 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1978\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3668 \n and ob.voided = 0 \n ) \n and o.person_id in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded = 2242 \n and b.voided = 0 \n ) \n\n','2023-03-30 17:24:54',4,'2023-03-30 17:45:56',4,0,NULL,NULL,NULL,'37afe774-0ef1-4152-8ab9-fe702f175f36'),(1979,'exMiner_died','Ex Miner died','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n exMiner_died\n Ex Miner died\n \n 2023-03-30 15:28:17 UTC\n \n 2023-04-03 07:35:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1979\n select distinct o.person_id \n \n \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3668 \n and ob.voided = 0 \n ) \n and o.person_id in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded = 3650 and b.voided = 0 \n ) \n\n','2023-03-30 17:28:17',4,'2023-04-03 09:35:05',4,0,NULL,NULL,NULL,'d08b3fb0-d1c2-455d-89a6-f3c9a1469a3e'),(1980,'TB New and Relapse Completed Moved to second line treatment','TB New and Relapse Completed Moved to second line treatment','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB New and Relapse Completed Moved to second line treatment\n TB New and Relapse Completed Moved to second line treatment\n \n 2023-03-30 15:33:00 UTC\n \n 2023-03-30 15:33:47 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1980\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- TB History of previous treatment(New AND Relapse) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3785 and o.value_coded in (1034,1084) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3794 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 17:33:00',4,'2023-03-30 17:33:47',4,0,NULL,NULL,NULL,'d2ff18e1-1cf3-4bff-9796-e35aaf019b40'),(1981,'exMiner_failedSusceptive','Ex miner failed suceptive','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n exMiner_failedSusceptive\n Ex miner failed suceptive\n \n 2023-03-30 15:40:13 UTC\n \n 2023-04-03 10:56:48 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1981\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3668 \n and ob.voided = 0 \n ) \n and o.person_id in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded = 3793 \n and b.voided = 0 \n ) \n\n','2023-03-30 17:40:13',4,'2023-04-03 12:56:48',4,0,NULL,NULL,NULL,'8c7c6720-c1aa-492a-be1b-47edc57cfd55'),(1982,'exMiner_lost','Ex miner lost','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n exMiner_lost\n Ex miner lost\n \n 2023-03-30 15:42:32 UTC\n \n 2023-03-30 15:49:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1982\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3668 \n and ob.voided = 0 \n ) \n and o.person_id in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded = 2302 \n and b.voided = 0 \n ) \n\n','2023-03-30 17:42:32',4,'2023-03-30 17:49:29',4,0,NULL,NULL,NULL,'cb57dd5b-22ae-42d9-a86a-6927e9aae9cb'),(1983,'TB Retreatment excluding Relapse and Completed','TB Retreatment excluding Relapse and Completed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Retreatment excluding Relapse and Completed\n TB Retreatment excluding Relapse and Completed\n \n 2023-03-30 15:43:38 UTC\n \n 2023-03-30 15:44:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1983\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- TB History of previous treatment(Retreatment Excluding Relapse) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3785 and o.value_coded in (3786,1037) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 2242 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 17:43:38',4,'2023-03-30 17:44:32',4,0,NULL,NULL,NULL,'93eefc43-0eba-4a27-8d7e-72958dc0b2f1'),(1984,'exMiner_movedSecondLIne','Ex miner moved to second line','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n exMiner_movedSecondLIne\n Ex miner moved to second line\n \n 2023-03-30 15:44:13 UTC\n \n 2023-03-30 15:44:34 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1984\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3668 \n and ob.voided = 0 \n ) \n and o.person_id in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded = 3794 \n and b.voided = 0 \n ) \n\n','2023-03-30 17:44:13',4,'2023-03-30 17:44:34',4,0,NULL,NULL,NULL,'846e0252-747b-4457-b0f4-6f23ed244706'),(1985,'TB Retreatment excluding Relapse and Cured','TB Retreatment excluding Relapse and Cured','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Retreatment excluding Relapse and Cured\n TB Retreatment excluding Relapse and Cured\n \n 2023-03-30 15:45:00 UTC\n \n 2023-03-30 15:45:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1985\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- TB History of previous treatment(Retreatment Excluding Relapse) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3785 and o.value_coded in (3786,1037) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 1068 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 17:45:00',4,'2023-03-30 17:45:29',4,0,NULL,NULL,NULL,'1cd8596a-21ba-4a7b-b3c6-c82fb756bf8f'),(1986,'TB Retreatment excluding Relapse and Died','TB Retreatment excluding Relapse and Died','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Retreatment excluding Relapse and Died\n TB Retreatment excluding Relapse and Died\n \n 2023-03-30 15:45:57 UTC\n \n 2023-03-30 15:46:22 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1986\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- TB History of previous treatment(Retreatment Excluding Relapse) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3785 and o.value_coded in (3786,1037) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3650 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 17:45:57',4,'2023-03-30 17:46:22',4,0,NULL,NULL,NULL,'50001a13-545a-4de2-9617-86c8b262eb9d'),(1987,'TB Retreatment excluding Relapse and Lost to Follow up','TB Retreatment excluding Relapse and Lost to Follow up','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Retreatment excluding Relapse and Lost to Follow up\n TB Retreatment excluding Relapse and Lost to Follow up\n \n 2023-03-30 15:47:18 UTC\n \n 2023-03-30 15:47:57 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1987\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- TB History of previous treatment(Retreatment Excluding Relapse) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3785 and o.value_coded in (3786,1037) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 2302 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 17:47:18',4,'2023-03-30 17:47:57',4,0,NULL,NULL,NULL,'46fbbe80-0f0e-4cf5-8f4d-04444b70d3bc'),(1988,'TB Retreatment excluding Relapse and Failed (Susceptible)','TB Retreatment excluding Relapse and Failed (Susceptible)','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Retreatment excluding Relapse and Failed (Susceptible)\n TB Retreatment excluding Relapse and Failed (Susceptible)\n \n 2023-03-30 15:49:14 UTC\n \n 2023-03-30 15:49:46 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1988\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- TB History of previous treatment(Retreatment Excluding Relapse) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3785 and o.value_coded in (3786,1037) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3793 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 17:49:14',4,'2023-03-30 17:49:46',4,0,NULL,NULL,NULL,'0b97c9a2-f4f0-460c-9a6a-943f0d0b9bac'),(1989,'TB Retreatment excluding Relapse and Not Evaluated','TB Retreatment excluding Relapse and Not Evaluated','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Retreatment excluding Relapse and Not Evaluated\n TB Retreatment excluding Relapse and Not Evaluated\n \n 2023-03-30 15:51:27 UTC\n \n 2023-03-30 16:03:56 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1989\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- TB History of previous treatment(Retreatment Excluding Relapse) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3785 and o.value_coded in (3786,1037) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id not in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded in (1068,2242,3650,2302,3793,3794) \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 17:51:27',4,'2023-03-30 18:03:56',4,0,NULL,NULL,NULL,'36e8a6f3-f70c-4d36-ab76-87fba12b426b'),(1990,'exMiner_notEvaluated','Ex miner not evaluated','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n exMiner_notEvaluated\n Ex miner not evaluated\n \n 2023-03-30 15:53:42 UTC\n \n 2023-03-30 16:13:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1990\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3668 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2302,1068,2242,3650,3793,3794) \n and b.voided = 0 \n ) \n\n','2023-03-30 17:53:42',4,'2023-03-30 18:13:01',4,0,NULL,NULL,NULL,'af666d60-a3d1-4f0f-8ac2-1ea8fddbf8cd'),(1991,'FactoryWorker_notEvaluated','Factory worker not evaluated ','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n FactoryWorker_notEvaluated\n Factory worker not evaluated \n \n 2023-03-30 16:17:17 UTC\n \n 2023-03-30 16:18:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1991\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3669 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2302,1068,2242,3650,3793,3794) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:17:17',4,'2023-03-30 18:18:05',4,0,NULL,NULL,NULL,'83566c8a-550c-447e-9745-0df04c89de07'),(1992,'FactoryWorker_curred','Factory worker curred','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n FactoryWorker_curred\n Factory worker curred\n \n 2023-03-30 16:18:46 UTC\n \n 2023-03-30 16:19:13 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1992\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3669 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (1068) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:18:46',4,'2023-03-30 18:19:13',4,0,NULL,NULL,NULL,'40dd9f46-8d30-4426-bffd-0eb772046374'),(1993,'All TB HIV Pos and Completed ','All TB HIV Pos and Completed ','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Pos and Completed \n All TB HIV Pos and Completed \n \n 2023-03-30 16:19:51 UTC\n \n 2023-03-30 16:20:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1993\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All HIV Positives \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 4666 and o.value_coded in (4323,4664) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 2242 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:19:51',4,'2023-03-30 18:20:08',4,0,NULL,NULL,NULL,'6b7c8fdf-00e6-4f52-b0fe-fab2cd9cc15e'),(1994,'FactoryWorker_completed','Factory worker copleted','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n FactoryWorker_completed\n Factory worker copleted\n \n 2023-03-30 16:19:51 UTC\n \n 2023-03-30 16:20:13 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1994\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3669 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2242) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:19:51',4,'2023-03-30 18:20:13',4,0,NULL,NULL,NULL,'4fb972d7-5378-4413-8faf-e9dfc9454cd6'),(1995,'All TB HIV Pos and Cured','All TB HIV Pos and Cured','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Pos and Cured\n All TB HIV Pos and Cured\n \n 2023-03-30 16:20:26 UTC\n \n 2023-03-30 16:20:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1995\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All HIV Positives \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 4666 and o.value_coded in (4323,4664) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 1068 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:20:26',4,'2023-03-30 18:20:55',4,0,NULL,NULL,NULL,'5bd61f52-4224-4de9-82cd-2c6334f665b1'),(1996,'FactoryWorker_died','Factory worker died','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n FactoryWorker_died\n Factory worker died\n \n 2023-03-30 16:21:09 UTC\n \n 2023-03-30 16:21:24 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1996\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3669 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3650) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:21:09',4,'2023-03-30 18:21:24',4,0,NULL,NULL,NULL,'f4cf99eb-4bb4-45c0-a403-086fd4b51c44'),(1997,'All TB HIV Pos and Died','All TB HIV Pos and Died','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Pos and Died\n All TB HIV Pos and Died\n \n 2023-03-30 16:21:20 UTC\n \n 2023-03-30 16:21:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1997\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All HIV Positives \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 4666 and o.value_coded in (4323,4664) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3650 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:21:20',4,'2023-03-30 18:21:50',4,0,NULL,NULL,NULL,'b41362c1-57e7-48a0-99ed-a6241cd9fb3d'),(1998,'FactoryWorker_lost','Factort worker lost to follow up','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n FactoryWorker_lost\n Factort worker lost to follow up\n \n 2023-03-30 16:22:18 UTC\n \n 2023-03-30 16:22:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1998\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3669 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2302) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:22:18',4,'2023-03-30 18:22:39',4,0,NULL,NULL,NULL,'f915f74e-1e06-4639-9070-6d1fa301b432'),(1999,'All TB HIV Pos and Lost to Follow up','All TB HIV Pos and Lost to Follow up','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Pos and Lost to Follow up\n All TB HIV Pos and Lost to Follow up\n \n 2023-03-30 16:22:31 UTC\n \n 2023-03-30 16:22:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 1999\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All HIV Positives \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 4666 and o.value_coded in (4323,4664) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 2302 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:22:31',4,'2023-03-30 18:22:58',4,0,NULL,NULL,NULL,'16efd94d-da75-4a5c-8ca9-6364f2fc8396'),(2000,'All TB HIV Pos and Failed (Susceptible)','All TB HIV Pos and Failed (Susceptible)','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Pos and Failed (Susceptible)\n All TB HIV Pos and Failed (Susceptible)\n \n 2023-03-30 16:23:33 UTC\n \n 2023-03-30 16:24:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2000\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All HIV Positives \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 4666 and o.value_coded in (4323,4664) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3793 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:23:33',4,'2023-03-30 18:24:00',4,0,NULL,NULL,NULL,'4dc42500-c285-4548-92ff-842d1b357342'),(2001,'prison_worker_lost','Prison worker lost','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n prison_worker_lost\n Prison worker lost\n \n 2023-03-30 16:24:03 UTC\n \n 2023-03-30 16:24:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2001\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3779 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2302) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:24:03',4,'2023-03-30 18:24:36',4,0,NULL,NULL,NULL,'624478ae-cc98-4b93-b138-4e619755b41a'),(2002,'All TB HIV Pos and Not Evaluated','All TB HIV Pos and Not Evaluated','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Pos and Not Evaluated\n All TB HIV Pos and Not Evaluated\n \n 2023-03-30 16:24:48 UTC\n \n 2023-03-30 16:26:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2002\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All HIV Positives \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 4666 and o.value_coded in (4323,4664) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id not in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded in (1068,2242,3650,2302,3793,3794) \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:24:48',4,'2023-03-30 18:26:26',4,0,NULL,NULL,NULL,'4fe00951-413a-468e-ac7e-016dcf41bed6'),(2003,'FactoryWorker_moved','Facotory worker moved to second line','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n FactoryWorker_moved\n Facotory worker moved to second line\n \n 2023-03-30 16:26:31 UTC\n \n 2023-03-30 16:34:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2003\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3669 \n and ob.voided = 0 \n ) \n and o.person_id in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3794) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:26:31',4,'2023-03-30 18:34:39',4,0,NULL,NULL,NULL,'1a7a972b-4113-414d-8810-46c8df8137e7'),(2004,'All TB HIV Pos and Moved to Secondline','All TB HIV Pos and Moved to Secondline','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Pos and Moved to Secondline\n All TB HIV Pos and Moved to Secondline\n \n 2023-03-30 16:27:16 UTC\n \n 2023-03-30 16:27:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2004\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All HIV Positives \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 4666 and o.value_coded in (4323,4664) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3794 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:27:16',4,'2023-03-30 18:27:43',4,0,NULL,NULL,NULL,'57ddf49d-b53d-48ce-a67d-3ce6398f3e2c'),(2005,'All TB HIV Neg and Completed','All TB HIV Neg and Completed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Neg and Completed\n All TB HIV Neg and Completed\n \n 2023-03-30 16:29:02 UTC\n \n 2023-03-30 16:30:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2005\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All HIV Negatives \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 4666 and o.value_coded in (4324,4665) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 2242 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:29:02',4,'2023-03-30 18:30:27',4,0,NULL,NULL,NULL,'63a92814-2f34-4018-b7d0-47659892369d'),(2006,'All TB HIV Neg and Cured','All TB HIV Neg and Cured','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Neg and Cured\n All TB HIV Neg and Cured\n \n 2023-03-30 16:30:51 UTC\n \n 2023-03-30 16:31:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2006\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All HIV Negatives \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 4666 and o.value_coded in (4324,4665) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 1068 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:30:51',4,'2023-03-30 18:31:17',4,0,NULL,NULL,NULL,'8e552272-4654-43bb-b1af-20affab2de14'),(2007,'All TB HIV Neg and Died','All TB HIV Neg and Died','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Neg and Died\n All TB HIV Neg and Died\n \n 2023-03-30 16:31:44 UTC\n \n 2023-03-30 16:32:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2007\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All HIV Negatives \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 4666 and o.value_coded in (4324,4665) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3650 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:31:44',4,'2023-03-30 18:32:11',4,0,NULL,NULL,NULL,'3463adc8-19aa-4cc0-9daf-32ea09e0c1f0'),(2008,'All TB HIV Neg and Lost to Follow up','All TB HIV Neg and Lost to Follow up','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Neg and Lost to Follow up\n All TB HIV Neg and Lost to Follow up\n \n 2023-03-30 16:32:59 UTC\n \n 2023-03-30 16:33:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2008\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All HIV Negatives \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 4666 and o.value_coded in (4324,4665) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 2302 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:32:59',4,'2023-03-30 18:33:27',4,0,NULL,NULL,NULL,'06a5ff53-1949-444e-80b5-f4c99b38d5b1'),(2009,'All TB HIV Neg and Failed (Susceptible)','All TB HIV Neg and Failed (Susceptible)','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Neg and Failed (Susceptible)\n All TB HIV Neg and Failed (Susceptible)\n \n 2023-03-30 16:34:17 UTC\n \n 2023-03-30 16:35:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2009\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All HIV Negatives \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 4666 and o.value_coded in (4324,4665) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3793 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:34:17',4,'2023-03-30 18:35:01',4,0,NULL,NULL,NULL,'2ac7e18e-061b-4b34-bb63-63a2ec622a2b'),(2010,'All TB HIV Neg and Not Evaluated','All TB HIV Neg and Not Evaluated','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Neg and Not Evaluated\n All TB HIV Neg and Not Evaluated\n \n 2023-03-30 16:35:36 UTC\n \n 2023-03-30 16:37:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2010\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All HIV Negatives \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 4666 and o.value_coded in (4324,4665) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id not in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded in (1068,2242,3650,2302,3793,3794) \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:35:36',4,'2023-03-30 18:37:02',4,0,NULL,NULL,NULL,'c78c5a10-a320-43ce-b943-f9286e22ad1e'),(2011,'prison_worker_moved','Prison worker moved to second line','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n prison_worker_moved\n Prison worker moved to second line\n \n 2023-03-30 16:35:49 UTC\n \n 2023-03-30 16:36:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2011\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3779 \n and ob.voided = 0 \n ) \n and o.person_id in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3794) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:35:49',4,'2023-03-30 18:36:29',4,0,NULL,NULL,NULL,'76d5be40-a7e3-4f4f-968a-0346d0bd6513'),(2012,'prison_worker_died','Prison worker died','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n prison_worker_died\n Prison worker died\n \n 2023-03-30 16:37:07 UTC\n \n 2023-03-30 16:37:38 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2012\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3776 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3650) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:37:07',4,'2023-03-30 18:37:38',4,0,NULL,NULL,NULL,'c9a54e7c-34d1-4a1b-9214-0b9fa6eb6976'),(2013,'All TB HIV Neg and Moved to Secondline Treatment','All TB HIV Neg and Moved to Secondline Treatment','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Neg and Moved to Secondline Treatment\n All TB HIV Neg and Moved to Secondline Treatment\n \n 2023-03-30 16:37:41 UTC\n \n 2023-03-30 16:38:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2013\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All HIV Negatives \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 4666 and o.value_coded in (4324,4665) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3794 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:37:41',4,'2023-03-30 18:38:53',4,0,NULL,NULL,NULL,'2de9ce1c-6a79-43fe-ab19-1b9c9d2865d4'),(2014,'prison_worker_completed','Prison worker completed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n prison_worker_completed\n Prison worker completed\n \n 2023-03-30 16:38:29 UTC\n \n 2023-03-30 16:38:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2014\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3776 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2242) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:38:29',4,'2023-03-30 18:38:53',4,0,NULL,NULL,NULL,'9e174142-2794-43fc-95dd-9f3f92e4b379'),(2015,'prison_worker_curred','Prion worker curred','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n prison_worker_curred\n Prion worker curred\n \n 2023-03-30 16:40:22 UTC\n \n 2023-03-30 16:43:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2015\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3776 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (1068) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:40:22',4,'2023-03-30 18:43:23',4,0,NULL,NULL,NULL,'91f85b53-7dca-4730-a391-5198293d1cf9'),(2016,'All Childred and Completed','All Childred and Completed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All Childred and Completed\n All Childred and Completed\n \n 2023-03-30 16:43:19 UTC\n \n 2023-03-30 16:46:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2016\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All Children \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) < 15 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 2242 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:43:19',4,'2023-03-30 18:46:26',4,0,NULL,NULL,NULL,'f300ef4e-70b5-4c81-b993-7d45d23f299e'),(2017,'prison_worker_notEvaluated','Prison worker not evaluated','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n prison_worker_notEvaluated\n Prison worker not evaluated\n \n 2023-03-30 16:46:21 UTC\n \n 2023-03-30 16:46:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2017\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3776 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2302,1068,2242,3650,3793,3794) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:46:21',4,'2023-03-30 18:46:41',4,0,NULL,NULL,NULL,'1c0c7eab-e438-4787-982a-bfb448fe7455'),(2018,'All Childred and Cured','All Childred and Cured','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All Childred and Cured\n All Childred and Cured\n \n 2023-03-30 16:46:51 UTC\n \n 2023-03-30 16:47:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2018\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All Children \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) < 15 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 1068 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:46:51',4,'2023-03-30 18:47:08',4,0,NULL,NULL,NULL,'1f8f36b9-85d6-4e32-b078-6c7e098974b1'),(2019,'All Childred and Died','All Childred and Died','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All Childred and Died\n All Childred and Died\n \n 2023-03-30 16:47:31 UTC\n \n 2023-03-30 16:48:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2019\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All Children \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) < 15 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3650 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:47:31',4,'2023-03-30 18:48:00',4,0,NULL,NULL,NULL,'dd4822a7-86eb-4579-acda-bf0ff242eef5'),(2020,'health_worker_notEvaluated','Health worker not evaluated','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n health_worker_notEvaluated\n Health worker not evaluated\n \n 2023-03-30 16:47:35 UTC\n \n 2023-03-30 16:48:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2020\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3667 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2302,1068,2242,3650,3793,3794) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:47:35',4,'2023-03-30 18:48:03',4,0,NULL,NULL,NULL,'5d8bdedf-fc1e-46f8-b417-908519f3e645'),(2021,'All Childred and Lost to Follow up','All Childred and Lost to Follow up','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All Childred and Lost to Follow up\n All Childred and Lost to Follow up\n \n 2023-03-30 16:48:38 UTC\n \n 2023-03-30 16:49:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2021\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All Children \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) < 15 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 2302 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:48:38',4,'2023-03-30 18:49:04',4,0,NULL,NULL,NULL,'2665ef1b-edbd-4c9d-b9f6-3d2d2cc3b0ad'),(2022,'health_worker_curred','Health worker curred','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n health_worker_curred\n Health worker curred\n \n 2023-03-30 16:48:53 UTC\n \n 2023-03-30 16:49:19 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2022\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3667 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (1068) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:48:53',4,'2023-03-30 18:49:19',4,0,NULL,NULL,NULL,'63064b04-2cce-4944-b53d-ddb2cdce8a2d'),(2023,'All Childred and Failed (Susceptible)','All Childred and Failed (Susceptible)','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All Childred and Failed (Susceptible)\n All Childred and Failed (Susceptible)\n \n 2023-03-30 16:49:34 UTC\n \n 2023-03-30 16:50:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2023\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All Children \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) < 15 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3793 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:49:34',4,'2023-03-30 18:50:01',4,0,NULL,NULL,NULL,'1b710ad4-75b5-4b64-b916-1806dca0013d'),(2024,'health_worker_completed','Health worker completed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n health_worker_completed\n Health worker completed\n \n 2023-03-30 16:49:56 UTC\n \n 2023-04-03 20:37:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2024\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3667 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2242) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:49:56',4,'2023-04-03 22:37:45',4,0,NULL,NULL,NULL,'6555808c-1103-4a6d-b13f-fd0fad7ff09f'),(2025,'All Childred and Not evaluated','All Childred and Not evaluated','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All Childred and Not evaluated\n All Childred and Not evaluated\n \n 2023-03-30 16:50:30 UTC\n \n 2023-03-30 16:51:54 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2025\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All Children \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) < 15 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id not in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded in (1068,2242,3650,2302,3794,3793) \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:50:30',4,'2023-03-30 18:51:54',4,0,NULL,NULL,NULL,'1b9b16cf-f254-43b5-b952-4d54f431ae49'),(2026,'health_worker_died','Healh worker died','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n health_worker_died\n Healh worker died\n \n 2023-03-30 16:50:46 UTC\n \n 2023-03-30 16:51:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2026\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3667 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3650) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:50:46',4,'2023-03-30 18:51:00',4,0,NULL,NULL,NULL,'e9c9f85f-123c-4b2f-9951-7b8c2be340af'),(2027,'health_worker_lost','Health worker lost','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n health_worker_lost\n Health worker lost\n \n 2023-03-30 16:51:39 UTC\n \n 2023-03-30 16:51:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2027\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3667 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2302) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:51:39',4,'2023-03-30 18:51:55',4,0,NULL,NULL,NULL,'8b70ced1-8219-4206-b7ec-10c0242808c4'),(2028,'All Childred and Moved to Secondline Treatment','All Childred and Moved to Secondline Treatment','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All Childred and Moved to Secondline Treatment\n All Childred and Moved to Secondline Treatment\n \n 2023-03-30 16:52:27 UTC\n \n 2023-03-30 16:53:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2028\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All Children \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) < 15 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3794 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:52:27',4,'2023-03-30 18:53:11',4,0,NULL,NULL,NULL,'143c95e1-ae28-460c-92c2-3807e30dc704'),(2029,'health_worker_moved','Health worker moved to second line','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n health_worker_moved\n Health worker moved to second line\n \n 2023-03-30 16:52:49 UTC\n \n 2023-03-30 16:55:13 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2029\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3667 \n and ob.voided = 0 \n ) \n and o.person_id in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3794) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:52:49',4,'2023-03-30 18:55:13',4,0,NULL,NULL,NULL,'3a04d202-b320-463e-a233-40887022bfea'),(2030,'All TB Adolescent (10-19 yrs) and Completed ','All TB Adolescent (10-19 yrs) and Completed ','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Adolescent (10-19 yrs) and Completed \n All TB Adolescent (10-19 yrs) and Completed \n \n 2023-03-30 16:55:50 UTC\n \n 2023-03-30 16:56:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2030\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All Adolescent (10-19 yrs) \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) < 20 \n and floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) > 9 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 2242 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:55:50',4,'2023-03-30 18:56:27',4,0,NULL,NULL,NULL,'788061f8-b372-4d67-b493-c20b96b948bf'),(2031,'public_transport_Moved','Public Transport move to second line','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n public_transport_Moved\n Public Transport move to second line\n \n 2023-03-30 16:55:50 UTC\n \n 2023-03-30 16:56:22 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2031\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 4654 \n and ob.voided = 0 \n ) \n and o.person_id in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3794) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:55:50',4,'2023-03-30 18:56:22',4,0,NULL,NULL,NULL,'c2e7a54e-80e6-4535-a09f-32d93e8ce902'),(2032,'All TB Adolescent (10-19 yrs) and cured','All TB Adolescent (10-19 yrs) and cured','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Adolescent (10-19 yrs) and cured\n All TB Adolescent (10-19 yrs) and cured\n \n 2023-03-30 16:56:54 UTC\n \n 2023-03-30 16:57:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2032\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All Adolescent (10-19 yrs) \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) < 20 \n and floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) > 9 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 1068 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:56:54',4,'2023-03-30 18:57:31',4,0,NULL,NULL,NULL,'e620cd1b-bbe2-4c3d-93bb-fcbdc8b34d84'),(2033,'public_transport_lost','Public transport Lost','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n public_transport_lost\n Public transport Lost\n \n 2023-03-30 16:57:13 UTC\n \n 2023-03-30 16:57:37 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2033\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 4654 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2302) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:57:13',4,'2023-03-30 18:57:37',4,0,NULL,NULL,NULL,'0cc2e2d8-4cab-45c7-9b04-67c8bfd1bbfa'),(2034,'All TB Adolescent (10-19 yrs) and Died','All TB Adolescent (10-19 yrs) and Died','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Adolescent (10-19 yrs) and Died\n All TB Adolescent (10-19 yrs) and Died\n \n 2023-03-30 16:57:52 UTC\n \n 2023-03-30 16:58:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2034\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All Adolescent (10-19 yrs) \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) < 20 \n and floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) > 9 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3650 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:57:52',4,'2023-03-30 18:58:21',4,0,NULL,NULL,NULL,'53ef1628-fe11-4b21-bab5-897e27196e04'),(2035,'public_transport_died','Public transport died','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n public_transport_died\n Public transport died\n \n 2023-03-30 16:58:17 UTC\n \n 2023-03-30 16:58:34 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2035\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 4654 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3650) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:58:17',4,'2023-03-30 18:58:34',4,0,NULL,NULL,NULL,'bbc25dd6-f8ff-4c55-84e8-efd76d0ac281'),(2036,'All TB Adolescent (10-19 yrs) and Lost to Follow up','All TB Adolescent (10-19 yrs) and Lost to Follow up','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Adolescent (10-19 yrs) and Lost to Follow up\n All TB Adolescent (10-19 yrs) and Lost to Follow up\n \n 2023-03-30 16:58:49 UTC\n \n 2023-03-30 16:59:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2036\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All Adolescent (10-19 yrs) \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) < 20 \n and floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) > 9 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 2302 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:58:49',4,'2023-03-30 18:59:12',4,0,NULL,NULL,NULL,'509944d6-5988-405c-8aee-8a9329e1e141'),(2037,'public_transport_completed','Public transport completed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n public_transport_completed\n Public transport completed\n \n 2023-03-30 16:59:27 UTC\n \n 2023-03-30 17:00:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2037\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 4654 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2242) \n and b.voided = 0 \n ) \n\n','2023-03-30 18:59:27',4,'2023-03-30 19:00:28',4,0,NULL,NULL,NULL,'d9a7884a-eabd-43cc-9757-64ae74a3cb9c'),(2038,'All TB Adolescent (10-19 yrs) and Failed (Susceptible)','All TB Adolescent (10-19 yrs) and Failed (Susceptible)','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Adolescent (10-19 yrs) and Failed (Susceptible)\n All TB Adolescent (10-19 yrs) and Failed (Susceptible)\n \n 2023-03-30 16:59:52 UTC\n \n 2023-03-30 17:00:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2038\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All Adolescent (10-19 yrs) \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) < 20 \n and floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) > 9 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3793 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 18:59:52',4,'2023-03-30 19:00:27',4,0,NULL,NULL,NULL,'dd3ac915-529a-44c4-b086-fe9e21bc7553'),(2039,'All TB Adolescent (10-19 yrs) and Moved to Secondline treatment','All TB Adolescent (10-19 yrs) and Moved to Secondline treatment','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Adolescent (10-19 yrs) and Moved to Secondline treatment\n All TB Adolescent (10-19 yrs) and Moved to Secondline treatment\n \n 2023-03-30 17:01:19 UTC\n \n 2023-03-30 17:01:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2039\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All Adolescent (10-19 yrs) \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) < 20 \n and floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) > 9 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3794 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 19:01:19',4,'2023-03-30 19:01:41',4,0,NULL,NULL,NULL,'216e1e3c-eed7-4802-96bb-fe3256161a08'),(2040,'public_transport_curred','Public transport curred','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n public_transport_curred\n Public transport curred\n \n 2023-03-30 17:01:20 UTC\n \n 2023-03-30 17:01:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2040\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 4654 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (1068) \n and b.voided = 0 \n ) \n\n','2023-03-30 19:01:20',4,'2023-03-30 19:01:41',4,0,NULL,NULL,NULL,'faf660cd-1ef3-48a9-86d5-805f14b23465'),(2041,'All TB Adolescent (10-19 yrs) and Not Evaluated','All TB Adolescent (10-19 yrs) and Not Evaluated','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Adolescent (10-19 yrs) and Not Evaluated\n All TB Adolescent (10-19 yrs) and Not Evaluated\n \n 2023-03-30 17:02:10 UTC\n \n 2023-03-30 17:03:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2041\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- All Adolescent (10-19 yrs) \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) < 20 \n and floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) > 9 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id not in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded in (1068,2242,3650,2302,3794,3793) \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 19:02:10',4,'2023-03-30 19:03:44',4,0,NULL,NULL,NULL,'8fcd3cec-a879-4240-888f-42575228b47d'); INSERT INTO `serialized_object` VALUES (2042,'public_transport_notEvaluated','Public transport note evaluated','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n public_transport_notEvaluated\n Public transport note evaluated\n \n 2023-03-30 17:02:53 UTC\n \n 2023-03-30 17:03:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2042\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 4654 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2302,1068,2242,3650,3793,3794) \n and b.voided = 0 \n ) \n\n','2023-03-30 19:02:53',4,'2023-03-30 19:03:45',4,0,NULL,NULL,NULL,'7037beac-7eba-4b7f-a3b7-6636d1d435bd'),(2043,'TB Females and Completed','TB Females and Completed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Females and Completed\n TB Females and Completed\n \n 2023-03-30 17:07:55 UTC\n \n 2023-03-30 17:08:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2043\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- Female \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where person.gender = 'F' \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 2242 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 19:07:55',4,'2023-03-30 19:08:14',4,0,NULL,NULL,NULL,'82abec75-7c2a-4607-b3b1-b3ef5c6c4361'),(2044,'TB Females and Cured','TB Females and Cured','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Females and Cured\n TB Females and Cured\n \n 2023-03-30 17:08:50 UTC\n \n 2023-03-30 17:09:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2044\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- Female \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where person.gender = 'F' \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 1068 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 19:08:50',4,'2023-03-30 19:09:12',4,0,NULL,NULL,NULL,'f746ec4b-a949-4b53-86c8-4e1a71843d72'),(2045,'HHCM_notEvaluated','HHCM Note Evaluated','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM_notEvaluated\n HHCM Note Evaluated\n \n 2023-03-30 17:09:07 UTC\n \n 2023-03-30 17:09:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2045\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3777 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2302,1068,2242,3650,3793,3794) \n and b.voided = 0 \n ) \n\n','2023-03-30 19:09:07',4,'2023-03-30 19:09:44',4,0,NULL,NULL,NULL,'d8caa7dd-326a-46f7-97ee-f7205689bfda'),(2046,'HHCM_curred','HHCM Curred','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM_curred\n HHCM Curred\n \n 2023-03-30 17:10:16 UTC\n \n 2023-03-30 17:10:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2046\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3777 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (1068) \n and b.voided = 0 \n ) \n\n','2023-03-30 19:10:16',4,'2023-03-30 19:10:39',4,0,NULL,NULL,NULL,'ea1cc81f-9ccc-4401-80e9-57a84da98f58'),(2047,'TB Females and Died','TB Females and Died','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Females and Died\n TB Females and Died\n \n 2023-03-30 17:11:17 UTC\n \n 2023-03-30 17:11:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2047\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- Female \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where person.gender = 'F' \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3650 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 19:11:17',4,'2023-03-30 19:11:45',4,0,NULL,NULL,NULL,'f55690e5-8b8d-43ce-b797-f0f8707d1222'),(2048,'HHCM_completed','HHCM Completed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM_completed\n HHCM Completed\n \n 2023-03-30 17:12:02 UTC\n \n 2023-03-30 17:12:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2048\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3777 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2242) \n and b.voided = 0 \n ) \n\n','2023-03-30 19:12:02',4,'2023-03-30 19:12:21',4,0,NULL,NULL,NULL,'7dbf3689-913d-4883-ae4b-5be2aee4ba37'),(2049,'TB Females and Lost to Follow up','TB Females and Lost to Follow up','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Females and Lost to Follow up\n TB Females and Lost to Follow up\n \n 2023-03-30 17:12:17 UTC\n \n 2023-03-30 17:13:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2049\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- Female \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where person.gender = 'F' \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 2302 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 19:12:17',4,'2023-03-30 19:13:14',4,0,NULL,NULL,NULL,'71a12f10-af92-4eba-88f2-176a2cb3ae14'),(2050,'HHCM_died','HHCM Died','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM_died\n HHCM Died\n \n 2023-03-30 17:12:43 UTC\n \n 2023-03-30 17:13:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2050\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3777 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3650) \n and b.voided = 0 \n ) \n\n','2023-03-30 19:12:43',4,'2023-03-30 19:13:08',4,0,NULL,NULL,NULL,'87c6de2e-d87a-430b-a15e-d5de45e36410'),(2051,'HHCM_lost','HHCM Lost','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM_lost\n HHCM Lost\n \n 2023-03-30 17:13:35 UTC\n \n 2023-03-30 17:14:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2051\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3777 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2302) \n and b.voided = 0 \n ) \n\n','2023-03-30 19:13:35',4,'2023-03-30 19:14:00',4,0,NULL,NULL,NULL,'543f25df-61ec-4cec-847f-816fec3268ec'),(2052,'TB Females and Failed (Susceptible)','TB Females and Failed (Susceptible)','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Females and Failed (Susceptible)\n TB Females and Failed (Susceptible)\n \n 2023-03-30 17:14:08 UTC\n \n 2023-03-30 17:14:24 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2052\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- Female \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where person.gender = 'F' \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3793 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 19:14:08',4,'2023-03-30 19:14:24',4,0,NULL,NULL,NULL,'d1085653-8aca-440b-ae5c-d899217ef3b5'),(2053,'HHCM_moved','HHCM Moved','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM_moved\n HHCM Moved\n \n 2023-03-30 17:14:34 UTC\n \n 2023-03-30 17:14:52 UTC\n \n \n endDate\n \n java.util.Date\n true\n \n \n startDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2053\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3777 \n and ob.voided = 0 \n ) \n and o.person_id in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3794) \n and b.voided = 0 \n ) \n\n','2023-03-30 19:14:34',4,'2023-03-30 19:14:52',4,0,NULL,NULL,NULL,'43bc5260-c525-4968-a427-01e7febdfef1'),(2054,'TB Females and Moved to SecondLine','TB Females and Moved to SecondLine','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Females and Moved to SecondLine\n TB Females and Moved to SecondLine\n \n 2023-03-30 17:14:53 UTC\n \n 2023-03-30 17:15:09 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2054\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- Female \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where person.gender = 'F' \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3794 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 19:14:53',4,'2023-03-30 19:15:09',4,0,NULL,NULL,NULL,'56836385-8ef8-49a4-bdc7-e7ac24baadb9'),(2055,'TB Females and Not Evaluated','TB Females and Not Evaluated','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Females and Not Evaluated\n TB Females and Not Evaluated\n \n 2023-03-30 17:15:40 UTC\n \n 2023-03-30 17:16:46 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2055\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- Female \n and o.person_id in ( \n select o.person_id \n from obs o \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n where person.gender = 'F' \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id not in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded in (1068,2242,3650,2302,3793,3794) \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-03-30 19:15:40',4,'2023-03-30 19:16:46',4,0,NULL,NULL,NULL,'d1ccfc19-7910-4d71-8ba4-1b31cfbc17b7'),(2056,'FactoryWorker_failed','Factory worker failed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n FactoryWorker_failed\n Factory worker failed\n \n 2023-04-03 07:36:11 UTC\n \n 2023-04-03 07:53:38 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2056\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3669 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3793) \n and b.voided = 0 \n ) \n\n','2023-04-03 09:36:11',4,'2023-04-03 09:53:38',4,0,NULL,NULL,NULL,'43e35844-a8eb-4cc5-a3cd-445a052316c2'),(2057,'prison_worker_failed','Prison worker failed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n prison_worker_failed\n Prison worker failed\n \n 2023-04-03 07:55:07 UTC\n \n 2023-04-03 07:56:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2057\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3779 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3793) \n and b.voided = 0 \n ) \n\n','2023-04-03 09:55:07',4,'2023-04-03 09:56:27',4,0,NULL,NULL,NULL,'a4dd9267-3676-4a8b-b56b-65b8683f1ba6'),(2058,'health_worker_failed','Health Worker Failed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n health_worker_failed\n Health Worker Failed\n \n 2023-04-03 07:57:33 UTC\n \n 2023-04-03 07:58:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2058\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3670 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3793) \n and b.voided = 0 \n ) \n\n','2023-04-03 09:57:33',4,'2023-04-03 09:58:07',4,0,NULL,NULL,NULL,'da9db0e3-0d78-489c-bd35-eb7c68e345d0'),(2059,'public_transport_failed','Public Transport Failed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n public_transport_failed\n Public Transport Failed\n \n 2023-04-03 07:58:45 UTC\n \n 2023-04-03 07:59:38 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2059\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 4654 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3793) \n and b.voided = 0 \n ) \n\n','2023-04-03 09:58:45',4,'2023-04-03 09:59:38',4,0,NULL,NULL,NULL,'33f5b01b-0001-4fbd-8d76-43b6616c4824'),(2060,'HHCM_failed','HHCM Failed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM_failed\n HHCM Failed\n \n 2023-04-03 09:18:29 UTC\n \n 2023-04-03 09:19:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2060\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3777 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3793) \n and b.voided = 0 \n ) \n\n','2023-04-03 11:18:29',4,'2023-04-03 11:19:51',4,0,NULL,NULL,NULL,'60d6cef7-079a-4825-b6e1-cb4eb655b864'),(2061,'Mine Workers Cured','Mine Workers Cured','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Mine Workers Cured\n Mine Workers Cured\n \n 2023-04-03 09:18:52 UTC\n \n 2023-04-04 12:32:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2061\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- Mine Worker \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3776 and o.value_coded = 3667 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 1068 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-04-03 11:18:52',4,'2023-04-04 14:32:36',4,0,NULL,NULL,NULL,'9fffbcb9-e2f8-43d2-b6ae-b257c80ff52c'),(2062,'Mine Workers Completed','Mine Workers Completed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Mine Workers Completed\n Mine Workers Completed\n \n 2023-04-03 09:20:24 UTC\n \n 2023-04-04 12:31:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2062\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- Mine Worker \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3776 and o.value_coded = 3667 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 2242 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-04-03 11:20:24',4,'2023-04-04 14:31:40',4,0,NULL,NULL,NULL,'22a95602-7db7-453f-8af1-d3314651365b'),(2063,'HHXM_completed','HHXM Completed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM_completed\n HHXM Completed\n \n 2023-04-03 09:20:26 UTC\n \n 2023-04-03 09:21:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2063\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3778 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2242) \n and b.voided = 0 \n ) \n\n','2023-04-03 11:20:26',4,'2023-04-03 11:21:05',4,0,NULL,NULL,NULL,'bc440ff8-a03c-42b4-b082-393873e19cc5'),(2064,'HHXM_failed','HHXM Failed','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM_failed\n HHXM Failed\n \n 2023-04-03 09:21:50 UTC\n \n 2023-04-03 22:08:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2064\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3778 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3793) \n and b.voided = 0 \n ) \n\n','2023-04-03 11:21:50',4,'2023-04-04 00:08:02',4,0,NULL,NULL,NULL,'168f05ac-dc2e-4c53-a38b-0d1ac6bc3f4c'),(2065,'Mine Workers Died','Mine Workers Died','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Mine Workers Died\n Mine Workers Died\n \n 2023-04-03 09:22:05 UTC\n \n 2023-04-04 12:33:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2065\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- Mine Worker \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3776 and o.value_coded = 3667 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3650 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-04-03 11:22:05',4,'2023-04-04 14:33:00',4,0,NULL,NULL,NULL,'75e3ca1f-9e04-4d1c-91ae-f79f18f650ee'),(2066,'HHXM_cured','HHXM Curred\r\n','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM_cured\n HHXM Curred \n\n \n 2023-04-03 09:22:14 UTC\n \n 2023-04-03 09:22:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2066\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3778 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (1068) \n and b.voided = 0 \n ) \n\n','2023-04-03 11:22:14',4,'2023-04-03 11:22:50',4,0,NULL,NULL,NULL,'1895c8dd-bf2c-4bd3-a48f-08770e349ffe'),(2067,'HHXM_moved','HHXM Moved','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM_moved\n HHXM Moved\n \n 2023-04-03 09:24:40 UTC\n \n 2023-04-03 09:27:22 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2067\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3778 \n and ob.voided = 0 \n ) \n and o.person_id in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3794) \n and b.voided = 0 \n ) \n\n','2023-04-03 11:24:40',4,'2023-04-03 11:27:22',4,0,NULL,NULL,NULL,'458408ac-2fc6-45e2-a884-8b8a75cf1d94'),(2068,'HHXM_lost','HHXM Lost','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM_lost\n HHXM Lost\n \n 2023-04-03 09:26:54 UTC\n \n 2023-04-03 09:27:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2068\n \nselect distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3778 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2302) \n and b.voided = 0 \n ) \n\n','2023-04-03 11:26:54',4,'2023-04-03 11:27:10',4,0,NULL,NULL,NULL,'20694047-0786-4ce8-922b-df3b23f39c56'),(2069,'Mine Workers Lost to Follow up','Mine Workers Lost to Follow up','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Mine Workers Lost to Follow up\n Mine Workers Lost to Follow up\n \n 2023-04-03 09:26:54 UTC\n \n 2023-04-04 12:33:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2069\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- Mine Worker \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3776 and o.value_coded = 3667 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 2302 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-04-03 11:26:54',4,'2023-04-04 14:33:39',4,0,NULL,NULL,NULL,'9406df9e-8673-48f0-81eb-21b60a5ded97'),(2070,'hhxm_notEvaluated','HHXm Not Evaluated','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n hhxm_notEvaluated\n HHXm Not Evaluated\n \n 2023-04-03 09:28:30 UTC\n \n 2023-04-03 09:29:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2070\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3778 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (2302,1068,2242,3650,3793,3794) \n and b.voided = 0 \n ) \n\n','2023-04-03 11:28:30',4,'2023-04-03 11:29:51',4,0,NULL,NULL,NULL,'0bd16759-6ff9-4cbf-a0b0-8e9fd1efd1be'),(2071,'Mine Workers Failed (Susceptible)','Mine Workers Failed (Susceptible)','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Mine Workers Failed (Susceptible)\n Mine Workers Failed (Susceptible)\n \n 2023-04-03 09:33:26 UTC\n \n 2023-04-04 12:33:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2071\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- Mine Worker \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3776 and o.value_coded = 3667 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3793 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-04-03 11:33:26',4,'2023-04-04 14:33:18',4,0,NULL,NULL,NULL,'4bba1fe8-13ad-4c18-b549-f0aff1e6bc3f'),(2072,'hhxm_died','HHXM Died','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n hhxm_died\n HHXM Died\n \n 2023-04-03 09:34:30 UTC\n \n 2023-04-03 10:13:34 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2072\n select distinct o.person_id \n from obs o \n inner join location l on o.location_id = l.location_id \n WHERE (o.location_id =:location or parent_location =:location) \n and o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 \n and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n and o.person_id in ( \n select ob.person_id \n from obs ob \n where ob.concept_id = 3776 \n and ob.value_coded = 3778 \n and ob.voided = 0 \n ) \n and o.person_id not in ( \n select b.person_id \n from obs b \n where b.concept_id = 3792 \n and b.value_coded in (3650) \n and b.voided = 0 \n ) \n\n','2023-04-03 11:34:30',4,'2023-04-03 12:13:34',4,0,NULL,NULL,NULL,'173bca27-99d3-497c-b83f-902bd3502875'),(2073,'Mine Workers Moved to Secondline Treatment','Mine Workers Moved to Secondline Treatment','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Mine Workers Moved to Secondline Treatment\n Mine Workers Moved to Secondline Treatment\n \n 2023-04-03 09:36:03 UTC\n \n 2023-04-04 12:29:57 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2073\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- Mine Worker \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3776 and o.value_coded = 3667 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3794 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-04-03 11:36:03',4,'2023-04-04 14:29:57',4,0,NULL,NULL,NULL,'7f349b74-1609-4786-a666-6f26b3e0934c'),(2074,'Mine Workers Not Evaluated','Mine Workers Not Evaluated','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Mine Workers Not Evaluated\n Mine Workers Not Evaluated\n \n 2023-04-03 09:39:03 UTC\n \n 2023-04-03 09:39:38 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2074\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- Mine Worker \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3776 and o.value_coded = 3667 \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id not in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded in (1068,2302,3650,3793,2242,3794) \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-04-03 11:39:03',4,'2023-04-03 11:39:38',4,0,NULL,NULL,NULL,'3f20bdd4-03b5-48eb-be2e-3e7d96d9608f'),(2075,'New and Relapse Completed','New and Relapse Completed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n New and Relapse Completed\n New and Relapse Completed\n \n 2023-04-03 09:46:12 UTC\n \n 2023-04-03 09:50:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2075\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 11:46:12',4,'2023-04-03 11:50:04',4,0,NULL,NULL,NULL,'bf8fffec-423b-4d4f-9082-a61937680e08'),(2076,'TB New and Relapse Cured','TB New and Relapse Cured','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB New and Relapse Cured\n TB New and Relapse Cured\n \n 2023-04-03 09:54:54 UTC\n \n 2023-04-03 10:09:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2076\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 11:54:54',4,'2023-04-03 12:09:07',4,0,NULL,NULL,NULL,'cc3e6b66-c906-4723-bf8b-f1e3bd9a4f48'),(2077,'TB New and Relapse Died','TB New and Relapse Died','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB New and Relapse Died\n TB New and Relapse Died\n \n 2023-04-03 10:09:39 UTC\n \n 2023-04-03 10:26:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2077\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 12:09:39',4,'2023-04-03 12:26:07',4,0,NULL,NULL,NULL,'cdd51d3f-4922-459d-a23e-a62718354d0f'),(2078,'TB New and Relapse Lost to Follow-up','TB New and Relapse Lost to Follow-up','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB New and Relapse Lost to Follow-up\n TB New and Relapse Lost to Follow-up\n \n 2023-04-03 10:13:30 UTC\n \n 2023-04-03 10:22:25 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2078\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 12:13:30',4,'2023-04-03 12:22:25',4,0,NULL,NULL,NULL,'e63623be-d56c-4e8a-9fb8-fcbfd651b326'),(2079,'Ex Miner - Died','Ex Miner Died','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Ex Miner - Died\n Ex Miner Died\n \n 2023-04-03 10:15:01 UTC\n \n 2023-04-03 10:18:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2079\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 12:15:01',4,'2023-04-03 12:18:31',4,0,NULL,NULL,NULL,'4c0567b3-bc02-4b62-be5b-4e348a8a17d5'),(2080,'Ex Miner - Lost','Ex Miner Lost','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Ex Miner - Lost\n Ex Miner Lost\n \n 2023-04-03 10:15:38 UTC\n \n 2023-04-03 10:20:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2080\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 12:15:38',4,'2023-04-03 12:20:44',4,0,NULL,NULL,NULL,'1001e669-922a-43ba-be6c-4e909e4d7f30'),(2081,'Ex Miner - Not Evaluated','Ex Miner Not Evaluated','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Ex Miner - Not Evaluated\n Ex Miner Not Evaluated\n \n 2023-04-03 10:16:26 UTC\n \n 2023-04-03 10:25:22 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2081\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 12:16:26',4,'2023-04-03 12:25:22',4,0,NULL,NULL,NULL,'95297d99-247c-4cb1-8454-8cde32e41699'),(2082,'Ex Miner - Completed','Ex Miner - Completed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Ex Miner - Completed\n Ex Miner - Completed\n \n 2023-04-03 10:21:16 UTC\n \n 2023-04-03 10:53:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2082\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 12:21:16',4,'2023-04-03 12:53:45',4,0,NULL,NULL,NULL,'6512f126-9e67-46ba-aaab-e783a36a4efa'),(2083,'Ex Miner - Moved Second Line','Ex Miner moved second line','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Ex Miner - Moved Second Line\n Ex Miner moved second line\n \n 2023-04-03 10:22:16 UTC\n \n 2023-04-03 10:24:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2083\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 12:22:16',4,'2023-04-03 12:24:44',4,0,NULL,NULL,NULL,'7de4354e-95cb-4f66-8d40-0bd243779ee4'),(2084,'TB New and Relapse Failed (Susceptible)','TB New and Relapse Failed (Susceptible)','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB New and Relapse Failed (Susceptible)\n TB New and Relapse Failed (Susceptible)\n \n 2023-04-03 10:26:32 UTC\n \n 2023-04-03 11:24:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2084\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 12:26:32',4,'2023-04-03 13:24:51',4,0,NULL,NULL,NULL,'e3218a64-d243-48aa-9b9a-bbcda0104ae7'),(2085,'Ex Miner - Failed','Ex Miner - Failed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Ex Miner - Failed\n Ex Miner - Failed\n \n 2023-04-03 10:27:35 UTC\n \n 2023-04-03 11:24:34 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2085\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 12:27:35',4,'2023-04-03 13:24:34',4,0,NULL,NULL,NULL,'aa17ed03-51ed-4fde-8ad9-164f975ded80'),(2086,'TB New and Relapse Moved to second line treatment','TB New and Relapse Moved to second line treatment','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB New and Relapse Moved to second line treatment\n TB New and Relapse Moved to second line treatment\n \n 2023-04-03 10:27:42 UTC\n \n 2023-04-03 10:29:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2086\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 12:27:42',4,'2023-04-03 12:29:11',4,0,NULL,NULL,NULL,'687406cb-8ffe-4b7a-a806-583e78f04e48'),(2087,'Ex Miner - Cured','Ex Miner - Cured','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Ex Miner - Cured\n Ex Miner - Cured\n \n 2023-04-03 10:28:42 UTC\n \n 2023-04-04 09:25:16 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2087\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 12:28:42',4,'2023-04-04 11:25:16',4,0,NULL,NULL,NULL,'6210a6de-cdbc-411c-b9fc-e6a6bf2f42bc'),(2088,'Factory Worker - Complete','Factory Worker - Complete','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Factory Worker - Complete\n Factory Worker - Complete\n \n 2023-04-03 11:31:19 UTC\n \n 2023-04-03 11:33:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2088\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 13:31:19',4,'2023-04-03 13:33:02',4,0,NULL,NULL,NULL,'d1ce4f4f-9869-4fdd-afa5-da1899ae3815'),(2089,'Factory Worker - Cured','Factory Worker - Cured','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Factory Worker - Cured\n Factory Worker - Cured\n \n 2023-04-03 11:35:29 UTC\n \n 2023-04-03 11:37:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2089\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 13:35:29',4,'2023-04-03 13:37:51',4,0,NULL,NULL,NULL,'b92fab4d-1381-445b-abb1-1ba06b0957d4'),(2090,'Factory Worker - Died','Factory Worker - Died','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Factory Worker - Died\n Factory Worker - Died\n \n 2023-04-03 11:37:01 UTC\n \n 2023-04-03 11:39:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2090\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 13:37:01',4,'2023-04-03 13:39:08',4,0,NULL,NULL,NULL,'ef65034d-ed9d-452d-af2f-ababeecfa6ad'),(2091,'Factory Worker - Lost','Factory Worker - Lost','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Factory Worker - Lost\n Factory Worker - Lost\n \n 2023-04-03 11:38:56 UTC\n \n 2023-04-03 11:58:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2091\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 13:38:56',4,'2023-04-03 13:58:59',4,0,NULL,NULL,NULL,'a9e56df4-43a7-4387-828d-10c9dfb89245'),(2092,'Factory Worker - Not Evaluated','Factory Worker - Not Evaluated','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Factory Worker - Not Evaluated\n Factory Worker - Not Evaluated\n \n 2023-04-03 11:43:52 UTC\n \n 2023-04-03 11:59:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2092\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 13:43:52',4,'2023-04-03 13:59:10',4,0,NULL,NULL,NULL,'77cd1821-951d-42ed-a866-5f08fd800a9c'),(2093,'TB New and Relapse Not Evaluated','TB New and Relapse Not Evaluated','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB New and Relapse Not Evaluated\n TB New and Relapse Not Evaluated\n \n 2023-04-03 11:45:15 UTC\n \n 2023-04-03 11:52:49 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2093\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 13:45:15',4,'2023-04-03 13:52:49',4,0,NULL,NULL,NULL,'8c3908aa-5ac3-4dc9-9261-cdd7fc07e365'),(2094,'Retreatment excluding Relapse Completed','Retreatment excluding Relapse Completed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Retreatment excluding Relapse Completed\n Retreatment excluding Relapse Completed\n \n 2023-04-03 19:27:03 UTC\n \n 2023-04-04 12:39:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2094\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 21:27:03',4,'2023-04-04 14:39:55',4,0,NULL,NULL,NULL,'f3df3cc6-11ba-4ef1-9b6b-eba700de0818'),(2095,'Factory Worker - Moved to 2nd line','Factory Worker - Moved to 2nd line','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Factory Worker - Moved to 2nd line\n Factory Worker - Moved to 2nd line\n \n 2023-04-03 19:33:19 UTC\n \n 2023-04-03 19:35:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2095\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 21:33:19',4,'2023-04-03 21:35:06',4,0,NULL,NULL,NULL,'9ac7ec7c-6fa1-4771-8cb3-bcfca51f5e4b'),(2096,'Retreatment excluding Relapse Cured','Retreatment excluding Relapse Cured','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Retreatment excluding Relapse Cured\n Retreatment excluding Relapse Cured\n \n 2023-04-03 19:37:22 UTC\n \n 2023-04-03 19:42:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2096\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 21:37:22',4,'2023-04-03 21:42:14',4,0,NULL,NULL,NULL,'af4ccd45-738a-452f-ab0e-aa7588ecd131'),(2097,'Factory Worker - Failed','Factory Worker - Failed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Factory Worker - Failed\n Factory Worker - Failed\n \n 2023-04-03 19:44:52 UTC\n \n 2023-04-03 19:49:24 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2097\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 21:44:52',4,'2023-04-03 21:49:24',4,0,NULL,NULL,NULL,'f353300f-5673-4742-9115-c5b0b7e398e8'),(2098,'Retreatment excluding Relapse Died','Retreatment excluding Relapse Died','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Retreatment excluding Relapse Died\n Retreatment excluding Relapse Died\n \n 2023-04-03 19:48:30 UTC\n \n 2023-04-03 19:51:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2098\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 21:48:30',4,'2023-04-03 21:51:58',4,0,NULL,NULL,NULL,'ae6d7e28-203a-4141-b338-0a2faadc3662'),(2099,'Prison Worker - Died','Prison Worker - Died','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Prison Worker - Died\n Prison Worker - Died\n \n 2023-04-03 19:50:39 UTC\n \n 2023-04-03 19:53:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2099\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 21:50:39',4,'2023-04-03 21:53:44',4,0,NULL,NULL,NULL,'93b06207-6e95-4711-aa58-31c3a88ef1c0'),(2100,'Prison Worker - Cured','Prison Worker - Cured','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Prison Worker - Cured\n Prison Worker - Cured\n \n 2023-04-03 19:53:11 UTC\n \n 2023-04-03 19:54:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2100\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 21:53:11',4,'2023-04-03 21:54:43',4,0,NULL,NULL,NULL,'2f32e1d7-b41d-4bb7-89a3-80c3243e4948'),(2101,'Retreatment excluding Relapse Lost to follow up','Retreatment excluding Relapse Lost to follow up','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Retreatment excluding Relapse Lost to follow up\n Retreatment excluding Relapse Lost to follow up\n \n 2023-04-03 19:53:33 UTC\n \n 2023-04-03 19:55:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2101\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 21:53:33',4,'2023-04-03 21:55:20',4,0,NULL,NULL,NULL,'e5c0a844-b04b-40b4-99a4-32232d7a740e'),(2102,'Prison Worker - Completed','Prison Worker - Completed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Prison Worker - Completed\n Prison Worker - Completed\n \n 2023-04-03 19:55:01 UTC\n \n 2023-04-03 20:00:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2102\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 21:55:01',4,'2023-04-03 22:00:15',4,0,NULL,NULL,NULL,'a4e75f76-e839-46af-bdc6-8218f3df823c'),(2103,'Retreatment excluding Relapse Failed','Retreatment excluding Relapse Failed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Retreatment excluding Relapse Failed\n Retreatment excluding Relapse Failed\n \n 2023-04-03 19:57:02 UTC\n \n 2023-04-03 20:01:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2103\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 21:57:02',4,'2023-04-03 22:01:44',4,0,NULL,NULL,NULL,'abea75a9-417c-4570-a63e-5739c02c765e'),(2104,'Prison Worker - Not Evaluated','Prison Worker - Not Evaluated','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Prison Worker - Not Evaluated\n Prison Worker - Not Evaluated\n \n 2023-04-03 19:59:02 UTC\n \n 2023-04-03 20:00:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2104\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 21:59:02',4,'2023-04-03 22:00:31',4,0,NULL,NULL,NULL,'5f8c563b-7314-4359-8bb4-4f9d51fe2257'),(2105,'TB Treatment Outcome - Block 2','Block 2: TB/HIV Activities','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Treatment Outcome - Block 2\n Block 2: TB/HIV Activities\n \n 2023-04-03 20:01:22 UTC\n \n 2023-04-03 20:01:46 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2105\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-04-03 22:01:22',4,'2023-04-03 22:01:46',4,0,NULL,NULL,NULL,'e24dad06-5de1-4215-b021-85b95585a56b'),(2106,'TB Treatment Outcome - Block 2 Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Treatment Outcome - Block 2 Data Set\n \n 2023-04-03 20:01:46 UTC\n \n 2023-04-03 20:33:35 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2106\n \n \n DM_Sex\n \n \n \n \n \n \n \n \n ARTNw&Rl_F\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n \n \n \n ARTNw&Rl_M\n \n \n \n \n DM_Sex\n Males\n \n \n \n \n \n ARTRetr_F\n \n \n \n \n \n \n \n \n \n ARTRetr_M\n \n \n \n \n \n \n DapNw&Rl_F\n \n \n \n \n \n \n \n \n \n DapNw&Rl_M\n \n \n \n \n \n \n DapRetre_F\n \n \n \n \n \n \n \n \n \n DapRetre_M\n \n \n \n \n \n \n PosNw&Rs_F\n \n \n \n \n \n \n \n \n \n PosNw&Rs_M\n \n \n \n \n \n \n PosRetr_F\n \n \n \n \n \n \n \n \n \n PosRetr_M\n \n \n \n \n \n \n StsNw&Rs_F\n \n \n \n \n \n \n \n \n \n StsNw&Rs_M\n \n \n \n \n \n \n StsRetre_F\n \n \n \n \n \n \n StsRetre_M\n \n \n \n \n \n \n','2023-04-03 22:01:46',4,'2023-04-03 22:33:35',4,0,NULL,NULL,NULL,'5730236a-dfc3-4bf5-8f18-3769e49f4519'),(2107,'Prison Worker - Failed','Prison Worker - Failed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Prison Worker - Failed\n Prison Worker - Failed\n \n 2023-04-03 20:01:47 UTC\n \n 2023-04-03 20:07:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2107\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:01:47',4,'2023-04-03 22:07:43',4,0,NULL,NULL,NULL,'832801ab-b41b-4695-b0df-ada7c5c34ff7'),(2108,'Retreatment excluding Relapse Not Evaluated','Retreatment excluding Relapse Not Evaluated','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Retreatment excluding Relapse Not Evaluated\n Retreatment excluding Relapse Not Evaluated\n \n 2023-04-03 20:02:36 UTC\n \n 2023-04-03 20:05:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2108\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:02:36',4,'2023-04-03 22:05:10',4,0,NULL,NULL,NULL,'9c3205c9-eb03-46c1-b7e8-a0e9fa4b4738'),(2109,'Prison Worker - Moved to 2nd line','Prison Worker - Moved to 2nd line','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Prison Worker - Moved to 2nd line\n Prison Worker - Moved to 2nd line\n \n 2023-04-03 20:02:41 UTC\n \n 2023-04-03 20:05:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2109\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:02:41',4,'2023-04-03 22:05:28',4,0,NULL,NULL,NULL,'cee1771f-3491-455f-9b0a-a35e99f25454'),(2110,'Retreatment excluding Relapse Moved to Secondline Treatment','Retreatment excluding Relapse Moved to Secondline Treatment','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Retreatment excluding Relapse Moved to Secondline Treatment\n Retreatment excluding Relapse Moved to Secondline Treatment\n \n 2023-04-03 20:06:37 UTC\n \n 2023-04-03 20:20:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2110\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:06:37',4,'2023-04-03 22:20:31',4,0,NULL,NULL,NULL,'ee732817-3760-4a2d-9d61-f7009cd0b256'),(2111,'Prison Worker - Lost','Prison Worker - Lost','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Prison Worker - Lost\n Prison Worker - Lost\n \n 2023-04-03 20:07:00 UTC\n \n 2023-04-03 20:10:16 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2111\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:07:00',4,'2023-04-03 22:10:16',4,0,NULL,NULL,NULL,'bfa5d083-f2ca-4c04-a6d3-193176de6d61'),(2112,'RetreatRetreatment excluding Relapse Moved to Secondline Treatment','RetreatRetreatment excluding Relapse Moved to Secondline Treatment','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n RetreatRetreatment excluding Relapse Moved to Secondline Treatment\n RetreatRetreatment excluding Relapse Moved to Secondline Treatment\n \n 2023-04-03 20:13:03 UTC\n \n 2023-04-03 20:14:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2112\n select distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id =:location or parent_location =:location) \nand o.person_id in(Select distinct Id \n From( \n select distinct patient.patient_id AS Id, \n patient_identifier.identifier AS patientIdentifier, \n pi2.identifier AS TB_Number, \n concat(person_name.given_name, ' ', person_name.family_name) AS patientName, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age, \n observed_age_group.name AS age_group, \n person.gender AS Gender, \n observed_age_group.sort_order AS sort_order \n from obs o \n -- TB Clients \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN person_name ON person.person_id = person_name.person_id AND person_name.preferred = 1 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n LEFT JOIN patient_identifier pi2 ON pi2.patient_id = o.person_id AND pi2.identifier_type in (7) \n AND o.voided=0 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n AND o.concept_id in (4153, 1158) \n AND CAST(o.obs_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(o.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND patient.voided = 0 AND o.voided = 0 \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 2237 and o.voided = 0 \n and o.value_datetime >= DATE_ADD(CAST(:startDate AS DATE), INTERVAL -12 MONTH) \n and o.value_datetime <= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -12 MONTH) \n group by o.person_id \n ) \n -- Retreatment excluding Relapse \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3785 and o.value_coded in (3786,1037) \n and o.voided = 0 \n ) \n -- TB Treatment Outcome \n and o.person_id in ( \n select o.person_id \n from obs o \n where o.concept_id = 3792 and o.value_coded = 3794 \n and o.voided = 0 \n ) \n \n Group by o.person_id) AS TB_TESTING \n) \n\n','2023-04-03 22:13:03',4,'2023-04-03 22:14:36',4,0,NULL,NULL,NULL,'2573846a-4c51-4427-bcba-7ed91d2c0835'),(2113,'Health Worker - Died','Health Worker - Died','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Health Worker - Died\n Health Worker - Died\n \n 2023-04-03 20:14:38 UTC\n \n 2023-04-03 20:16:57 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2113\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:14:38',4,'2023-04-03 22:16:57',4,0,NULL,NULL,NULL,'15cca65b-c4f6-4e32-8b7d-18cb047f999a'),(2114,'Health Worker - Cured','Health Worker - Cured','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Health Worker - Cured\n Health Worker - Cured\n \n 2023-04-03 20:16:23 UTC\n \n 2023-04-03 20:18:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2114\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:16:23',4,'2023-04-03 22:18:17',4,0,NULL,NULL,NULL,'efe0083b-cc7c-4394-bf4d-e4129ee2d998'),(2115,'Prison Worker - Completed','Prison Worker - Completed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Prison Worker - Completed\n Prison Worker - Completed\n \n 2023-04-03 20:18:34 UTC\n \n 2023-04-03 20:22:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2115\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:18:34',4,'2023-04-03 22:22:51',4,0,NULL,NULL,NULL,'685d03a5-0f34-426e-aa83-e12e209284b4'),(2116,'Prison Worker - Failed','Prison Worker - Failed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Prison Worker - Failed\n Prison Worker - Failed\n \n 2023-04-03 20:20:00 UTC\n \n 2023-04-03 20:22:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2116\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:20:00',4,'2023-04-03 22:22:29',4,0,NULL,NULL,NULL,'792e1555-e40d-4ebf-8b96-ebbaa769f859'),(2117,'All TB HIV positive Completed','All TB HIV positive Completed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV positive Completed\n All TB HIV positive Completed\n \n 2023-04-03 20:21:28 UTC\n \n 2023-04-03 20:31:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2117\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:21:28',4,'2023-04-03 22:31:15',4,0,NULL,NULL,NULL,'18f345bc-6ed0-42d6-893a-05ba98b38e16'),(2118,'All TB HIV positive Cured','All TB HIV positive Cured','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV positive Cured\n All TB HIV positive Cured\n \n 2023-04-03 20:25:37 UTC\n \n 2023-04-03 20:32:16 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2118\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:25:37',4,'2023-04-03 22:32:16',4,0,NULL,NULL,NULL,'4b6e2cd9-29b6-4f7b-8af7-0ab18e2af838'),(2119,'Health Worker - Completed','Health Worker - Completed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Health Worker - Completed\n Health Worker - Completed\n \n 2023-04-03 20:32:38 UTC\n \n 2023-04-03 20:39:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2119\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:32:38',4,'2023-04-03 22:39:58',4,0,NULL,NULL,NULL,'b38f490e-8d26-411a-9073-2a7e5d17e235'),(2120,'All TB HIV positive and Died','All TB HIV positive and Died','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV positive and Died\n All TB HIV positive and Died\n \n 2023-04-03 20:32:43 UTC\n \n 2023-04-03 20:35:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2120\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:32:43',4,'2023-04-03 22:35:39',4,0,NULL,NULL,NULL,'f0b13ce3-b836-4a27-a7a4-d1b83c1eb900'),(2121,'Health Worker - Not Evaluated','Health Worker - Not Evaluated','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Health Worker - Not Evaluated\n Health Worker - Not Evaluated\n \n 2023-04-03 20:32:56 UTC\n \n 2023-04-03 20:35:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2121\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:32:56',4,'2023-04-03 22:35:43',4,0,NULL,NULL,NULL,'9f750645-0dc4-488d-8a94-05e31d6b4838'),(2122,'All TB HIV positive and Lost to Follow Up','All TB HIV positive and Lost to Follow Up','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV positive and Lost to Follow Up\n All TB HIV positive and Lost to Follow Up\n \n 2023-04-03 20:33:45 UTC\n \n 2023-04-03 20:36:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2122\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:33:45',4,'2023-04-03 22:36:08',4,0,NULL,NULL,NULL,'21738598-0974-4f31-9925-1c9606d66410'),(2123,'All TB HIV positive and Failed','All TB HIV positive and Failed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV positive and Failed\n All TB HIV positive and Failed\n \n 2023-04-03 20:36:30 UTC\n \n 2023-04-03 20:40:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2123\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:36:30',4,'2023-04-03 22:40:18',4,0,NULL,NULL,NULL,'2a7766be-418e-4a5a-a204-c5fa91e6b672'),(2124,'All TB HIV positive and Not Evaluated','All TB HIV positive and Not Evaluated','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV positive and Not Evaluated\n All TB HIV positive and Not Evaluated\n \n 2023-04-03 20:37:09 UTC\n \n 2023-04-03 20:39:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2124\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:37:09',4,'2023-04-03 22:39:20',4,0,NULL,NULL,NULL,'04c0074a-fd87-44da-8d96-68d533e488ea'),(2125,'Health Worker - Lost','Health Worker - Lost','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Health Worker - Lost\n Health Worker - Lost\n \n 2023-04-03 20:40:25 UTC\n \n 2023-04-03 20:44:16 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2125\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:40:25',4,'2023-04-03 22:44:16',4,0,NULL,NULL,NULL,'925a50ba-435b-4213-a03b-6272a468cd01'),(2126,'All TB HIV positive and Moved to Secondline Treatment','All TB HIV positive and Moved to Secondline Treatment','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV positive and Moved to Secondline Treatment\n All TB HIV positive and Moved to Secondline Treatment\n \n 2023-04-03 20:40:57 UTC\n \n 2023-04-03 20:42:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2126\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:40:57',4,'2023-04-03 22:42:27',4,0,NULL,NULL,NULL,'6ed079c9-5ad9-4852-9523-95fddcbc9959'),(2127,'Health Worker - Failed','Health Worker - Failed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Health Worker - Failed\n Health Worker - Failed\n \n 2023-04-03 20:42:41 UTC\n \n 2023-04-03 20:52:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2127\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:42:41',4,'2023-04-03 22:52:06',4,0,NULL,NULL,NULL,'4ec08d1c-6427-44e0-b604-b960e585b190'),(2128,'All TB HIV Negative and Completed','All TB HIV Negative and Completed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Negative and Completed\n All TB HIV Negative and Completed\n \n 2023-04-03 20:43:07 UTC\n \n 2023-04-03 20:53:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2128\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:43:07',4,'2023-04-03 22:53:20',4,0,NULL,NULL,NULL,'d5786c86-ca76-43b1-b0a6-1bd90817af65'),(2129,'All TB HIV Negative and Cured','All TB HIV Negative and Cured','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Negative and Cured\n All TB HIV Negative and Cured\n \n 2023-04-03 20:44:07 UTC\n \n 2023-04-03 20:49:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2129\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:44:07',4,'2023-04-03 22:49:20',4,0,NULL,NULL,NULL,'a564539f-267c-452a-99d2-0f61f7c88c4f'),(2130,'Health Worker - Moved to 2nd line','Health Worker - Moved to 2nd line','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Health Worker - Moved to 2nd line\n Health Worker - Moved to 2nd line\n \n 2023-04-03 20:48:45 UTC\n \n 2023-04-03 20:55:46 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2130\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:48:45',4,'2023-04-03 22:55:46',4,0,NULL,NULL,NULL,'c0d08cc2-25dc-48f6-a9bc-db0d9b376d17'),(2131,'All TB HIV Negative and Died','All TB HIV Negative and Died','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Negative and Died\n All TB HIV Negative and Died\n \n 2023-04-03 20:51:50 UTC\n \n 2023-04-03 20:55:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2131\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:51:50',4,'2023-04-03 22:55:29',4,0,NULL,NULL,NULL,'b375d3b0-9817-419c-ad36-5513383a0191'),(2132,'Public Transport - Died','Public Transport - Died','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Public Transport - Died\n Public Transport - Died\n \n 2023-04-03 20:55:26 UTC\n \n 2023-04-03 20:57:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2132\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:55:26',4,'2023-04-03 22:57:21',4,0,NULL,NULL,NULL,'09f945ef-6ced-4c7c-924b-d83368e5b544'),(2133,'All TB HIV Negative and Failed','All TB HIV Negative and Failed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Negative and Failed\n All TB HIV Negative and Failed\n \n 2023-04-03 20:56:21 UTC\n \n 2023-04-03 21:00:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2133\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:56:21',4,'2023-04-03 23:00:30',4,0,NULL,NULL,NULL,'bce54b53-dea6-4664-bc35-b436a74551f0'),(2134,'All TB HIV Negative and Lost to Follow Up','All TB HIV Negative and Lost to Follow Up','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Negative and Lost to Follow Up\n All TB HIV Negative and Lost to Follow Up\n \n 2023-04-03 20:56:44 UTC\n \n 2023-04-03 21:00:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2134\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:56:44',4,'2023-04-03 23:00:04',4,0,NULL,NULL,NULL,'7b40659a-ca9a-4034-832f-5fddb0421d26'),(2135,'Public Transport - Not Evaluated','Public Transport - Not Evaluated','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Public Transport - Not Evaluated\n Public Transport - Not Evaluated\n \n 2023-04-03 20:56:54 UTC\n \n 2023-04-03 20:59:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2135\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:56:54',4,'2023-04-03 22:59:03',4,0,NULL,NULL,NULL,'0b001306-febd-4630-acb7-03fedc1eca0d'),(2136,'Public Transport - Completed','Public Transport - Completed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Public Transport - Completed\n Public Transport - Completed\n \n 2023-04-03 20:58:25 UTC\n \n 2023-04-03 21:00:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2136\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 22:58:25',4,'2023-04-03 23:00:42',4,0,NULL,NULL,NULL,'cb8baffc-6e41-4464-91b4-478da43820ad'),(2137,'Public Transport - Lost','Public Transport - Lost','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Public Transport - Lost\n Public Transport - Lost\n \n 2023-04-03 21:00:25 UTC\n \n 2023-04-03 21:04:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2137\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:00:25',4,'2023-04-03 23:04:00',4,0,NULL,NULL,NULL,'68abf753-d909-4d9d-866b-d707b637b5f6'),(2138,'All TB HIV Negative and Not Evaluated','All TB HIV Negative and Not Evaluated','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Negative and Not Evaluated\n All TB HIV Negative and Not Evaluated\n \n 2023-04-03 21:00:53 UTC\n \n 2023-04-03 21:02:35 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2138\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:00:53',4,'2023-04-03 23:02:35',4,0,NULL,NULL,NULL,'56fc35af-e96c-4268-b7b4-0d63610a2d06'),(2139,'All TB HIV Negative and Moved to Secondline Treatment','All TB HIV Negative and Moved to Secondline Treatment','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB HIV Negative and Moved to Secondline Treatment\n All TB HIV Negative and Moved to Secondline Treatment\n \n 2023-04-03 21:01:36 UTC\n \n 2023-04-03 21:02:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2139\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:01:36',4,'2023-04-03 23:02:58',4,0,NULL,NULL,NULL,'bdf99672-96f9-4eda-ad34-a82f5b59ffbc'),(2140,'Public Transport - Cured','Public Transport - Cured','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Public Transport - Cured\n Public Transport - Cured\n \n 2023-04-03 21:02:12 UTC\n \n 2023-04-03 21:06:24 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2140\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:02:12',4,'2023-04-03 23:06:24',4,0,NULL,NULL,NULL,'185b4be8-a666-4211-b22d-56dc426cbbcd'),(2141,'All TB Children (0-14 yrs) and Completed','All TB Children (0-14 yrs) and Completed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Children (0-14 yrs) and Completed\n All TB Children (0-14 yrs) and Completed\n \n 2023-04-03 21:03:41 UTC\n \n 2023-04-03 21:05:56 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2141\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:03:41',4,'2023-04-03 23:05:56',4,0,NULL,NULL,NULL,'eb242fe9-dde6-4baa-b92f-7a7084920dd7'),(2142,'All TB Children (0-14 yrs) and Cured','All TB Children (0-14 yrs) and Cured','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Children (0-14 yrs) and Cured\n All TB Children (0-14 yrs) and Cured\n \n 2023-04-03 21:04:01 UTC\n \n 2023-04-03 21:06:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2142\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:04:01',4,'2023-04-03 23:06:20',4,0,NULL,NULL,NULL,'88c4f217-bf94-4e84-9d4b-15f6747276ae'),(2143,'Public Transport - Moved to 2nd line','Public Transport - Moved to 2nd line','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Public Transport - Moved to 2nd line\n Public Transport - Moved to 2nd line\n \n 2023-04-03 21:05:57 UTC\n \n 2023-04-03 21:10:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2143\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:05:57',4,'2023-04-03 23:10:23',4,0,NULL,NULL,NULL,'3d87ffb3-cfb1-4ac5-bf47-dcb3193e133b'),(2144,'All TB Children (0-14 yrs) and Died','All TB Children (0-14 yrs) and Died','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Children (0-14 yrs) and Died\n All TB Children (0-14 yrs) and Died\n \n 2023-04-03 21:06:48 UTC\n \n 2023-04-03 21:08:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2144\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:06:48',4,'2023-04-03 23:08:55',4,0,NULL,NULL,NULL,'30a341a8-2bf8-4e91-a9ee-41b6826e2cef'),(2145,'Public Transport - Failed','Public Transport - Failed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Public Transport - Failed\n Public Transport - Failed\n \n 2023-04-03 21:07:43 UTC\n \n 2023-04-03 21:09:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2145\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:07:43',4,'2023-04-03 23:09:40',4,0,NULL,NULL,NULL,'e9843f95-15c2-4d15-bd2c-bdfc19bc4767'),(2146,'All TB Children (0-14 yrs) and Lost to follow up','All TB Children (0-14 yrs) and Lost to follow up','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Children (0-14 yrs) and Lost to follow up\n All TB Children (0-14 yrs) and Lost to follow up\n \n 2023-04-03 21:08:17 UTC\n \n 2023-04-03 21:16:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2146\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:08:17',4,'2023-04-03 23:16:59',4,0,NULL,NULL,NULL,'33f4111b-438c-4da8-bc56-0c588f408444'),(2147,'All TB Children (0-14 yrs) and failed','All TB Children (0-14 yrs) and failed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Children (0-14 yrs) and failed\n All TB Children (0-14 yrs) and failed\n \n 2023-04-03 21:09:49 UTC\n \n 2023-04-03 21:17:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2147\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:09:49',4,'2023-04-03 23:17:30',4,0,NULL,NULL,NULL,'af568cf8-77aa-4d45-ab4f-ca39418ba77d'),(2148,'HHCM - Completed','HHCM - Completed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM - Completed\n HHCM - Completed\n \n 2023-04-03 21:11:12 UTC\n \n 2023-04-03 21:13:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2148\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:11:12',4,'2023-04-03 23:13:17',4,0,NULL,NULL,NULL,'23d932aa-9c33-4aff-89ec-9028c25a03ef'),(2149,'All TB Children (0-14 yrs) and not evaluated','All TB Children (0-14 yrs) and not evaluated','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Children (0-14 yrs) and not evaluated\n All TB Children (0-14 yrs) and not evaluated\n \n 2023-04-03 21:12:28 UTC\n \n 2023-04-03 21:15:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2149\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:12:28',4,'2023-04-03 23:15:26',4,0,NULL,NULL,NULL,'12a47e2e-735f-4b72-9e0c-f9fc792f3fc8'),(2150,'HHCM - Failed','HHCM - Failed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM - Failed\n HHCM - Failed\n \n 2023-04-03 21:13:03 UTC\n \n 2023-04-03 21:35:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2150\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:13:03',4,'2023-04-03 23:35:08',4,0,NULL,NULL,NULL,'ce1c1a8e-9760-4a56-a885-4bc25de4f892'),(2151,'HHCM - Lost','HHCM - Lost','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM - Lost\n HHCM - Lost\n \n 2023-04-03 21:14:35 UTC\n \n 2023-04-03 21:36:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2151\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:14:35',4,'2023-04-03 23:36:26',4,0,NULL,NULL,NULL,'b9ee3b47-b5d7-42ed-9a47-4f61f77b6eeb'),(2152,'All TB Children (0-14 yrs) and moved to secondline treatment','All TB Children (0-14 yrs) and moved to secondline treatment','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Children (0-14 yrs) and moved to secondline treatment\n All TB Children (0-14 yrs) and moved to secondline treatment\n \n 2023-04-03 21:18:05 UTC\n \n 2023-04-03 21:30:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2152\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:18:05',4,'2023-04-03 23:30:14',4,0,NULL,NULL,NULL,'692b0f3e-9c3e-4a71-bba3-b6ae50963679'),(2153,'All TB Adolescent (10-19 yrs) and Completed','All TB Adolescent (10-19 yrs) and Completed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Adolescent (10-19 yrs) and Completed\n All TB Adolescent (10-19 yrs) and Completed\n \n 2023-04-03 21:27:45 UTC\n \n 2023-04-03 21:29:16 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2153\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:27:45',4,'2023-04-03 23:29:16',4,0,NULL,NULL,NULL,'ad3dbe97-3718-4885-a76d-36982b68f507'),(2154,'All TB Adolescent (10-19 yrs) and Cured','All TB Adolescent (10-19 yrs) and Cured','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Adolescent (10-19 yrs) and Cured\n All TB Adolescent (10-19 yrs) and Cured\n \n 2023-04-03 21:28:37 UTC\n \n 2023-04-03 21:30:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2154\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:28:37',4,'2023-04-03 23:30:39',4,0,NULL,NULL,NULL,'ee2cd03a-51b0-4f81-81cc-40ab687629a8'),(2155,'All TB Adolescent (10-19 yrs) and Died','All TB Adolescent (10-19 yrs) and Died','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Adolescent (10-19 yrs) and Died\n All TB Adolescent (10-19 yrs) and Died\n \n 2023-04-03 21:30:59 UTC\n \n 2023-04-03 21:33:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2155\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:30:59',4,'2023-04-03 23:33:07',4,0,NULL,NULL,NULL,'f27e06d5-38ff-443b-8ce0-3cebb07f2eec'),(2156,'All TB Adolescent (10-19 yrs) and Lost to follow up','All TB Adolescent (10-19 yrs) and Lost to follow up','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Adolescent (10-19 yrs) and Lost to follow up\n All TB Adolescent (10-19 yrs) and Lost to follow up\n \n 2023-04-03 21:31:24 UTC\n \n 2023-04-03 21:33:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2156\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:31:24',4,'2023-04-03 23:33:27',4,0,NULL,NULL,NULL,'b7f7dbd4-f089-4ac4-9bc5-4c750a016a6c'),(2157,'All TB Adolescent (10-19 yrs) and failed','All TB Adolescent (10-19 yrs) and failed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Adolescent (10-19 yrs) and failed\n All TB Adolescent (10-19 yrs) and failed\n \n 2023-04-03 21:31:48 UTC\n \n 2023-04-03 21:38:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2157\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:31:48',4,'2023-04-03 23:38:15',4,0,NULL,NULL,NULL,'6ab5cc07-88e8-4b34-9cb6-8d451336945a'),(2158,'All TB Adolescent (10-19 yrs) and Not Evaluated','All TB Adolescent (10-19 yrs) and Not Evaluated','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Adolescent (10-19 yrs) and Not Evaluated\n All TB Adolescent (10-19 yrs) and Not Evaluated\n \n 2023-04-03 21:34:28 UTC\n \n 2023-04-03 21:36:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2158\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:34:28',4,'2023-04-03 23:36:44',4,0,NULL,NULL,NULL,'4465b2b0-282f-4b7a-8acc-ba9018cf82ca'),(2159,'All TB Adolescent (10-19 yrs) and Moved to Secondline treatment','All TB Adolescent (10-19 yrs) and Moved to Secondline treatment','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n All TB Adolescent (10-19 yrs) and Moved to Secondline treatment\n All TB Adolescent (10-19 yrs) and Moved to Secondline treatment\n \n 2023-04-03 21:34:49 UTC\n \n 2023-04-03 21:37:16 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2159\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:34:49',4,'2023-04-03 23:37:16',4,0,NULL,NULL,NULL,'fc47f473-d8f7-4b44-b969-4aee12de4036'),(2160,'HHCM - Not Evaluated','HHCM - Not Evaluated','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM - Not Evaluated\n HHCM - Not Evaluated\n \n 2023-04-03 21:37:03 UTC\n \n 2023-04-03 21:42:22 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2160\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:37:03',4,'2023-04-03 23:42:22',4,0,NULL,NULL,NULL,'f801b15a-b96f-491f-a8b5-1fbee8ba9c83'),(2161,'Female and Completed','Female and Completed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Female and Completed\n Female and Completed\n \n 2023-04-03 21:37:55 UTC\n \n 2023-04-03 21:44:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2161\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:37:55',4,'2023-04-03 23:44:21',4,0,NULL,NULL,NULL,'615ab43e-7d60-462d-bab7-3ea00babd032'),(2162,'Female and Cured','Female and Cured','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Female and Cured\n Female and Cured\n \n 2023-04-03 21:38:38 UTC\n \n 2023-04-03 21:46:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2162\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:38:38',4,'2023-04-03 23:46:42',4,0,NULL,NULL,NULL,'807438e3-b735-4310-9e68-24f15521e66d'),(2163,'HHCM - Cured','HHCM - Cured','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM - Cured\n HHCM - Cured\n \n 2023-04-03 21:38:56 UTC\n \n 2023-04-03 21:42:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2163\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:38:56',4,'2023-04-03 23:42:00',4,0,NULL,NULL,NULL,'352d4e3a-8ea5-4848-a515-ea4a3a091d8f'),(2164,'TB Female and Died','TB Female and Died','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Female and Died\n TB Female and Died\n \n 2023-04-03 21:39:57 UTC\n \n 2023-04-03 21:47:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2164\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:39:57',4,'2023-04-03 23:47:30',4,0,NULL,NULL,NULL,'ab84625a-199b-4a80-99b9-9b89c8c02ba4'),(2165,'HHCM - Died','HHCM - Died','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM - Died\n HHCM - Died\n \n 2023-04-03 21:43:38 UTC\n \n 2023-04-03 21:46:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2165\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:43:38',4,'2023-04-03 23:46:59',4,0,NULL,NULL,NULL,'144c7351-4092-442d-ab8d-91cf1d13698c'),(2166,'HHCM - Moved to 2nd line','HHCM - Moved to 2nd line','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHCM - Moved to 2nd line\n HHCM - Moved to 2nd line\n \n 2023-04-03 21:44:32 UTC\n \n 2023-04-03 21:48:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2166\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:44:32',4,'2023-04-03 23:48:15',4,0,NULL,NULL,NULL,'a7391f1f-e1b2-415c-bde5-52d06b5616ad'),(2167,'TB Female and Lost to Follow up','TB Female and Lost to Follow up','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Female and Lost to Follow up\n TB Female and Lost to Follow up\n \n 2023-04-03 21:46:14 UTC\n \n 2023-04-03 21:48:16 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2167\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:46:14',4,'2023-04-03 23:48:16',4,0,NULL,NULL,NULL,'6ad8a1fc-9753-4d52-b40a-68c6c9089141'),(2168,'TB Female and Failed','TB Female and Failed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Female and Failed\n TB Female and Failed\n \n 2023-04-03 21:47:53 UTC\n \n 2023-04-03 21:49:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2168\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:47:53',4,'2023-04-03 23:49:44',4,0,NULL,NULL,NULL,'676800f0-5583-436b-b7ab-815f7d884f96'),(2169,'TB Female and Not Evaluated','TB Female and Not Evaluated','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Female and Not Evaluated\n TB Female and Not Evaluated\n \n 2023-04-03 21:48:58 UTC\n \n 2023-04-03 21:53:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2169\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:48:58',4,'2023-04-03 23:53:30',4,0,NULL,NULL,NULL,'67a2aa65-3b21-45f8-bdba-fe284d683360'),(2170,'TB Female and moved to secondline','TB Female and moved to secondline','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Female and moved to secondline\n TB Female and moved to secondline\n \n 2023-04-03 21:49:27 UTC\n \n 2023-04-03 21:51:19 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2170\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:49:27',4,'2023-04-03 23:51:19',4,0,NULL,NULL,NULL,'eac53c81-f295-41ae-989d-26f66888caae'),(2171,'HHXM - Completed','HHXM - Completed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM - Completed\n HHXM - Completed\n \n 2023-04-03 21:51:36 UTC\n \n 2023-04-03 21:56:49 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2171\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:51:36',4,'2023-04-03 23:56:49',4,0,NULL,NULL,NULL,'558ce9d9-35d7-4d49-8b41-f4c8cc979bdf'),(2172,'HHXM - Cured','HHXM - Cured','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM - Cured\n HHXM - Cured\n \n 2023-04-03 21:51:55 UTC\n \n 2023-04-03 21:57:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2172\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:51:55',4,'2023-04-03 23:57:44',4,0,NULL,NULL,NULL,'56f5154b-cb21-456b-8e13-508a0dc032ff'),(2173,'TB Mine Workers and completed','TB Mine Workers and completed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Mine Workers and completed\n TB Mine Workers and completed\n \n 2023-04-03 21:53:08 UTC\n \n 2023-04-03 21:56:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2173\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:53:08',4,'2023-04-03 23:56:07',4,0,NULL,NULL,NULL,'a54130b0-7643-4865-9a0e-6c70215d3046'),(2174,'TB Mine Workers and cured','TB Mine Workers and cured','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Mine Workers and cured\n TB Mine Workers and cured\n \n 2023-04-03 21:53:49 UTC\n \n 2023-04-03 21:57:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2174\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:53:49',4,'2023-04-03 23:57:45',4,0,NULL,NULL,NULL,'f5957799-79ad-4f08-9a68-c359c4b69ce3'),(2175,'TB Mine Workers and died','TB Mine Workers and died','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Mine Workers and died\n TB Mine Workers and died\n \n 2023-04-03 21:55:02 UTC\n \n 2023-04-03 21:57:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2175\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:55:02',4,'2023-04-03 23:57:23',4,0,NULL,NULL,NULL,'fc3c4c67-738d-403a-9584-bd4a17942c24'),(2176,'HHXM - Died','HHXM - Died','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM - Died\n HHXM - Died\n \n 2023-04-03 21:56:35 UTC\n \n 2023-04-03 21:59:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2176\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:56:35',4,'2023-04-03 23:59:44',4,0,NULL,NULL,NULL,'2aaeab53-7906-480f-a51b-ebc9077a28ac'),(2177,'TB Mine Workers and lost to follow up','TB Mine Workers and lost to follow up','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Mine Workers and lost to follow up\n TB Mine Workers and lost to follow up\n \n 2023-04-03 21:58:16 UTC\n \n 2023-04-03 22:05:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2177\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:58:16',4,'2023-04-04 00:05:17',4,0,NULL,NULL,NULL,'2d37e108-26d4-4c69-aa41-dbcb4298d209'),(2178,'HHXM - Not Evaluated','HHXM - Not Evaluated','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM - Not Evaluated\n HHXM - Not Evaluated\n \n 2023-04-03 21:58:28 UTC\n \n 2023-04-03 22:01:46 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2178\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:58:28',4,'2023-04-04 00:01:46',4,0,NULL,NULL,NULL,'ffa409cc-0ce1-4ca0-9971-e339c3d29f8c'),(2179,'TB Mine Workers and failed','TB Mine Workers and failed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Mine Workers and failed\n TB Mine Workers and failed\n \n 2023-04-03 21:58:31 UTC\n \n 2023-04-03 22:00:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2179\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:58:31',4,'2023-04-04 00:00:58',4,0,NULL,NULL,NULL,'f866bee9-323a-4a71-8e35-94cceaa3550d'),(2180,'TB Mine Workers and not evaluated','TB Mine Workers and not evaluated','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Mine Workers and not evaluated\n TB Mine Workers and not evaluated\n \n 2023-04-03 21:58:52 UTC\n \n 2023-04-03 22:04:47 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2180\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-03 23:58:52',4,'2023-04-04 00:04:47',4,0,NULL,NULL,NULL,'b2a2038e-f629-45ee-8033-f797caa6ac39'),(2181,'HHXM - Lost','HHXM - Lost','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM - Lost\n HHXM - Lost\n \n 2023-04-03 22:00:45 UTC\n \n 2023-04-03 22:04:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2181\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-04 00:00:45',4,'2023-04-04 00:04:15',4,0,NULL,NULL,NULL,'11bcf608-b1dd-492d-ba8a-cd3c9e19748f'),(2182,'HHXM - Failed','HHXM - Failed','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM - Failed\n HHXM - Failed\n \n 2023-04-03 22:01:29 UTC\n \n 2023-04-03 22:11:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2182\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-04 00:01:29',4,'2023-04-04 00:11:06',4,0,NULL,NULL,NULL,'a10dc54c-654e-4f57-9df8-be1b14c50a14'),(2183,'TB Mine Workers and moved to secondline ','TB Mine Workers and moved to secondline ','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Mine Workers and moved to secondline \n TB Mine Workers and moved to secondline \n \n 2023-04-03 22:02:20 UTC\n \n 2023-04-03 22:11:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2183\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${endDate}\n \n \n \n','2023-04-04 00:02:20',4,'2023-04-04 00:11:10',4,0,NULL,NULL,NULL,'e07ad771-1ec2-4d4a-a085-5433cc94b7de'),(2184,'HHXM - Moved to 2nd Line','HHXM - Moved to 2nd Line','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HHXM - Moved to 2nd Line\n HHXM - Moved to 2nd Line\n \n 2023-04-03 22:03:46 UTC\n \n 2023-04-03 22:08:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2184\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-04-04 00:03:46',4,'2023-04-04 00:08:51',4,0,NULL,NULL,NULL,'b12d1160-3ba1-4b39-92b9-e765d0d9fe55'),(2185,'TB Treatment Outcome - Block 1','TB Treatment Outcome - Block 1','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Treatment Outcome - Block 1\n TB Treatment Outcome - Block 1\n \n 2023-04-03 22:07:23 UTC\n \n 2023-04-03 22:07:54 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2185\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-04-04 00:07:23',4,'2023-04-04 00:07:54',4,0,NULL,NULL,NULL,'a7cfcef1-57f5-4fbc-8a24-77fac2b219bf'),(2186,'TB Treatment Outcome - Block 1 Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n TB Treatment Outcome - Block 1 Data Set\n \n 2023-04-03 22:07:54 UTC\n \n 2023-04-04 12:21:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2186\n \n \n \n Fmale2nd\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n \n \n FmaleComp\n \n \n \n \n \n \n \n \n \n FmaleCured\n \n \n \n \n \n \n \n \n \n FmaleDied\n \n \n \n \n \n \n \n \n \n FmaleFaile\n \n \n \n \n \n \n \n \n \n FmaleLost\n \n \n \n \n \n \n \n \n \n FmaleNtEv\n \n \n \n \n \n \n \n \n \n Miner2nd\n \n \n \n \n \n \n \n \n \n MinerComp\n \n \n \n \n \n \n \n \n \n MinerCured\n \n \n \n \n \n \n \n \n \n MinerDied\n \n \n \n \n \n \n \n \n \n MinerFail\n \n \n \n \n \n \n \n \n \n MinerLost\n \n \n \n \n \n \n \n \n \n MinerNtEv\n \n \n \n \n \n \n \n \n \n NwRlps2nd\n \n \n \n \n \n \n \n \n \n NwRlpsComp\n \n \n \n \n \n \n \n \n \n NwRlpsCure\n \n \n \n \n \n \n \n \n \n NwRlpsDied\n \n \n \n \n \n \n \n \n \n NwRlpsLost\n \n \n \n \n \n \n \n \n \n NwRlpsNtEv\n \n \n \n \n \n \n \n \n \n NwRlpsfail\n \n \n \n \n \n \n \n \n \n RtrtEx2nd\n \n \n \n \n \n \n \n \n \n RtrtExComp\n \n \n \n \n \n \n \n \n \n RtrtExCure\n \n \n \n \n \n \n \n \n \n RtrtExDied\n \n \n \n \n \n \n \n \n \n RtrtExFail\n \n \n \n \n \n \n \n \n \n RtrtExLost\n \n \n \n \n \n \n \n \n \n RtrtExNtEv\n \n \n \n \n \n \n \n \n \n TBAdol2nd\n \n \n \n \n \n \n \n \n \n TBAdolComp\n \n \n \n \n \n \n \n \n \n TBAdolCure\n \n \n \n \n \n \n \n \n \n TBAdolDied\n \n \n \n \n \n \n \n \n \n TBAdolFail\n \n \n \n \n \n \n \n \n \n TBAdolLost\n \n \n \n \n \n \n \n \n \n TBAdolNtEv\n \n \n \n \n \n \n \n \n \n TBChld2nd\n \n \n \n \n \n \n \n \n \n TBChldCure\n \n \n \n \n \n \n \n \n \n TBChldDied\n \n \n \n \n \n \n \n \n \n TBChldFail\n \n \n \n \n \n \n \n \n \n TBChldLost\n \n \n \n \n \n \n \n \n \n TBChldNtEv\n \n \n \n \n \n \n \n \n \n TBNeg2nd\n \n \n \n \n \n \n \n \n \n TBNegCompl\n \n \n \n \n \n \n \n \n \n TBNegCured\n \n \n \n \n \n \n \n \n \n TBNegDied\n \n \n \n \n \n \n \n \n \n TBNegFaile\n \n \n \n \n \n \n \n \n \n TBNegLost\n \n \n \n \n \n \n \n \n \n TBNegNtEv\n \n \n \n \n \n \n \n \n \n TBPos2nd\n \n \n \n \n \n \n \n \n \n TBPosCompl\n \n \n \n \n \n \n \n \n \n TBPosCured\n \n \n \n \n \n \n \n \n \n TBPosDied\n \n \n \n \n \n \n \n \n \n TBPosFaile\n \n \n \n \n \n \n \n \n \n TBPosLost\n \n \n \n \n \n \n \n \n \n TBPosNtEv\n \n \n \n \n \n \n \n \n \n TbChldComp\n \n \n \n \n \n \n \n \n \n exM_comple\n \n \n \n \n \n \n \n \n \n exM_cured\n \n \n \n \n \n \n \n \n \n exM_died\n \n \n \n \n \n \n \n \n \n exM_failed\n \n \n \n \n \n \n \n \n \n exM_lost\n \n \n \n \n \n \n \n \n \n exM_moved\n \n \n \n \n \n \n \n \n \n exM_noteEv\n \n \n \n \n \n \n \n \n \n fact_Died\n \n \n \n \n \n \n \n \n \n fact_compl\n \n \n \n \n \n \n \n \n \n fact_cured\n \n \n \n \n \n \n fact_fail\n \n \n \n \n \n \n \n \n \n fact_lost\n \n \n \n \n \n \n \n \n \n fact_moved\n \n \n \n \n \n \n \n \n \n fact_notEv\n \n \n \n \n \n \n \n \n \n hcw_comple\n \n \n \n \n \n \n \n \n \n hcw_cured\n \n \n \n \n \n \n \n \n \n hcw_died\n \n \n \n \n \n \n \n \n \n hcw_failed\n \n \n \n \n \n \n \n \n \n hcw_lost\n \n \n \n \n \n \n \n \n \n hcw_moved\n \n \n \n \n \n \n \n \n \n hcw_notEva\n \n \n \n \n \n \n \n \n \n hhcm_compl\n \n \n \n \n \n \n \n \n \n hhcm_cured\n \n \n \n \n \n \n \n \n \n hhcm_died\n \n \n \n \n \n \n \n \n \n hhcm_evalu\n \n \n \n \n \n \n \n \n \n hhcm_faile\n \n \n \n \n \n \n \n \n \n hhcm_lost\n \n \n \n \n \n \n \n \n \n hhcm_moved\n \n \n \n \n \n \n \n \n \n hhx_comple\n \n \n \n \n \n \n \n \n \n hhxm_cured\n \n \n \n \n \n \n \n \n \n hhxm_died\n \n \n \n \n \n \n \n \n \n hhxm_faile\n \n \n \n \n \n \n \n \n \n hhxm_lost\n \n \n \n \n \n \n \n \n \n hhxm_moved\n \n \n \n \n \n \n \n \n \n hhxm_notEv\n \n \n \n \n \n \n \n \n \n ptran_comp\n \n \n \n \n \n \n \n \n \n ptran_cure\n \n \n \n \n \n \n \n \n \n ptran_died\n \n \n \n \n \n \n \n \n \n ptran_eval\n \n \n \n \n \n \n \n \n \n ptran_fail\n \n \n \n \n \n \n \n \n \n ptran_lost\n \n \n \n \n \n \n \n \n \n ptran_move\n \n \n \n \n \n \n \n \n \n','2023-04-04 00:07:54',4,'2023-04-04 14:21:10',4,0,NULL,NULL,NULL,'71fbb539-96d9-420c-9b3c-1edeab07e722'),(2187,'Children ARV Regimen_1stLine_4C','Children ARV Regimen_1stLine_Regimen disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4C\n Children ARV Regimen_1stLine_Regimen disaggregated by weight, sex, age\n \n 2023-07-26 13:30:34 UTC\n \n 2023-07-26 13:32:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2187\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-07-26 13:30:34',4,'2023-07-26 13:32:50',4,0,NULL,NULL,NULL,'f97eba59-b593-4225-8140-5bbe62c4a836'),(2188,'Children ARV Regimen_1stLine_4D','Children ARV Regimen_1stLine_4D disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4D\n Children ARV Regimen_1stLine_4D disaggregated by weight, sex, age\n \n 2023-07-26 13:30:39 UTC\n \n 2023-07-27 13:48:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2188\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-07-26 15:30:39',4,'2023-07-27 15:48:06',4,0,NULL,NULL,NULL,'f0f167bb-dc9e-4121-9ceb-a2268861062f'),(2189,'Children ARV Regimen_1stLine_Transition Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_Transition Data Set\n \n 2023-07-26 13:31:12 UTC\n \n 2023-08-14 12:41:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2189\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4>=35\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4y10-13\n \n \n \n \n \n \n \n \n \n F1-4y14-19\n \n \n \n \n \n \n \n \n \n F1-4y20-24\n \n \n \n \n \n \n \n \n \n F1-4y25-34\n \n \n \n \n \n \n \n \n \n F1-4yr0-3\n \n \n \n \n \n \n \n \n \n F1-4yr4-5\n \n \n \n \n \n \n \n \n \n F1-4yr6-9\n \n \n \n \n \n \n \n \n \n F10-14y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14y10-\n \n \n \n \n \n \n F10-14y14-\n \n \n \n \n \n \n F10-14y20-\n \n \n \n \n \n \n F10-14y25-\n \n \n \n \n \n \n F10-14y4-5\n \n \n \n \n \n \n F10-14y6-9\n \n \n \n \n \n \n F10-14y>=3\n \n \n \n \n \n \n F5-9y10-13\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9y14-19\n \n \n \n \n \n \n F5-9y20-24\n \n \n \n \n \n \n F5-9y25-34\n \n \n \n \n \n \n F5-9y>=35\n \n \n \n \n \n \n F5-9yr0-3\n \n \n \n \n \n \n F5-9yr4-5\n \n \n \n \n \n \n F5-9yr6-9\n \n \n \n \n \n \n F<1y10-13\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1y14-19\n \n \n \n \n \n \n F<1y20-24\n \n \n \n \n \n \n F<1y25-34\n \n \n \n \n \n \n F<1y>=35\n \n \n \n \n \n \n F<1yr0-3\n \n \n \n \n \n \n F<1yr4-5\n \n \n \n \n \n \n F<1yr6-9\n \n \n \n \n \n \n M1-4y10-13\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4y14-19\n \n \n \n \n \n \n M1-4y20-24\n \n \n \n \n \n \n M1-4y25-34\n \n \n \n \n \n \n M1-4y>=35\n \n \n \n \n \n \n M1-4yr0-3\n \n \n \n \n \n \n M1-4yr4-5\n \n \n \n \n \n \n M1-4yr6-9\n \n \n \n \n \n \n M10-14y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14y10-\n \n \n \n \n \n \n M10-14y14-\n \n \n \n \n \n \n M10-14y20-\n \n \n \n \n \n \n M10-14y25-\n \n \n \n \n \n \n M10-14y4-5\n \n \n \n \n \n \n M10-14y6-9\n \n \n \n \n \n \n M10-14y>=3\n \n \n \n \n \n \n M5-9y10-13\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9y14-19\n \n \n \n \n \n \n M5-9y20-24\n \n \n \n \n \n \n M5-9y25-34\n \n \n \n \n \n \n M5-9y>=35\n \n \n \n \n \n \n M5-9yr0-3\n \n \n \n \n \n \n M5-9yr4-5\n \n \n \n \n \n \n M5-9yr6-9\n \n \n \n \n \n \n M<1y14-19\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1y20-24\n \n \n \n \n \n \n M<1y25-34\n \n \n \n \n \n \n M<1y>=35\n \n \n \n \n \n \n M<1yr0-3\n \n \n \n \n \n \n M<1yr10-13\n \n \n \n \n \n \n M<1yr4-5\n \n \n \n \n \n \n M<1yr6-9\n \n \n \n \n \n \n','2023-07-26 13:31:12',4,'2023-08-14 12:41:44',4,0,NULL,NULL,NULL,'da04bec0-be82-45a6-9136-716f46837537'),(2190,'Children ARV Regimen_1stLine_Transition Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_Transition Data Set\n \n 2023-07-26 13:31:22 UTC\n \n 2023-08-14 13:10:49 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2190\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4yr0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4yr10-1\n \n \n \n \n \n \n \n \n \n F1-4yr14-1\n \n \n \n \n \n \n \n \n \n F1-4yr20-2\n \n \n \n \n \n \n \n \n \n F1-4yr25-3\n \n \n \n \n \n \n \n \n \n F1-4yr4-5\n \n \n \n \n \n \n \n \n \n F1-4yr6-9\n \n \n \n \n \n \n \n \n \n F1-4yr>=35\n \n \n \n \n \n \n \n \n \n F10-14yr0-\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14yr10\n \n \n \n \n \n \n F10-14yr14\n \n \n \n \n \n \n F10-14yr20\n \n \n \n \n \n \n F10-14yr25\n \n \n \n \n \n \n F10-14yr35\n \n \n \n \n \n \n F10-14yr4-\n \n \n \n \n \n \n F10-14yr6-\n \n \n \n \n \n \n F5-9yr0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9yr10-1\n \n \n \n \n \n \n F5-9yr14-1\n \n \n \n \n \n \n F5-9yr20-2\n \n \n \n \n \n \n F5-9yr25-3\n \n \n \n \n \n \n F5-9yr4-5\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9yr6-9\n \n \n \n \n \n \n F5-9yr>=35\n \n \n \n \n \n \n F<1yr0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1yr10-13\n \n \n \n \n \n \n F<1yr14-19\n \n \n \n \n \n \n F<1yr20-14\n \n \n \n \n \n \n F<1yr25-34\n \n \n \n \n \n \n F<1yr4-5\n \n \n \n \n \n \n F<1yr6-9\n \n \n \n \n \n \n F<1yr>=35\n \n \n \n \n \n \n M1-4yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4yr10-1\n \n \n \n \n \n \n M1-4yr14-1\n \n \n \n \n \n \n M1-4yr20-2\n \n \n \n \n \n \n M1-4yr25-3\n \n \n \n \n \n \n M1-4yr4-5\n \n \n \n \n \n \n M1-4yr6-9\n \n \n \n \n \n \n M1-4yr>=35\n \n \n \n \n \n \n M10-14yr0-\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14yr10\n \n \n \n \n \n \n M10-14yr14\n \n \n \n \n \n \n M10-14yr20\n \n \n \n \n \n \n M10-14yr25\n \n \n \n \n \n \n M10-14yr35\n \n \n \n \n \n \n M10-14yr4-\n \n \n \n \n \n \n M10-14yr6-\n \n \n \n \n \n \n M5-9yr0-3\n \n \n \n \n \n \n M5-9yr10-1\n \n \n \n \n \n \n M5-9yr14-1\n \n \n \n \n \n \n M5-9yr20-2\n \n \n \n \n \n \n M5-9yr25-3\n \n \n \n \n \n \n M5-9yr4-5\n \n \n \n \n \n \n M5-9yr6-9\n \n \n \n \n \n \n M5-9yr>=35\n \n \n \n \n \n \n M<1yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1yr10-13\n \n \n \n \n \n \n M<1yr14-19\n \n \n \n \n \n \n M<1yr20-24\n \n \n \n \n \n \n M<1yr25-34\n \n \n \n \n \n \n M<1yr4-5\n \n \n \n \n \n \n M<1yr6-9\n \n \n \n \n \n \n M<1yr>=35\n \n \n \n \n \n \n','2023-07-26 13:31:22',4,'2023-08-14 13:10:49',4,0,NULL,NULL,NULL,'5de7def7-e11b-404b-b30a-1dd8dab09558'),(2191,'Children ARV Regimen_1stLine_4E','Children ARV Regimen_1stLine_4E','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4E\n Children ARV Regimen_1stLine_4E\n \n 2023-07-28 07:21:30 UTC\n \n 2023-07-28 07:21:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2191\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-07-28 09:21:30',4,'2023-07-28 09:21:51',4,0,NULL,NULL,NULL,'e3824d29-b132-4875-b0a9-b5dea1536b22'),(2192,'Children ARV Regimen_1stLine_4E Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4E Data Set\n \n 2023-07-28 07:21:51 UTC\n \n 2023-08-14 15:40:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2192\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4y0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4y10-13\n \n \n \n \n \n \n \n \n \n F1-4y14-19\n \n \n \n \n \n \n \n \n \n F1-4y20-24\n \n \n \n \n \n \n \n \n \n F1-4y25-34\n \n \n \n \n \n \n \n \n \n F1-4y35>=\n \n \n \n \n \n \n \n \n \n F1-4y4-5\n \n \n \n \n \n \n \n \n \n F1-4y6-9\n \n \n \n \n \n \n \n \n \n F10-14y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14y10-\n \n \n \n \n \n \n F10-14y14-\n \n \n \n \n \n \n F10-14y20-\n \n \n \n \n \n \n F10-14y25-\n \n \n \n \n \n \n F10-14y35>\n \n \n \n \n \n \n F10-14y4-5\n \n \n \n \n \n \n F10-14y6-9\n \n \n \n \n \n \n F5-9y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9y10-13\n \n \n \n \n \n \n F5-9y14-19\n \n \n \n \n \n \n F5-9y20-24\n \n \n \n \n \n \n F5-9y25-34\n \n \n \n \n \n \n F5-9y35>=\n \n \n \n \n \n \n F5-9y4-5\n \n \n \n \n \n \n F5-9y6-9\n \n \n \n \n \n \n F<1y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1y10-13\n \n \n \n \n \n \n F<1y14-19\n \n \n \n \n \n \n F<1y20-24\n \n \n \n \n \n \n F<1y25-34\n \n \n \n \n \n \n F<1y35>=\n \n \n \n \n \n \n F<1y4-5\n \n \n \n \n \n \n F<1y6-9\n \n \n \n \n \n \n M1-4Y25-34\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4y0-3\n \n \n \n \n \n \n M1-4y10-13\n \n \n \n \n \n \n M1-4y14-19\n \n \n \n \n \n \n M1-4y20-24\n \n \n \n \n \n \n M1-4y35>=\n \n \n \n \n \n \n M1-4y4-5\n \n \n \n \n \n \n M1-4y6-9\n \n \n \n \n \n \n M10-14y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14y10-\n \n \n \n \n \n \n M10-14y14-\n \n \n \n \n \n \n M10-14y20-\n \n \n \n \n \n \n M10-14y25-\n \n \n \n \n \n \n M10-14y35>\n \n \n \n \n \n \n M10-14y4-5\n \n \n \n \n \n \n M10-14y6-9\n \n \n \n \n \n \n M5-9y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9y10-13\n \n \n \n \n \n \n M5-9y14-19\n \n \n \n \n \n \n M5-9y20-24\n \n \n \n \n \n \n M5-9y25-34\n \n \n \n \n \n \n M5-9y35>=\n \n \n \n \n \n \n M5-9y4-5\n \n \n \n \n \n \n M5-9y6-9\n \n \n \n \n \n \n M<1y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1y10-13\n \n \n \n \n \n \n M<1y14-19\n \n \n \n \n \n \n M<1y20-24\n \n \n \n \n \n \n M<1y25-34\n \n \n \n \n \n \n M<1y35>=\n \n \n \n \n \n \n M<1y4-5\n \n \n \n \n \n \n M<1y6-9\n \n \n \n \n \n \n','2023-07-28 07:21:51',4,'2023-08-14 15:40:40',4,0,NULL,NULL,NULL,'27162fa8-89a6-405a-b3c2-d79250d1fa72'),(2194,'Children ARV Regimen_1stLine_4E Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4E Data Set\n \n 2023-07-28 07:29:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n \n \n','2023-07-28 09:29:51',4,NULL,NULL,0,NULL,NULL,NULL,'4c11a721-c504-4075-a7aa-68b823c3d7cb'),(2196,'Children ARV Regimen_1stLine_4F','Children ARV Regimen_1stLine_4F disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4F\n Children ARV Regimen_1stLine_4F disaggregated by weight, sex, age\n \n 2023-07-28 07:58:35 UTC\n \n 2023-07-28 07:59:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2196\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-07-28 09:58:35',4,'2023-07-28 09:59:11',4,0,NULL,NULL,NULL,'0ee0e4f3-4bf0-43ee-be59-cb45d9ab0328'),(2197,'Children ARV Regimen_1stLine_4F Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4F Data Set\n \n 2023-07-28 07:59:11 UTC\n \n 2023-08-14 16:08:09 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2197\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4>=35\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4y0-3\n \n \n \n \n \n \n \n \n \n F1-4y10-13\n \n \n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F1-4y14-19\n \n \n \n \n \n \n \n \n \n F1-4y20-24\n \n \n \n \n \n \n \n \n \n F1-4y25-34\n \n \n \n \n \n \n \n \n \n F1-4y4-5\n \n \n \n \n \n \n \n \n \n F1-4y6-9\n \n \n \n \n \n \n \n \n \n F10-14y0-3\n \n \n \n \n \n \n F10-14y10-\n \n \n \n \n \n \n F10-14y14-\n \n \n \n \n \n \n F10-14y20-\n \n \n \n \n \n \n F10-14y25-\n \n \n \n \n \n \n F10-14y4-5\n \n \n \n \n \n \n F10-14y6-9\n \n \n \n \n \n \n F10-14y>=3\n \n \n \n \n \n \n F5-9y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9y10-13\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9y14-19\n \n \n \n \n \n \n F5-9y20-24\n \n \n \n \n \n \n F5-9y25-34\n \n \n \n \n \n \n F5-9y4-5\n \n \n \n \n \n \n F5-9y6-9\n \n \n \n \n \n \n F5-9y>=35\n \n \n \n \n \n \n F<1y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1y10-13\n \n \n \n \n \n \n F<1y14-19\n \n \n \n \n \n \n F<1y20-24\n \n \n \n \n \n \n F<1y25-34\n \n \n \n \n \n \n F<1y4-5\n \n \n \n \n \n \n F<1y6-9\n \n \n \n \n \n \n F<1y>=35\n \n \n \n \n \n \n M1-4y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4y10-13\n \n \n \n \n \n \n M1-4y14-19\n \n \n \n \n \n \n M1-4y20-24\n \n \n \n \n \n \n M1-4y25-34\n \n \n \n \n \n \n M1-4y4-5\n \n \n \n \n \n \n M1-4y6-9\n \n \n \n \n \n \n M1-4y>=35\n \n \n \n \n \n \n M10-14y\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14y0-3\n \n \n \n \n \n \n M10-14y10-\n \n \n \n \n \n \n M10-14y14-\n \n \n \n \n \n \n M10-14y25-\n \n \n \n \n \n \n M10-14y4-5\n \n \n \n \n \n \n M10-14y6-9\n \n \n \n \n \n \n M10-14y>=3\n \n \n \n \n \n \n M5-9y0-3\n \n \n \n \n \n \n M5-9y10-13\n \n \n \n \n \n \n M5-9y14-19\n \n \n \n \n \n \n M5-9y20-24\n \n \n \n \n \n \n M5-9y25-34\n \n \n \n \n \n \n M5-9y4-5\n \n \n \n \n \n \n M5-9y6-9\n \n \n \n \n \n \n M5-9y>=35\n \n \n \n \n \n \n M<1y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1y10-13\n \n \n \n \n \n \n M<1y14-19\n \n \n \n \n \n \n M<1y20-24\n \n \n \n \n \n \n M<1y25-34\n \n \n \n \n \n \n M<1y4-5\n \n \n \n \n \n \n M<1y6-9\n \n \n \n \n \n \n M<1y>=35\n \n \n \n \n \n \n','2023-07-28 07:59:11',4,'2023-08-14 16:08:09',4,0,NULL,NULL,NULL,'88a32f53-ea23-4ad9-9673-98bde635a960'),(2198,'Children ARV Regimen_1stLine_4G','Children ARV Regimen_1stLine_4G','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4G\n Children ARV Regimen_1stLine_4G\n \n 2023-07-28 10:06:07 UTC\n \n 2023-07-28 10:06:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2198\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-07-28 12:06:07',4,'2023-07-28 12:06:18',4,0,NULL,NULL,NULL,'0827caea-7bbc-4d28-b47d-e04cebd43d96'),(2199,'Children ARV Regimen_1stLine_4G Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4G Data Set\n \n 2023-07-28 10:06:18 UTC\n \n 2023-08-14 16:22:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2199\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4y0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4y10-13\n \n \n \n \n \n \n \n \n \n F1-4y14-19\n \n \n \n \n \n \n \n \n \n F1-4y20-24\n \n \n \n \n \n \n \n \n \n F1-4y25-34\n \n \n \n \n \n \n \n \n \n F1-4y35>=\n \n \n \n \n \n \n \n \n \n F1-4y4-5\n \n \n \n \n \n \n \n \n \n F1-4y6-9\n \n \n \n \n \n \n \n \n \n F10-14y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14y10-\n \n \n \n \n \n \n F10-14y14-\n \n \n \n \n \n \n F10-14y20-\n \n \n \n \n \n \n F10-14y25-\n \n \n \n \n \n \n F10-14y35>\n \n \n \n \n \n \n F10-14y4-5\n \n \n \n \n \n \n F10-14y6-9\n \n \n \n \n \n \n F5-9y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9y10-13\n \n \n \n \n \n \n F5-9y14-19\n \n \n \n \n \n \n F5-9y20-24\n \n \n \n \n \n \n F5-9y25-34\n \n \n \n \n \n \n F5-9y35>=\n \n \n \n \n \n \n F5-9y4-5\n \n \n \n \n \n \n F5-9y6-9\n \n \n \n \n \n \n F<1y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1y10-13\n \n \n \n \n \n \n F<1y14-19\n \n \n \n \n \n \n F<1y20-24\n \n \n \n \n \n \n F<1y25-34\n \n \n \n \n \n \n F<1y35>=\n \n \n \n \n \n \n F<1y4-5\n \n \n \n \n \n \n F<1y6-9\n \n \n \n \n \n \n M1-4y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4y10-13\n \n \n \n \n \n \n M1-4y14-19\n \n \n \n \n \n \n M1-4y20-24\n \n \n \n \n \n \n M1-4y25-34\n \n \n \n \n \n \n M1-4y35>=\n \n \n \n \n \n \n M1-4y4-5\n \n \n \n \n \n \n M1-4y6-9\n \n \n \n \n \n \n M10-14y-25\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14y0-3\n \n \n \n \n \n \n M10-14y10-\n \n \n \n \n \n \n M10-14y14-\n \n \n \n \n \n \n M10-14y20-\n \n \n \n \n \n \n M10-14y35>\n \n \n \n \n \n \n M10-14y4-5\n \n \n \n \n \n \n M10-14y6-9\n \n \n \n \n \n \n M5-9y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9y10-13\n \n \n \n \n \n \n M5-9y14-19\n \n \n \n \n \n \n M5-9y20-24\n \n \n \n \n \n \n M5-9y25-34\n \n \n \n \n \n \n M5-9y35>=\n \n \n \n \n \n \n M5-9y4-5\n \n \n \n \n \n \n M5-9y6-9\n \n \n \n \n \n \n M<1y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1y10-13\n \n \n \n \n \n \n M<1y14-19\n \n \n \n \n \n \n M<1y20-24\n \n \n \n \n \n \n M<1y24-34\n \n \n \n \n \n \n M<1y35>=\n \n \n \n \n \n \n M<1y4-5\n \n \n \n \n \n \n M<1y6-9\n \n \n \n \n \n \n','2023-07-28 10:06:18',4,'2023-08-14 16:22:43',4,0,NULL,NULL,NULL,'f61713b8-60c1-48f1-bab8-d0bf3046b3e1'),(2200,'Children ARV Regimen_1stLine_4H','Children ARV Regimen_1stLine_4H','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4H\n Children ARV Regimen_1stLine_4H\n \n 2023-07-28 10:19:42 UTC\n \n 2023-07-28 10:19:49 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2200\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-07-28 12:19:42',4,'2023-07-28 12:19:49',4,0,NULL,NULL,NULL,'f672b96f-7df9-48fa-b49e-a9946b7540e8'),(2201,'Children ARV Regimen_1stLine_4H Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4H Data Set\n \n 2023-07-28 10:19:49 UTC\n \n 2023-08-14 16:43:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2201\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4yr0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4yr10-1\n \n \n \n \n \n \n \n \n \n F1-4yr14-1\n \n \n \n \n \n \n \n \n \n F1-4yr20-2\n \n \n \n \n \n \n \n \n \n F1-4yr25-3\n \n \n \n \n \n \n \n \n \n F1-4yr4-5\n \n \n \n \n \n \n \n \n \n F1-4yr6-9\n \n \n \n \n \n \n \n \n \n F1-4yr>=35\n \n \n \n \n \n \n \n \n \n F10-14yr0-\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14yr10\n \n \n \n \n \n \n F10-14yr14\n \n \n \n \n \n \n F10-14yr20\n \n \n \n \n \n \n F10-14yr25\n \n \n \n \n \n \n F10-14yr35\n \n \n \n \n \n \n F10-14yr4-\n \n \n \n \n \n \n F10-14yr6-\n \n \n \n \n \n \n F5-9yr0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9yr10-1\n \n \n \n \n \n \n F5-9yr14-1\n \n \n \n \n \n \n F5-9yr20-2\n \n \n \n \n \n \n F5-9yr25-3\n \n \n \n \n \n \n F5-9yr4-5\n \n \n \n \n \n \n F5-9yr6-9\n \n \n \n \n \n \n F5-9yr>=35\n \n \n \n \n \n \n F<1yr0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1yr10-13\n \n \n \n \n \n \n F<1yr14-19\n \n \n \n \n \n \n F<1yr20-24\n \n \n \n \n \n \n F<1yr25-34\n \n \n \n \n \n \n F<1yr4-5\n \n \n \n \n \n \n F<1yr6-9\n \n \n \n \n \n \n F<1yr>=35\n \n \n \n \n \n \n M1-4yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4yr10-1\n \n \n \n \n \n \n M1-4yr14-1\n \n \n \n \n \n \n M1-4yr20-2\n \n \n \n \n \n \n M1-4yr25-3\n \n \n \n \n \n \n M1-4yr4-5\n \n \n \n \n \n \n M1-4yr6-9\n \n \n \n \n \n \n M1-4yr>=35\n \n \n \n \n \n \n M10-14yr0-\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14yr10\n \n \n \n \n \n \n M10-14yr14\n \n \n \n \n \n \n M10-14yr20\n \n \n \n \n \n \n M10-14yr25\n \n \n \n \n \n \n M10-14yr35\n \n \n \n \n \n \n M10-14yr4-\n \n \n \n \n \n \n M10-14yr6-\n \n \n \n \n \n \n M5-9yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9yr10-1\n \n \n \n \n \n \n M5-9yr14-1\n \n \n \n \n \n \n M5-9yr20-2\n \n \n \n \n \n \n M5-9yr25-3\n \n \n \n \n \n \n M5-9yr4-5\n \n \n \n \n \n \n M5-9yr6-9\n \n \n \n \n \n \n M5-9yr>=35\n \n \n \n \n \n \n M<1yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1yr10-13\n \n \n \n \n \n \n M<1yr14-19\n \n \n \n \n \n \n M<1yr20-24\n \n \n \n \n \n \n M<1yr25-34\n \n \n \n \n \n \n M<1yr4-5\n \n \n \n \n \n \n M<1yr6-9\n \n \n \n \n \n \n M<1yr>=35\n \n \n \n \n \n \n','2023-07-28 10:19:49',4,'2023-08-14 16:43:42',4,0,NULL,NULL,NULL,'014c9e79-d8d0-4226-8d86-869e879fb6ce'),(2202,'Children ARV Regimen_1stLine_4J',' Children ARV Regimen_1stLine_4J disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4J\n Children ARV Regimen_1stLine_4J disaggregated by weight, sex, age\n \n 2023-07-28 10:40:17 UTC\n \n 2023-07-28 10:40:24 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2202\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-07-28 12:40:17',4,'2023-07-28 12:40:24',4,0,NULL,NULL,NULL,'4390ec11-9cbe-42bd-888e-e681da953912'),(2203,'Children ARV Regimen_1stLine_4J Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4J Data Set\n \n 2023-07-28 10:40:24 UTC\n \n 2023-08-14 17:17:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2203\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4y0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4y10-13\n \n \n \n \n \n \n \n \n \n F1-4y14-19\n \n \n \n \n \n \n \n \n \n F1-4y20-24\n \n \n \n \n \n \n \n \n \n F1-4y25-34\n \n \n \n \n \n \n \n \n \n F1-4y35>=\n \n \n \n \n \n \n \n \n \n F1-4y4-5\n \n \n \n \n \n \n \n \n \n F1-4y6-9\n \n \n \n \n \n \n \n \n \n F10-14y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14y10-\n \n \n \n \n \n \n F10-14y14-\n \n \n \n \n \n \n F10-14y20-\n \n \n \n \n \n \n F10-14y25-\n \n \n \n \n \n \n F10-14y35>\n \n \n \n \n \n \n F10-14y4-5\n \n \n \n \n \n \n F10-14y6-9\n \n \n \n \n \n \n F5-9y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9y10-13\n \n \n \n \n \n \n F5-9y14-19\n \n \n \n \n \n \n F5-9y20-24\n \n \n \n \n \n \n F5-9y25-34\n \n \n \n \n \n \n F5-9y35>=\n \n \n \n \n \n \n F5-9y4-5\n \n \n \n \n \n \n F5-9y6-9\n \n \n \n \n \n \n F<1y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1y10-13\n \n \n \n \n \n \n F<1y14-19\n \n \n \n \n \n \n F<1y20-24\n \n \n \n \n \n \n F<1y25-34\n \n \n \n \n \n \n F<1y35>=\n \n \n \n \n \n \n F<1y6-9\n \n \n \n \n \n \n F<1yr4-5\n \n \n \n \n \n \n M1-4y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4y10-13\n \n \n \n \n \n \n M1-4y14-19\n \n \n \n \n \n \n M1-4y20-24\n \n \n \n \n \n \n M1-4y25-34\n \n \n \n \n \n \n M1-4y35>=\n \n \n \n \n \n \n M1-4y4-5\n \n \n \n \n \n \n M1-4y6-9\n \n \n \n \n \n \n M10-14y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14y10-\n \n \n \n \n \n \n M10-14y14-\n \n \n \n \n \n \n M10-14y20-\n \n \n \n \n \n \n M10-14y25-\n \n \n \n \n \n \n M10-14y35>\n \n \n \n \n \n \n M10-14y4-5\n \n \n \n \n \n \n M10-14y6-9\n \n \n \n \n \n \n M5-9y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9y10-13\n \n \n \n \n \n \n M5-9y14-19\n \n \n \n \n \n \n M5-9y20-24\n \n \n \n \n \n \n M5-9y25-34\n \n \n \n \n \n \n M5-9y35>=\n \n \n \n \n \n \n M5-9y4-5\n \n \n \n \n \n \n M5-9y6-9\n \n \n \n \n \n \n M<1y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1y10-13\n \n \n \n \n \n \n M<1y14-19\n \n \n \n \n \n \n M<1y20-24\n \n \n \n \n \n \n M<1y25-34\n \n \n \n \n \n \n M<1y35>=\n \n \n \n \n \n \n M<1y6-9\n \n \n \n \n \n \n M<1yr4-5\n \n \n \n \n \n \n','2023-07-28 10:40:24',4,'2023-08-14 17:17:03',4,0,NULL,NULL,NULL,'b1b5ff26-4220-44b4-856e-88b7e9d39451'),(2204,'Children ARV Regimen_1stLine_4K','Children ARV Regimen_1stLine_4K disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4K\n Children ARV Regimen_1stLine_4K disaggregated by weight, sex, age\n \n 2023-07-31 11:04:52 UTC\n \n 2023-07-31 11:04:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2204\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-07-31 13:04:52',4,'2023-07-31 13:04:59',4,0,NULL,NULL,NULL,'635157c8-9203-475c-bc08-998a880fa244'),(2205,'Children ARV Regimen_1stLine_4K Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4K Data Set\n \n 2023-07-31 11:04:59 UTC\n \n 2023-08-14 17:30:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2205\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4>=35\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4y0-3\n \n \n \n \n \n \n \n \n \n F1-4y10-13\n \n \n \n \n \n \n \n \n \n F1-4y14-19\n \n \n \n \n \n \n \n \n \n F1-4y20-24\n \n \n \n \n \n \n \n \n \n F1-4y25-34\n \n \n \n \n \n \n \n \n \n F1-4y4-5\n \n \n \n \n \n \n \n \n \n F1-4y6-9\n \n \n \n \n \n \n \n \n \n F10-14y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14y10-\n \n \n \n \n \n \n F10-14y14-\n \n \n \n \n \n \n F10-14y20-\n \n \n \n \n \n \n F10-14y25-\n \n \n \n \n \n \n F10-14y4-5\n \n \n \n \n \n \n F10-14y6-9\n \n \n \n \n \n \n F10-14y>=3\n \n \n \n \n \n \n F5-9y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9y10-13\n \n \n \n \n \n \n F5-9y14-19\n \n \n \n \n \n \n F5-9y20-24\n \n \n \n \n \n \n F5-9y25-34\n \n \n \n \n \n \n F5-9y4-5\n \n \n \n \n \n \n F5-9y6-9\n \n \n \n \n \n \n F5-9y>=35\n \n \n \n \n \n \n F<1y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1y10-13\n \n \n \n \n \n \n F<1y14-19\n \n \n \n \n \n \n F<1y20-24\n \n \n \n \n \n \n F<1y25-34\n \n \n \n \n \n \n F<1y4-5\n \n \n \n \n \n \n F<1y6-9\n \n \n \n \n \n \n F<1y>=35\n \n \n \n \n \n \n M1-4y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4y10-13\n \n \n \n \n \n \n M1-4y14-19\n \n \n \n \n \n \n M1-4y20-24\n \n \n \n \n \n \n M1-4y25-34\n \n \n \n \n \n \n M1-4y4-5\n \n \n \n \n \n \n M1-4y6-9\n \n \n \n \n \n \n M1-4y>=35\n \n \n \n \n \n \n M10-14y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14y10-\n \n \n \n \n \n \n M10-14y14-\n \n \n \n \n \n \n M10-14y20-\n \n \n \n \n \n \n M10-14y25-\n \n \n \n \n \n \n M10-14y4-5\n \n \n \n \n \n \n M10-14y6-9\n \n \n \n \n \n \n M10-14y>=3\n \n \n \n \n \n \n M5-9y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9y10-13\n \n \n \n \n \n \n M5-9y14-19\n \n \n \n \n \n \n M5-9y20-24\n \n \n \n \n \n \n M5-9y25-34\n \n \n \n \n \n \n M5-9y4-5\n \n \n \n \n \n \n M5-9y6-9\n \n \n \n \n \n \n M5-9y>=35\n \n \n \n \n \n \n M<1y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1y10-13\n \n \n \n \n \n \n M<1y14-19\n \n \n \n \n \n \n M<1y20-24\n \n \n \n \n \n \n M<1y25-34\n \n \n \n \n \n \n M<1y4-5\n \n \n \n \n \n \n M<1y6-9\n \n \n \n \n \n \n M<1y>=35\n \n \n \n \n \n \n','2023-07-31 11:04:59',4,'2023-08-14 17:30:12',4,0,NULL,NULL,NULL,'a3a4b9a1-0d71-4c08-9e4e-486f87840b6e'),(2206,'Children ARV Regimen_1stLine_4L','Children ARV Regimen_1stLine_4L','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4L\n Children ARV Regimen_1stLine_4L\n \n 2023-07-31 11:19:07 UTC\n \n 2023-07-31 11:19:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2206\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-07-31 13:19:07',4,'2023-07-31 13:19:14',4,0,NULL,NULL,NULL,'646bc981-856b-4f66-b545-eb5843952af7'),(2207,'Children ARV Regimen_1stLine_4L Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4L Data Set\n \n 2023-07-31 11:19:14 UTC\n \n 2023-08-14 17:43:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2207\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4yr0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4yr10-1\n \n \n \n \n \n \n \n \n \n F1-4yr14-1\n \n \n \n \n \n \n \n \n \n F1-4yr20-2\n \n \n \n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4yr25-3\n \n \n \n \n \n \n \n \n \n F1-4yr4-5\n \n \n \n \n \n \n \n \n \n F1-4yr6-9\n \n \n \n \n \n \n \n \n \n F1-4yr>=35\n \n \n \n \n \n \n \n \n \n F10-14yr0-\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14yr10\n \n \n \n \n \n \n F10-14yr14\n \n \n \n \n \n \n F10-14yr20\n \n \n \n \n \n \n F10-14yr25\n \n \n \n \n \n \n F10-14yr35\n \n \n \n \n \n \n F10-14yr4-\n \n \n \n \n \n \n F10-14yr6-\n \n \n \n \n \n \n F5-9yr0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9yr10-1\n \n \n \n \n \n \n F5-9yr14-1\n \n \n \n \n \n \n F5-9yr20-2\n \n \n \n \n \n \n F5-9yr25-3\n \n \n \n \n \n \n F5-9yr4-5\n \n \n \n \n \n \n F5-9yr6-9\n \n \n \n \n \n \n F5-9yr>=35\n \n \n \n \n \n \n F<1yr0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1yr10-13\n \n \n \n \n \n \n F<1yr14-19\n \n \n \n \n \n \n F<1yr20-24\n \n \n \n \n \n \n F<1yr25-34\n \n \n \n \n \n \n F<1yr4-5\n \n \n \n \n \n \n F<1yr6-9\n \n \n \n \n \n \n F<1yr>=35\n \n \n \n \n \n \n M1-4yr0-3\n \n \n \n \n \n \n M1-4yr10-1\n \n \n \n \n \n \n M1-4yr14-1\n \n \n \n \n \n \n M1-4yr20-2\n \n \n \n \n \n \n M1-4yr25-3\n \n \n \n \n \n \n M1-4yr4-5\n \n \n \n \n \n \n M1-4yr6-9\n \n \n \n \n \n \n M1-4yr>=35\n \n \n \n \n \n \n M10-14yr0-\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14yr10\n \n \n \n \n \n \n M10-14yr14\n \n \n \n \n \n \n M10-14yr20\n \n \n \n \n \n \n M10-14yr25\n \n \n \n \n \n \n M10-14yr35\n \n \n \n \n \n \n M10-14yr4-\n \n \n \n \n \n \n M10-14yr6-\n \n \n \n \n \n \n M5-9yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9yr10-1\n \n \n \n \n \n \n M5-9yr14-1\n \n \n \n \n \n \n M5-9yr20-2\n \n \n \n \n \n \n M5-9yr25-3\n \n \n \n \n \n \n M5-9yr4-5\n \n \n \n \n \n \n M5-9yr6-9\n \n \n \n \n \n \n M5-9yr>=35\n \n \n \n \n \n \n M<1yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1yr10-13\n \n \n \n \n \n \n M<1yr14-19\n \n \n \n \n \n \n M<1yr20-24\n \n \n \n \n \n \n M<1yr25-34\n \n \n \n \n \n \n M<1yr4-5\n \n \n \n \n \n \n M<1yr6-9\n \n \n \n \n \n \n M<1yr>=35\n \n \n \n \n \n \n','2023-07-31 11:19:14',4,'2023-08-14 17:43:21',4,0,NULL,NULL,NULL,'f228bb0b-0af6-48b3-afeb-8b1e4e21feb3'),(2208,'Clients given 4C with >=20 copies viral load','Clients given 4C with >=20 copies viral load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C with >=20 copies viral load\n Clients given 4C with >=20 copies viral load\n \n 2023-08-07 11:49:27 UTC\n \n 2023-08-14 11:19:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2208\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2202)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \n \n \non Active_Patients.Id = greaterThan20.Id \n)) \n \n\n','2023-08-07 11:49:27',4,'2023-08-14 11:19:55',4,0,NULL,NULL,NULL,'5a765ffd-b4ff-4899-ba79-aae76385d5d9'),(2209,'Clients given 4C with >=20 copies viral load','Clients given 4C with >=20 copies viral load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C with >=20 copies viral load\n Clients given 4C with >=20 copies viral load\n \n 2023-08-07 14:15:14 UTC\n \n 2023-08-07 14:18:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2209\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 16:15:14',4,'2023-08-07 16:18:06',4,0,NULL,NULL,NULL,'6942c194-b069-44c3-a161-b77891d7f06c'),(2210,'Children ARV Regimen_1stLine_Viral_Load','Children ARV Regimen_1stLine_Viral_Load','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_Viral_Load\n Children ARV Regimen_1stLine_Viral_Load\n \n 2023-08-07 14:19:54 UTC\n \n 2023-08-08 20:10:19 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2210\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-07 16:19:54',4,'2023-08-08 22:10:19',4,0,NULL,NULL,NULL,'400088e7-a254-4fac-8a59-eac6dc9d177b'),(2211,'Children ARV Regimen_1stLine_4C_>20Copies_Viraload Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_4C_>20Copies_Viraload Data Set\n \n 2023-08-07 14:20:07 UTC\n \n 2023-12-20 07:10:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2211\n \n \n \n 4C<20\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n \n \n 4C>=20\n \n \n \n \n \n \n \n \n \n 4CUndetect\n \n \n \n \n \n \n \n \n \n 4D<20\n \n \n \n \n \n \n \n \n \n 4D>=20\n \n \n \n \n \n \n \n \n \n 4DUndetect\n \n \n \n \n \n \n \n \n \n 4E<20\n \n \n \n \n \n \n \n \n \n 4E>=20\n \n \n \n \n \n \n \n \n \n 4EUndetect\n \n \n \n \n \n \n \n \n \n 4F<20\n \n \n \n \n \n \n \n \n \n 4F>=20\n \n \n \n \n \n \n \n \n \n 4FUndetect\n \n \n \n \n \n \n \n \n \n 4G<20\n \n \n \n \n \n \n \n \n \n 4G>=20\n \n \n \n \n \n \n \n \n \n 4GUndetect\n \n \n \n \n \n \n \n \n \n 4H<20\n \n \n \n \n \n \n \n \n \n 4H>=20\n \n \n \n \n \n \n \n \n \n 4HUndetect\n \n \n \n \n \n \n \n \n \n 4J<20\n \n \n \n \n \n \n \n \n \n 4J>=20\n \n \n \n \n \n \n \n \n \n 4JUndetect\n \n \n \n \n \n \n \n \n \n 4K<20\n \n \n \n \n \n \n \n \n \n 4K>=20\n \n \n \n \n \n \n \n \n \n 4KUndetect\n \n \n \n \n \n \n \n \n \n 4L<20\n \n \n \n \n \n \n \n \n \n 4L>=20\n \n \n \n \n \n \n \n \n \n 4LUndetect\n \n \n \n \n \n \n \n \n \n','2023-08-07 16:20:07',4,'2023-12-20 09:10:01',4,0,NULL,NULL,NULL,'96eef8c5-dc41-4f3f-9e62-4004c11fb291'),(2212,'Clients given 4D with >=20 Copies Viral Load','Clients given 4D with >=20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D with >=20 Copies Viral Load\n Clients given 4D with >=20 Copies Viral Load\n \n 2023-08-07 14:40:38 UTC\n \n 2023-08-14 11:22:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2212\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4d \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2204)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n -- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-07 14:40:38',4,'2023-08-14 11:22:44',4,0,NULL,NULL,NULL,'41de8523-3ab9-4284-a0b1-f0298f2da510'),(2213,'Clients given 4E with >=20 Copies Viral Load','Clients given 4E with >=20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E with >=20 Copies Viral Load\n Clients given 4E with >=20 Copies Viral Load\n \n 2023-08-07 14:50:06 UTC\n \n 2023-08-14 11:23:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2213\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3679)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-07 14:50:06',4,'2023-08-14 11:23:53',4,0,NULL,NULL,NULL,'c1f2fd48-a980-4af6-93f0-08598fd57995'),(2214,'Clients given 4F with >=20 copies viral load','Clients given 4F with >=20 copies viral load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F with >=20 copies viral load\n Clients given 4F with >=20 copies viral load\n \n 2023-08-07 15:02:48 UTC\n \n 2023-08-14 11:29:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2214\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3680)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n -- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-07 15:02:48',4,'2023-08-14 11:29:08',4,0,NULL,NULL,NULL,'1605d858-dca2-4c0d-bb6f-967424aed8ad'),(2215,'Clients given 4H with >=20 Copies Viral Load','Clients given 4H with >=20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H with >=20 Copies Viral Load\n Clients given 4H with >=20 Copies Viral Load\n \n 2023-08-07 15:11:34 UTC\n \n 2023-08-14 11:47:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2215\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4685)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n -- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-07 15:11:34',4,'2023-08-14 11:47:45',4,0,NULL,NULL,NULL,'07781cf0-2cc5-497b-b9a3-dafc63842da1'),(2216,'Clients given 4J with >=20 Copies Viral Load','Clients given 4J weighing >=20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J with >=20 Copies Viral Load\n Clients given 4J weighing >=20 Copies Viral Load\n \n 2023-08-07 15:32:07 UTC\n \n 2023-08-14 11:49:33 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2216\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4J \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-07 15:32:07',4,'2023-08-14 11:49:33',4,0,NULL,NULL,NULL,'180f7359-ac4f-4728-ae43-8208ebf052cb'),(2217,'Clients given 4K with >=20 Copies Viral Load','Clients given 4K with >=20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K with >=20 Copies Viral Load\n Clients given 4K with >=20 Copies Viral Load\n \n 2023-08-07 15:41:37 UTC\n \n 2023-08-14 11:51:49 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2217\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4K \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-07 15:41:37',4,'2023-08-14 11:51:49',4,0,NULL,NULL,NULL,'a5a07716-681f-44bd-84ef-391d51ace7c9'),(2218,'Clients given 4L with >=20 Copies Viral Load','Clients given 4L with >=20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L with >=20 Copies Viral Load\n Clients given 4L with >=20 Copies Viral Load\n \n 2023-08-07 15:45:38 UTC\n \n 2023-12-20 07:15:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2218\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4L \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4688)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n -- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-07 17:45:38',4,'2023-12-20 09:15:07',4,0,NULL,NULL,NULL,'606f20bd-cac9-4282-a3c4-56b9f72ded30'),(2219,'Clients given 4C with <20 copies Viral Load','Clients given 4C with <20 copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C with <20 copies Viral Load\n Clients given 4C with <20 copies Viral Load\n \n 2023-08-07 15:55:07 UTC\n \n 2023-08-14 11:20:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2219\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2202)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-07 15:55:07',4,'2023-08-14 11:20:12',4,0,NULL,NULL,NULL,'5571d546-89fc-4cda-bc4d-fab1f629ce7a'),(2220,'Clients given 4C with Undetectable Viral Load','Clients given 4C with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C with Undetectable Viral Load\n Clients given 4C with Undetectable Viral Load\n \n 2023-08-07 15:57:44 UTC\n \n 2023-08-14 11:19:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2220\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2202)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- undetectable, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-07 15:57:44',4,'2023-08-14 11:19:40',4,0,NULL,NULL,NULL,'eaa0d4ac-c56c-4a8a-b2ca-12a462b06874'),(2221,'Clients given 4D with <20 Copies Viral Load','Clients given 4D with <20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D with <20 Copies Viral Load\n Clients given 4D with <20 Copies Viral Load\n \n 2023-08-07 16:09:50 UTC\n \n 2023-08-14 11:23:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2221\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4d \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2204)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n -- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-07 16:09:50',4,'2023-08-14 11:23:00',4,0,NULL,NULL,NULL,'60e4edc3-d202-4e5c-b9d1-a4791c874209'),(2222,'Clients given 4D with Undetectable Viral Load','Clients given 4D with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D with Undetectable Viral Load\n Clients given 4D with Undetectable Viral Load\n \n 2023-08-07 16:11:59 UTC\n \n 2023-08-14 11:22:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2222\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4d \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2204)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n -- Undetectable Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable Copies \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-07 16:11:59',4,'2023-08-14 11:22:23',4,0,NULL,NULL,NULL,'2da8e7c6-793e-42f3-994a-0dc0e72464ae'),(2223,'Clients given 4E with <20 Copies Viral Load','Clients given 4E with <20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E with <20 Copies Viral Load\n Clients given 4E with <20 Copies Viral Load\n \n 2023-08-07 16:18:03 UTC\n \n 2023-08-14 11:26:22 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2223\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3679)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-07 16:18:03',4,'2023-08-14 11:26:22',4,0,NULL,NULL,NULL,'72e755a7-cbbc-4ccd-be81-7bedf125f8c4'),(2224,'Clients given 4E with Undetectable Viral Load','Clients given 4E with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E with Undetectable Viral Load\n Clients given 4E with Undetectable Viral Load\n \n 2023-08-07 16:20:52 UTC\n \n 2023-08-14 12:07:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2224\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3679)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Undetectable, Viral load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-07 16:20:52',4,'2023-08-14 12:07:26',4,0,NULL,NULL,NULL,'1d7a46e2-8d42-4f34-8958-f5cf962db589'),(2225,'Clients given 4F with <20 copies viral load','Clients given 4F with <20 copies viral load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F with <20 copies viral load\n Clients given 4F with <20 copies viral load\n \n 2023-08-07 16:26:02 UTC\n \n 2023-08-14 11:29:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2225\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3680)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-07 16:26:02',4,'2023-08-14 11:29:28',4,0,NULL,NULL,NULL,'3c193bb3-64d6-4b71-9069-0b53083963e2'),(2226,'Clients given 4F with Undetectable viral load','Clients given 4F with Undetectable copies viral load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F with Undetectable viral load\n Clients given 4F with Undetectable copies viral load\n \n 2023-08-07 16:28:54 UTC\n \n 2023-08-14 11:28:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2226\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3680)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-07 16:28:54',4,'2023-08-14 11:28:42',4,0,NULL,NULL,NULL,'978dc8c8-3f02-4e20-9fb5-302be9fbf23c'),(2227,'Clients given 4G with >=20 Copies Viral Load','Clients given 4G with >=20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G with >=20 Copies Viral Load\n Clients given 4G with >=20 Copies Viral Load\n \n 2023-08-07 16:32:35 UTC\n \n 2023-08-14 11:45:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2227\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4684)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-07 16:32:35',4,'2023-08-14 11:45:02',4,0,NULL,NULL,NULL,'41d9cb1b-b376-4e21-aa6c-7dce59197a97'),(2228,'Clients given 4G with <20 copies Viral_Load','Clients given 4G with <20 copies Viral_Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G with <20 copies Viral_Load\n Clients given 4G with <20 copies Viral_Load\n \n 2023-08-07 16:34:54 UTC\n \n 2023-08-14 11:44:33 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2228\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4684)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-07 16:34:54',4,'2023-08-14 11:44:33',4,0,NULL,NULL,NULL,'80ebb214-6a46-4379-9a31-3e3cbbb05566'); INSERT INTO `serialized_object` VALUES (2229,'Clients given 4G with Undetectable Viral Load','Clients given 4G with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G with Undetectable Viral Load\n Clients given 4G with Undetectable Viral Load\n \n 2023-08-07 16:39:28 UTC\n \n 2023-08-14 11:45:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2229\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4684)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- Undetectable Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable Copies \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-07 16:39:28',4,'2023-08-14 11:45:51',4,0,NULL,NULL,NULL,'d480aafa-578b-4865-bdd4-e158af437b06'),(2230,'Clients given 4H with <20 Copies Viral Load','Clients given 4H with <20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H with <20 Copies Viral Load\n Clients given 4H with <20 Copies Viral Load\n \n 2023-08-07 16:45:29 UTC\n \n 2023-08-14 11:47:21 UTC\n \n \n endDate\n \n java.util.Date\n true\n \n \n startDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2230\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4685)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-07 16:45:29',4,'2023-08-14 11:47:21',4,0,NULL,NULL,NULL,'5c8ddadc-a50e-4433-afb8-48e1acfc3ed5'),(2231,'Clients given 4H with Undetectable Viral Load','Clients given 4H with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H with Undetectable Viral Load\n Clients given 4H with Undetectable Viral Load\n \n 2023-08-07 16:47:28 UTC\n \n 2023-08-14 11:48:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2231\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4685)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- undetectable, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-07 16:47:28',4,'2023-08-14 11:48:07',4,0,NULL,NULL,NULL,'6d85bd5f-af27-43f5-a456-e1679230a4aa'),(2232,'Clients given 4J with <20 copies Viral Load','Clients given 4J with <20 copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J with <20 copies Viral Load\n Clients given 4J with <20 copies Viral Load\n \n 2023-08-07 16:53:00 UTC\n \n 2023-08-14 11:49:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2232\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4J \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-07 16:53:00',4,'2023-08-14 11:49:15',4,0,NULL,NULL,NULL,'1cf1f1b1-2f40-4e5c-b55b-893716cf2a04'),(2233,'Clients given 4J with Undetectable Viral Load','Clients given 4J with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J with Undetectable Viral Load\n Clients given 4J with Undetectable Viral Load\n \n 2023-08-07 16:57:27 UTC\n \n 2023-08-14 11:49:52 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2233\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4J \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- Undetectable, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable Copies \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-07 16:57:27',4,'2023-08-14 11:49:52',4,0,NULL,NULL,NULL,'e543fa69-cbc5-46c8-a3de-e77abcaa185a'),(2234,'Clients given 4K with <20 Copies Viral Load','Clients given 4K with <20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K with <20 Copies Viral Load\n Clients given 4K with <20 Copies Viral Load\n \n 2023-08-07 17:02:35 UTC\n \n 2023-08-14 11:51:25 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2234\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4K \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-07 17:02:35',4,'2023-08-14 11:51:25',4,0,NULL,NULL,NULL,'54121116-3d51-4a34-ae5c-5b15f1254f6e'),(2235,'Clients given 4K with Undetectable Viral Load','Clients given 4K with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K with Undetectable Viral Load\n Clients given 4K with Undetectable Viral Load\n \n 2023-08-07 17:08:26 UTC\n \n 2023-08-14 11:52:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2235\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4K \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Undetectable, Viral load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-07 17:08:26',4,'2023-08-14 11:52:08',4,0,NULL,NULL,NULL,'d2e6acfd-540a-4220-b160-b104be742043'),(2236,'Clients given 4L with <20 Copies Viral Load','Clients given 4L with <20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L with <20 Copies Viral Load\n Clients given 4L with <20 Copies Viral Load\n \n 2023-08-07 17:13:48 UTC\n \n 2023-08-14 11:54:16 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2236\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4L \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4688)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-07 17:13:48',4,'2023-08-14 11:54:16',4,0,NULL,NULL,NULL,'d4e9e456-61f2-4e2d-8779-52e1dd59a11a'),(2237,'Clients given 4L with Undetectable Viral Load','Clients given 4L with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L with Undetectable Viral Load\n Clients given 4L with Undetectable Viral Load\n \n 2023-08-07 17:17:22 UTC\n \n 2023-08-14 12:04:57 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2237\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4K \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4688)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Undetectable, Viral load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-07 17:17:22',4,'2023-08-14 12:04:57',4,0,NULL,NULL,NULL,'4792ce19-a4f6-4876-9a81-a7e48f279b1b'),(2238,'Clients given 4C with <20 copies Viral Load','Clients given 4C with <20 copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C with <20 copies Viral Load\n Clients given 4C with <20 copies Viral Load\n \n 2023-08-07 17:40:01 UTC\n \n 2023-08-07 17:41:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2238\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 19:40:01',4,'2023-08-07 19:41:50',4,0,NULL,NULL,NULL,'523777b6-edc7-4346-abbb-1eec797d6e5c'),(2239,'Clients given 4C with Undetectable Viral_Load','Clients given 4C with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C with Undetectable Viral_Load\n Clients given 4C with Undetectable Viral Load\n \n 2023-08-07 17:45:29 UTC\n \n 2023-08-07 17:54:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2239\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 19:45:29',4,'2023-08-07 19:54:18',4,0,NULL,NULL,NULL,'b3e08e0a-35ac-4b1c-86e2-2dffaa8b6ce6'),(2240,'Clients given 4D with >=20 Copies Viral Load','Clients given 4D with >=20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D with >=20 Copies Viral Load\n Clients given 4D with >=20 Copies Viral Load\n \n 2023-08-07 17:57:17 UTC\n \n 2023-08-07 17:59:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2240\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 19:57:17',4,'2023-08-07 19:59:18',4,0,NULL,NULL,NULL,'06a65347-260a-49f6-b227-e152d369db09'),(2241,'Clients given 4D with < 20 Copies Viral Load','Clients given 4D with < 20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D with < 20 Copies Viral Load\n Clients given 4D with < 20 Copies Viral Load\n \n 2023-08-07 18:00:13 UTC\n \n 2023-08-07 18:01:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2241\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:00:13',4,'2023-08-07 20:01:11',4,0,NULL,NULL,NULL,'849b9ad0-e14d-4e64-8d4d-c90f1ea85d2c'),(2242,'Clients given 4D with Undetectable Viral Load','Clients given 4D with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D with Undetectable Viral Load\n Clients given 4D with Undetectable Viral Load\n \n 2023-08-07 18:02:05 UTC\n \n 2023-08-07 18:02:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2242\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:02:05',4,'2023-08-07 20:02:59',4,0,NULL,NULL,NULL,'269d7cd2-40e5-41a3-9da2-be9e310de73d'),(2243,'Clients given 4E with >=20 Copies Viral Load','Clients given 4E with >=20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E with >=20 Copies Viral Load\n Clients given 4E with >=20 Copies Viral Load\n \n 2023-08-07 18:05:06 UTC\n \n 2023-08-07 18:06:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2243\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:05:06',4,'2023-08-07 20:06:12',4,0,NULL,NULL,NULL,'deaade8d-fa75-4774-9422-2379319a59b2'),(2244,'Clients given 4E with <20 Copies Viral Load','Clients given 4E with <20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E with <20 Copies Viral Load\n Clients given 4E with <20 Copies Viral Load\n \n 2023-08-07 18:06:56 UTC\n \n 2023-08-07 18:08:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2244\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:06:56',4,'2023-08-07 20:08:02',4,0,NULL,NULL,NULL,'e0b2f670-7df3-4672-8411-b6d500f5f13d'),(2245,'Clients given 4E with Undetectable Viral Load','Clients given 4E with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E with Undetectable Viral Load\n Clients given 4E with Undetectable Viral Load\n \n 2023-08-07 18:08:42 UTC\n \n 2023-08-07 18:10:35 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2245\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:08:42',4,'2023-08-07 20:10:35',4,0,NULL,NULL,NULL,'ada290e9-0105-4579-843e-a66c38a30845'),(2246,'Clients given 4F with >=20 copies viral load','Clients given 4F with >=20 copies viral load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F with >=20 copies viral load\n Clients given 4F with >=20 copies viral load\n \n 2023-08-07 18:12:14 UTC\n \n 2023-08-07 18:12:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2246\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:12:14',4,'2023-08-07 20:12:59',4,0,NULL,NULL,NULL,'2755008d-c58f-4cf7-b3fb-879cb0055625'),(2247,'Clients given 4F with <20 copies Viral Load','Clients given 4F with <20 copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F with <20 copies Viral Load\n Clients given 4F with <20 copies Viral Load\n \n 2023-08-07 18:13:57 UTC\n \n 2023-08-07 18:15:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2247\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:13:57',4,'2023-08-07 20:15:02',4,0,NULL,NULL,NULL,'5fd4b692-7c21-4e41-80e5-143ee6c04385'),(2248,'Clients given 4F with Undetectable Viral Load','Clients given 4F with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F with Undetectable Viral Load\n Clients given 4F with Undetectable Viral Load\n \n 2023-08-07 18:15:52 UTC\n \n 2023-08-07 18:16:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2248\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:15:52',4,'2023-08-07 20:16:55',4,0,NULL,NULL,NULL,'9aae30ff-90c2-4228-b4a1-0aedf7354802'),(2249,'Clients given 4G with >=20 Copies Viral Load','Clients given 4G with >=20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G with >=20 Copies Viral Load\n Clients given 4G with >=20 Copies Viral Load\n \n 2023-08-07 18:18:32 UTC\n \n 2023-08-07 18:20:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2249\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:18:32',4,'2023-08-07 20:20:58',4,0,NULL,NULL,NULL,'a602c987-a1c2-486d-93e8-2efb6a3d06d6'),(2250,'Clients given 4G with <20 copies Viral Load','Clients given 4G with <20 copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G with <20 copies Viral Load\n Clients given 4G with <20 copies Viral Load\n \n 2023-08-07 18:21:47 UTC\n \n 2023-08-07 18:23:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2250\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:21:47',4,'2023-08-07 20:23:21',4,0,NULL,NULL,NULL,'6cec76ef-5466-4efe-970d-f7b76ed79e1e'),(2251,'Clients given 4G with Undetectable Viral Load','Clients given 4G with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G with Undetectable Viral Load\n Clients given 4G with Undetectable Viral Load\n \n 2023-08-07 18:24:19 UTC\n \n 2023-08-07 18:25:25 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2251\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:24:19',4,'2023-08-07 20:25:25',4,0,NULL,NULL,NULL,'ef8cbe9f-0742-4531-8dbe-1efbfc9c807a'),(2252,'Clients given 4H with >=20 Copies Viral Load','Clients given 4H with >=20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H with >=20 Copies Viral Load\n Clients given 4H with >=20 Copies Viral Load\n \n 2023-08-07 18:26:08 UTC\n \n 2023-08-07 18:27:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2252\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:26:08',4,'2023-08-07 20:27:36',4,0,NULL,NULL,NULL,'f374ad0c-24ca-460e-8ed4-812fcdbb8b30'),(2253,'Clients given 4H weighing <20 Copies Viral Load','Clients given 4H weighing <20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H weighing <20 Copies Viral Load\n Clients given 4H weighing <20 Copies Viral Load\n \n 2023-08-07 18:32:51 UTC\n \n 2023-08-07 18:34:47 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2253\n COUNT\n \n \n \n \n endDate\n ${startDate}\n \n \n location\n ${location}\n \n \n startDate\n ${endDate}\n \n \n \n','2023-08-07 20:32:51',4,'2023-08-07 20:34:47',4,0,NULL,NULL,NULL,'981353f5-77cf-4e9e-b418-96ba27b38c0d'),(2254,'Clients given 4H with Undetectable Viral Load','Clients given 4H with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H with Undetectable Viral Load\n Clients given 4H with Undetectable Viral Load\n \n 2023-08-07 18:35:38 UTC\n \n 2023-08-07 18:36:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2254\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:35:38',4,'2023-08-07 20:36:30',4,0,NULL,NULL,NULL,'3cff4201-9093-4de5-a526-4c714a0e4b75'),(2255,'Clients given 4J weighing >=20 Copies Viral Load','Clients given 4J weighing >=20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J weighing >=20 Copies Viral Load\n Clients given 4J weighing >=20 Copies Viral Load\n \n 2023-08-07 18:37:43 UTC\n \n 2023-08-07 18:38:52 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2255\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:37:43',4,'2023-08-07 20:38:52',4,0,NULL,NULL,NULL,'ccd5a99e-b517-45c0-864c-d3c6f4ef6701'),(2256,'Clients given 4J with <20 copies Viral Load','Clients given 4J with <20 copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J with <20 copies Viral Load\n Clients given 4J with <20 copies Viral Load\n \n 2023-08-07 18:40:26 UTC\n \n 2023-08-07 18:41:37 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2256\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:40:26',4,'2023-08-07 20:41:37',4,0,NULL,NULL,NULL,'99531929-455a-4092-b2e9-48993920a7b3'),(2257,'Clients given 4J with Undetectable Viral Load','Clients given 4J with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J with Undetectable Viral Load\n Clients given 4J with Undetectable Viral Load\n \n 2023-08-07 18:42:19 UTC\n \n 2023-08-07 18:45:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2257\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:42:19',4,'2023-08-07 20:45:10',4,0,NULL,NULL,NULL,'059ea6c5-c8bf-42ba-abbf-50b8bd27f0e1'),(2258,'Clients given 4K with >=20 Copies Viral Load','Clients given 4K with >=20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K with >=20 Copies Viral Load\n Clients given 4K with >=20 Copies Viral Load\n \n 2023-08-07 18:46:10 UTC\n \n 2023-08-07 18:47:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2258\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:46:10',4,'2023-08-07 20:47:00',4,0,NULL,NULL,NULL,'4d992a61-8cc5-4846-afd1-605e939b3f6e'),(2259,'Clients given 4K with <20 Copies Viral Load','Clients given 4K with <20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K with <20 Copies Viral Load\n Clients given 4K with <20 Copies Viral Load\n \n 2023-08-07 18:48:35 UTC\n \n 2023-08-08 10:02:48 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2259\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:48:35',4,'2023-08-08 12:02:48',4,0,NULL,NULL,NULL,'a1388a42-9e0b-4057-9343-515ab7744a3a'),(2260,'Clients given 4K with Undetectable Viral Load','Clients given 4K with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K with Undetectable Viral Load\n Clients given 4K with Undetectable Viral Load\n \n 2023-08-07 18:50:00 UTC\n \n 2023-08-07 18:50:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2260\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:50:00',4,'2023-08-07 20:50:42',4,0,NULL,NULL,NULL,'50081155-8d33-4ece-ad03-825e8f26f54b'),(2261,'Clients given 4L with >=20 Copies Viral Load','Clients given 4L with >=20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L with >=20 Copies Viral Load\n Clients given 4L with >=20 Copies Viral Load\n \n 2023-08-07 18:51:33 UTC\n \n 2023-12-20 07:08:34 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2261\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:51:33',4,'2023-12-20 09:08:34',4,0,NULL,NULL,NULL,'44e7920f-d834-4397-ba46-342d70d2d351'),(2262,'Clients given 4L with <20 Copies Viral Load','Clients given 4L with <20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L with <20 Copies Viral Load\n Clients given 4L with <20 Copies Viral Load\n \n 2023-08-07 18:54:15 UTC\n \n 2023-08-07 18:54:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2262\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:54:15',4,'2023-08-07 20:54:59',4,0,NULL,NULL,NULL,'a46689e8-87db-4b2e-b627-fa3a695e9e49'),(2263,'Clients given 4L with Undetectable Viral Load','Clients given 4L with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L with Undetectable Viral Load\n Clients given 4L with Undetectable Viral Load\n \n 2023-08-07 18:55:39 UTC\n \n 2023-08-07 18:56:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2263\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-07 20:55:39',4,'2023-08-07 20:56:21',4,0,NULL,NULL,NULL,'38640382-c5f2-4174-b4b6-e05863aea4b8'),(2264,'Clients given 4C with good adherence','Clients given 4C with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C with good adherence\n Clients given 4C with good adherence\n \n 2023-08-09 09:38:59 UTC\n \n 2023-08-14 10:41:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2264\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2202)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-09 09:38:59',4,'2023-08-14 10:41:15',4,0,NULL,NULL,NULL,'80eda8e4-4432-4308-92bc-9c4a6d5835ba'),(2265,'Clients given 4D with good adherence','Clients given 4D with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D with good adherence\n Clients given 4D with good adherence\n \n 2023-08-09 09:40:40 UTC\n \n 2023-08-14 10:43:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2265\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4D \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2204)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-09 09:40:40',4,'2023-08-14 10:43:07',4,0,NULL,NULL,NULL,'50e6ed7b-8da6-420e-b00d-c5a7a6e8e618'),(2266,'Clients given 4E with good adherence','Clients given 4E with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E with good adherence\n Clients given 4E with good adherence\n \n 2023-08-09 09:40:58 UTC\n \n 2023-08-14 10:45:49 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2266\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3679)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-09 09:40:58',4,'2023-08-14 10:45:49',4,0,NULL,NULL,NULL,'c9adbf40-4d5f-4ca4-b388-4a4ee5c16f3e'),(2267,'Clients given 4F with good adherence','Clients given 4F with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F with good adherence\n Clients given 4F with good adherence\n \n 2023-08-09 09:49:16 UTC\n \n 2023-08-14 10:57:13 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2267\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3680)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-09 09:49:16',4,'2023-08-14 10:57:13',4,0,NULL,NULL,NULL,'691b7d00-855b-4869-8938-9502f8762962'),(2268,'Clients given 4G with good adherence','Clients given 4G with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G with good adherence\n Clients given 4G with good adherence\n \n 2023-08-09 09:49:37 UTC\n \n 2023-08-14 10:58:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2268\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4684)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-09 09:49:37',4,'2023-08-14 10:58:30',4,0,NULL,NULL,NULL,'d0f8da5f-e6aa-44af-9980-cd882429e8ac'),(2269,'Clients given 4H with good adherence','Clients given 4H with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H with good adherence\n Clients given 4H with good adherence\n \n 2023-08-09 09:49:55 UTC\n \n 2023-08-14 11:00:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2269\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4685)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-09 09:49:55',4,'2023-08-14 11:00:32',4,0,NULL,NULL,NULL,'90332338-8e76-4563-a7f1-f3f67ffa8f3b'),(2270,'Clients given 4J with good adherence','Clients given 4J with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J with good adherence\n Clients given 4J with good adherence\n \n 2023-08-09 09:54:49 UTC\n \n 2023-08-14 11:09:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2270\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4J \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-09 09:54:49',4,'2023-08-14 11:09:02',4,0,NULL,NULL,NULL,'888d3fd4-ad2c-4e7e-b07f-8c68a08ed1f4'),(2271,'Clients given 4K with good adherence','Clients given 4K with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K with good adherence\n Clients given 4K with good adherence\n \n 2023-08-09 09:55:07 UTC\n \n 2023-08-14 11:10:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2271\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4K \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-09 09:55:07',4,'2023-08-14 11:10:40',4,0,NULL,NULL,NULL,'def70332-aae8-450d-8e78-2b3f83574bc9'),(2272,'Clients given 4L with good adherence','Clients given 4L with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L with good adherence\n Clients given 4L with good adherence\n \n 2023-08-09 09:55:23 UTC\n \n 2023-08-14 11:14:33 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2272\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4L \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4688)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-09 09:55:23',4,'2023-08-14 11:14:33',4,0,NULL,NULL,NULL,'7d1751a3-47c6-406a-a631-90ed96f37660'),(2273,'clients given 4C with fair adherence','clients given 4C with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n clients given 4C with fair adherence\n clients given 4C with fair adherence\n \n 2023-08-09 10:04:32 UTC\n \n 2023-08-14 10:40:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2273\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2202)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-09 10:04:32',4,'2023-08-14 10:40:15',4,0,NULL,NULL,NULL,'15494d8b-bc16-4865-8561-a0f11bb906f5'),(2274,'clients given 4D with fair adherence','clients given 4D with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n clients given 4D with fair adherence\n clients given 4D with fair adherence\n \n 2023-08-09 10:04:52 UTC\n \n 2023-08-14 10:42:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2274\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4D \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2204)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-09 10:04:52',4,'2023-08-14 10:42:43',4,0,NULL,NULL,NULL,'3076328f-0cf6-496f-bcfc-ec00585bf8f7'),(2275,'clients given 4E with fair adherence','clients given 4E with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n clients given 4E with fair adherence\n clients given 4E with fair adherence\n \n 2023-08-09 10:05:09 UTC\n \n 2023-08-14 10:45:35 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2275\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3679)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-09 10:05:09',4,'2023-08-14 10:45:35',4,0,NULL,NULL,NULL,'8c441fe9-1c2f-4eba-9e14-3c13b7d0e22d'),(2276,'clients given 4F with fair adherence','clients given 4F with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n clients given 4F with fair adherence\n clients given 4F with fair adherence\n \n 2023-08-09 10:08:17 UTC\n \n 2023-08-14 10:56:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2276\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3680)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-09 10:08:17',4,'2023-08-14 10:56:58',4,0,NULL,NULL,NULL,'cb6f6a66-39fa-4584-8ad9-397be4e8acc0'),(2277,'clients given 4G with fair adherence','clients given 4G with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n clients given 4G with fair adherence\n clients given 4G with fair adherence\n \n 2023-08-09 10:09:12 UTC\n \n 2023-08-14 10:58:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2277\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4684)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-09 10:09:12',4,'2023-08-14 10:58:17',4,0,NULL,NULL,NULL,'456a7189-4a16-40fa-9702-abf6b2e8b707'),(2278,'Clients given 4H with fair adherence','Clients given 4H with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H with fair adherence\n Clients given 4H with fair adherence\n \n 2023-08-09 10:10:29 UTC\n \n 2023-08-14 11:00:09 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2278\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4685)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-09 10:10:29',4,'2023-08-14 11:00:09',4,0,NULL,NULL,NULL,'3cb85e60-1a5e-422c-b0af-fc15c8ba62ed'),(2279,'Clients given 4K with fair adherence','Clients given 4K with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K with fair adherence\n Clients given 4K with fair adherence\n \n 2023-08-09 10:17:56 UTC\n \n 2023-08-14 11:10:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2279\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4K \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-09 10:17:56',4,'2023-08-14 11:10:04',4,0,NULL,NULL,NULL,'cbd5b84d-066f-41a6-bd8b-bc81dc23c99d'),(2280,'Clients given 4J with fair adherence','Clients given 4J with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J with fair adherence\n Clients given 4J with fair adherence\n \n 2023-08-09 10:18:17 UTC\n \n 2023-08-14 11:08:38 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2280\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4J \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-09 10:18:17',4,'2023-08-14 11:08:38',4,0,NULL,NULL,NULL,'14b826bd-9709-497b-a02d-8fa8d4146faa'),(2281,'Clients given 4L with fair adherence','Clients given 4L with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L with fair adherence\n Clients given 4L with fair adherence\n \n 2023-08-09 10:21:31 UTC\n \n 2023-08-14 11:14:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2281\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4L \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-09 10:21:31',4,'2023-08-14 11:14:18',4,0,NULL,NULL,NULL,'62b94203-c51d-456f-87a6-dd15791f3d71'),(2282,'Clients given 4C with poor adherence','Clients given 4C with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C with poor adherence\n Clients given 4C with poor adherence\n \n 2023-08-09 10:45:41 UTC\n \n 2023-08-09 10:49:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2282\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 20 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2202)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-09 10:45:41',4,'2023-08-09 10:49:23',4,0,NULL,NULL,NULL,'769d8c15-f519-440d-acaf-e2640e2409bc'),(2283,'Clients given 4D with poor adherence','Clients given 4D with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D with poor adherence\n Clients given 4D with poor adherence\n \n 2023-08-09 10:46:02 UTC\n \n 2023-08-14 10:41:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2283\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4D \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 2204)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-09 10:46:02',4,'2023-08-14 10:41:45',4,0,NULL,NULL,NULL,'f77a67fe-ac10-4c92-ab0c-98a5b4dfd5f1'),(2284,'Clients given 4E with poor adherence','Clients given 4E with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E with poor adherence\n Clients given 4E with poor adherence\n \n 2023-08-09 10:46:19 UTC\n \n 2023-08-14 10:45:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2284\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3679)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-09 10:46:19',4,'2023-08-14 10:45:20',4,0,NULL,NULL,NULL,'2eb584f9-1fbe-4c98-adec-b2feb88933b7'),(2285,'Clients given 4F with poor adherence','Clients given 4F with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F with poor adherence\n Clients given 4F with poor adherence\n \n 2023-08-09 10:50:41 UTC\n \n 2023-08-14 10:57:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2285\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3680)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-09 10:50:41',4,'2023-08-14 10:57:32',4,0,NULL,NULL,NULL,'3c5012df-c0bf-411b-a7d1-da092ade8986'),(2286,'Clients given 4G with poor adherence','Clients given 4G with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G with poor adherence\n Clients given 4G with poor adherence\n \n 2023-08-09 10:50:56 UTC\n \n 2023-08-14 10:58:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2286\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4684)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-09 10:50:56',4,'2023-08-14 10:58:45',4,0,NULL,NULL,NULL,'cdee04fe-950f-4b39-88bf-9736744da52f'),(2287,'Clients given 4H with poor adherence','Clients given 4H with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H with poor adherence\n Clients given 4H with poor adherence\n \n 2023-08-09 10:51:12 UTC\n \n 2023-08-14 11:00:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2287\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4685)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-09 10:51:12',4,'2023-08-14 11:00:59',4,0,NULL,NULL,NULL,'9a9175d4-c8ad-439e-b484-edb2345816ad'),(2288,'Clients given 4L with poor adherence','Clients given 4L with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L with poor adherence\n Clients given 4L with poor adherence\n \n 2023-08-09 10:55:46 UTC\n \n 2023-08-14 11:14:48 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2288\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4L \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4688)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-09 10:55:46',4,'2023-08-14 11:14:48',4,0,NULL,NULL,NULL,'5b38ffa0-ea56-4cda-b3cf-03d1b83e7889'),(2289,'Clients given 4K with poor adherence','Clients given 4K with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K with poor adherence\n Clients given 4K with poor adherence\n \n 2023-08-09 10:56:07 UTC\n \n 2023-08-14 11:10:52 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2289\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4K \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-09 10:56:07',4,'2023-08-14 11:10:52',4,0,NULL,NULL,NULL,'1c393c0d-a2e3-4223-9b24-848d235e7a19'),(2290,'Clients given 4J with poor adherence','Clients given 4J with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J with poor adherence\n Clients given 4J with poor adherence\n \n 2023-08-09 10:56:28 UTC\n \n 2023-08-14 11:09:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2290\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 4J \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-09 10:56:28',4,'2023-08-14 11:09:18',4,0,NULL,NULL,NULL,'47569cef-3b90-4fbf-9558-b7a4afb195ab'),(2291,'Children ARV Regimen_1stLine_Adherence','Children ARV Regimen_1stLine_Adherence','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_Adherence\n Children ARV Regimen_1stLine_Adherence\n \n 2023-08-09 19:25:53 UTC\n \n 2023-08-09 19:26:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2291\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-09 19:25:53',4,'2023-08-09 19:26:39',4,0,NULL,NULL,NULL,'dcdcb494-6ca6-47a5-aaac-92decc868c82'),(2292,'Children ARV Regimen_1stLine_Adherence Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_Adherence Data Set\n \n 2023-08-09 19:26:39 UTC\n \n 2023-08-10 09:42:22 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2292\n \n \n \n 4C_fair\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n \n \n 4C_good\n \n \n \n \n \n \n \n \n \n 4C_poor\n \n \n \n \n \n \n \n \n \n 4D_fair\n \n \n \n \n \n \n \n \n \n 4D_good\n \n \n \n \n \n \n \n \n \n 4D_poor\n \n \n \n \n \n \n \n \n \n 4E_fair\n \n \n \n \n \n \n \n \n \n 4E_good\n \n \n \n \n \n \n \n \n \n 4E_poor\n \n \n \n \n \n \n \n \n \n 4F_fair\n \n \n \n \n \n \n \n \n \n 4F_good\n \n \n \n \n \n \n \n \n \n 4F_poor\n \n \n \n \n \n \n \n \n \n 4G_fair\n \n \n \n \n \n \n \n \n \n 4G_good\n \n \n \n \n \n \n \n \n \n 4G_poor\n \n \n \n \n \n \n \n \n \n 4H_fair\n \n \n \n \n \n \n \n \n \n 4H_good\n \n \n \n \n \n \n \n \n \n 4H_poor\n \n \n \n \n \n \n \n \n \n 4J_fair\n \n \n \n \n \n \n \n \n \n 4J_good\n \n \n \n \n \n \n \n \n \n 4J_poor\n \n \n \n \n \n \n \n \n \n 4K_fair\n \n \n \n \n \n \n \n \n \n 4K_good\n \n \n \n \n \n \n \n \n \n 4K_poor\n \n \n \n \n \n \n \n \n \n 4L_fair\n \n \n \n \n \n \n \n \n \n 4L_good\n \n \n \n \n \n \n \n \n \n 4L_poor\n \n \n \n \n \n \n \n \n \n','2023-08-09 19:26:39',4,'2023-08-10 09:42:22',4,0,NULL,NULL,NULL,'129f4cce-9154-4509-8649-9b3ed22fe029'),(2293,'Clients given 4C with good adherence','Clients given 4C with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C with good adherence\n Clients given 4C with good adherence\n \n 2023-08-09 19:34:37 UTC\n \n 2023-08-09 19:40:19 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2293\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 19:34:37',4,'2023-08-09 19:40:19',4,0,NULL,NULL,NULL,'9aebf6da-cf9b-45ed-bbdd-861ff4c0fd41'),(2294,'Clients given 4C with fair adherence','Clients given 4C with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C with fair adherence\n Clients given 4C with fair adherence\n \n 2023-08-09 19:34:50 UTC\n \n 2023-08-09 19:39:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2294\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 19:34:50',4,'2023-08-09 19:39:36',4,0,NULL,NULL,NULL,'ae06dd89-8f3d-4448-bab9-212196f1660d'),(2295,'Clients given 4C with poor adherence','Clients given 4C with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4C with poor adherence\n Clients given 4C with poor adherence\n \n 2023-08-09 19:35:01 UTC\n \n 2023-08-09 19:39:57 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2295\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 19:35:01',4,'2023-08-09 19:39:57',4,0,NULL,NULL,NULL,'88e3d929-46c6-4698-b83e-81552c4b0078'),(2296,'Clients given 4D with good adherence','Clients given 4D with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D with good adherence\n Clients given 4D with good adherence\n \n 2023-08-09 19:43:04 UTC\n \n 2023-08-09 19:46:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2296\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 19:43:04',4,'2023-08-09 19:46:08',4,0,NULL,NULL,NULL,'7b0d9987-2436-479b-b186-682878585356'),(2297,'Clients given 4D with fair adherence','Clients given 4D with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D with fair adherence\n Clients given 4D with fair adherence\n \n 2023-08-09 19:43:10 UTC\n \n 2023-08-09 19:46:35 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2297\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 19:43:10',4,'2023-08-09 19:46:35',4,0,NULL,NULL,NULL,'6e70eb0d-55a5-4cc0-b79e-4e80bf25978d'),(2298,'Clients given 4D with poor adherence','Clients given 4D with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D with poor adherence\n Clients given 4D with poor adherence\n \n 2023-08-09 19:43:23 UTC\n \n 2023-08-09 19:47:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2298\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 19:43:23',4,'2023-08-09 19:47:01',4,0,NULL,NULL,NULL,'dde54d37-4aab-443f-9b40-2fe211fc296a'),(2299,'Clients given 4E with good adherence','Clients given 4E with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E with good adherence\n Clients given 4E with good adherence\n \n 2023-08-09 19:47:57 UTC\n \n 2023-08-09 19:52:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2299\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 19:47:57',4,'2023-08-09 19:52:12',4,0,NULL,NULL,NULL,'8572efe5-f3ea-463f-8abf-fe4086a2aaf7'),(2300,'clients given 4E with fair adherence','Clients given 4E with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n clients given 4E with fair adherence\n Clients given 4E with fair adherence\n \n 2023-08-09 19:48:21 UTC\n \n 2023-08-09 19:53:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2300\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 19:48:21',4,'2023-08-09 19:53:51',4,0,NULL,NULL,NULL,'9157aa83-9a8f-4598-933d-06a98e849b9c'),(2301,'Clients given 4E with poor adherence','Clients given 4E with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4E with poor adherence\n Clients given 4E with poor adherence\n \n 2023-08-09 19:49:01 UTC\n \n 2023-08-09 19:54:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2301\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 19:49:01',4,'2023-08-09 19:54:14',4,0,NULL,NULL,NULL,'134c2069-3e31-41df-8845-18839686bfba'),(2302,'Clients given 4F with good adherence','Clients given 4F with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F with good adherence\n Clients given 4F with good adherence\n \n 2023-08-09 19:55:08 UTC\n \n 2023-08-09 19:57:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2302\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 19:55:08',4,'2023-08-09 19:57:55',4,0,NULL,NULL,NULL,'d6358532-78d0-4095-9fcb-edf9bc09f548'),(2303,'clients given 4F with fair adherence','clients given 4F with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n clients given 4F with fair adherence\n clients given 4F with fair adherence\n \n 2023-08-09 19:55:30 UTC\n \n 2023-08-09 19:59:24 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2303\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 19:55:30',4,'2023-08-09 19:59:24',4,0,NULL,NULL,NULL,'25550508-c457-4534-9385-9c35fe182a5e'),(2304,'Clients given 4F with poor adherence','Clients given 4F with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4F with poor adherence\n Clients given 4F with poor adherence\n \n 2023-08-09 19:56:13 UTC\n \n 2023-08-09 19:59:49 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2304\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 19:56:13',4,'2023-08-09 19:59:49',4,0,NULL,NULL,NULL,'de1988bb-4fda-4d70-b77a-569364cb3880'),(2305,'Clients given 4G with good adherence','Clients given 4G with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G with good adherence\n Clients given 4G with good adherence\n \n 2023-08-09 20:00:32 UTC\n \n 2023-08-09 20:04:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2305\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 20:00:32',4,'2023-08-09 20:04:29',4,0,NULL,NULL,NULL,'f15e2c6d-1a13-45c8-b80e-33982967f9ee'),(2306,'Clients given 4G with poor adherence','Clients given 4G with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4G with poor adherence\n Clients given 4G with poor adherence\n \n 2023-08-09 20:01:35 UTC\n \n 2023-08-09 20:05:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2306\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 20:01:35',4,'2023-08-09 20:05:36',4,0,NULL,NULL,NULL,'9b6c2db1-dea2-4afa-b20c-391c4985795c'),(2307,'clients given 4G with fair adherence','clients given 4G with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n clients given 4G with fair adherence\n clients given 4G with fair adherence\n \n 2023-08-09 20:01:43 UTC\n \n 2023-08-09 20:04:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2307\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 20:01:43',4,'2023-08-09 20:04:58',4,0,NULL,NULL,NULL,'b7856cf5-f989-45fd-8da6-f0ba354e3e96'),(2308,'Clients given 4H with good adherence','Clients given 4H with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H with good adherence\n Clients given 4H with good adherence\n \n 2023-08-09 20:06:49 UTC\n \n 2023-08-09 20:10:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2308\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 20:06:49',4,'2023-08-09 20:10:41',4,0,NULL,NULL,NULL,'cfb7a7c6-30e8-4f10-a55b-faff56674767'),(2309,'Clients given 4H with fair adherence','Clients given 4H with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H with fair adherence\n Clients given 4H with fair adherence\n \n 2023-08-09 20:07:01 UTC\n \n 2023-08-09 20:10:57 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2309\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 20:07:01',4,'2023-08-09 20:10:57',4,0,NULL,NULL,NULL,'5df6e5f1-3116-49e6-a896-df143af3004e'),(2310,'Clients given 4H with poor adherence','Clients given 4H with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4H with poor adherence\n Clients given 4H with poor adherence\n \n 2023-08-09 20:07:57 UTC\n \n 2023-08-09 20:13:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2310\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 20:07:57',4,'2023-08-09 20:13:06',4,0,NULL,NULL,NULL,'65132fb3-cc4a-4859-8cbf-2f26ad87c444'),(2311,'Clients given 4J with fair adherence','Clients given 4J with fair adherence\r\n','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J with fair adherence\n Clients given 4J with fair adherence \n\n \n 2023-08-09 20:13:40 UTC\n \n 2023-08-09 20:17:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2311\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 20:13:40',4,'2023-08-09 20:17:28',4,0,NULL,NULL,NULL,'7396bec4-26e5-46ae-9751-217c77d66d44'),(2312,'Clients given 4J with good adherence','Clients given 4J with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J with good adherence\n Clients given 4J with good adherence\n \n 2023-08-09 20:13:48 UTC\n \n 2023-08-09 20:17:09 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2312\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 20:13:48',4,'2023-08-09 20:17:09',4,0,NULL,NULL,NULL,'b7ecce5a-9011-4c8a-a77b-538d579acf4a'),(2313,'Clients given 4J with poor adherence','Clients given 4J with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4J with poor adherence\n Clients given 4J with poor adherence\n \n 2023-08-09 20:14:07 UTC\n \n 2023-08-09 20:17:52 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2313\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 20:14:07',4,'2023-08-09 20:17:52',4,0,NULL,NULL,NULL,'21d68248-3137-4f24-89b3-702c4c86b258'),(2314,'Clients given 4K with good adherence','Clients given 4K with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K with good adherence\n Clients given 4K with good adherence\n \n 2023-08-09 20:19:21 UTC\n \n 2023-08-09 20:22:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2314\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 20:19:21',4,'2023-08-09 20:22:30',4,0,NULL,NULL,NULL,'898b11a3-3876-45bc-a327-207de5a91288'),(2315,'Clients given 4K with fair adherence','Clients given 4K with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K with fair adherence\n Clients given 4K with fair adherence\n \n 2023-08-09 20:19:40 UTC\n \n 2023-08-09 20:23:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2315\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 20:19:40',4,'2023-08-09 20:23:00',4,0,NULL,NULL,NULL,'01cd007c-98e1-4a76-91a3-35dde1c4b25b'),(2316,'Clients given 4K with poor adherence','Clients given 4K with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4K with poor adherence\n Clients given 4K with poor adherence\n \n 2023-08-09 20:20:07 UTC\n \n 2023-08-09 20:23:47 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2316\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 20:20:07',4,'2023-08-09 20:23:47',4,0,NULL,NULL,NULL,'4feeb398-2818-460e-8e2c-3df8a27c5c68'),(2317,'Clients given 4L with good adherence','Clients given 4L with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L with good adherence\n Clients given 4L with good adherence\n \n 2023-08-09 20:25:36 UTC\n \n 2023-08-09 20:29:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2317\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 20:25:36',4,'2023-08-09 20:29:06',4,0,NULL,NULL,NULL,'6f28a61d-320a-49a5-8bf5-fc9e9c68cf5e'),(2318,'Clients given 4L with fair adherence','Clients given 4L with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L with fair adherence\n Clients given 4L with fair adherence\n \n 2023-08-09 20:25:55 UTC\n \n 2023-08-09 20:29:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2318\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 20:25:55',4,'2023-08-09 20:29:26',4,0,NULL,NULL,NULL,'58759e6a-e8d0-4eca-9a01-610e7d2f27c6'),(2319,'Clients given 4L with poor adherence','Clients given 4L with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4L with poor adherence\n Clients given 4L with poor adherence\n \n 2023-08-09 20:26:12 UTC\n \n 2023-08-09 20:29:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2319\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-09 20:26:12',4,'2023-08-09 20:29:45',4,0,NULL,NULL,NULL,'3dfc43b9-8bf9-4833-890a-88876f8da47c'),(2321,'Children ARV Regimen_2ndLine_5A','Children ARV Regimen_2ndLine_5A disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5A\n Children ARV Regimen_2ndLine_5A disaggregated by weight, sex, age\n \n 2023-08-15 17:48:13 UTC\n \n 2023-08-15 19:23:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2321\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-15 19:48:13',4,'2023-08-15 21:23:02',4,0,NULL,NULL,NULL,'37b51d3f-838d-4211-aced-12371e6a7493'),(2322,'Children ARV Regimen_1stLine_5A Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_5A Data Set\n \n 2023-08-15 17:48:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n \n \n','2023-08-15 19:48:21',4,NULL,NULL,0,NULL,NULL,NULL,'6b9d88ee-8215-4be6-89f5-2b6dbec7d979'),(2323,'Children ARV Regimen_1stLine_5A Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_1stLine_5A Data Set\n \n 2023-08-15 17:48:43 UTC\n \n 2023-08-16 10:53:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2323\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4y0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4y10-13\n \n \n \n \n \n \n \n \n \n F1-4y14-19\n \n \n \n \n \n \n \n \n \n F1-4y20-24\n \n \n \n \n \n \n \n \n \n F1-4y25-34\n \n \n \n \n \n \n \n \n \n F1-4y4-5\n \n \n \n \n \n \n \n \n \n F1-4y6-9\n \n \n \n \n \n \n \n \n \n F1-4y>=35\n \n \n \n \n \n \n \n \n \n F10-14y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14y10-\n \n \n \n \n \n \n F10-14y14-\n \n \n \n \n \n \n F10-14y20-\n \n \n \n \n \n \n F10-14y25-\n \n \n \n \n \n \n F10-14y4-5\n \n \n \n \n \n \n F10-14y6-9\n \n \n \n \n \n \n F10-14y>=3\n \n \n \n \n \n \n F5-9y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9y10-13\n \n \n \n \n \n \n F5-9y14-19\n \n \n \n \n \n \n F5-9y20-24\n \n \n \n \n \n \n F5-9y25-34\n \n \n \n \n \n \n F5-9y4-5\n \n \n \n \n \n \n F5-9y6-9\n \n \n \n \n \n \n F5-9y>=35\n \n \n \n \n \n \n F<1y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1y10-13\n \n \n \n \n \n \n F<1y14-19\n \n \n \n \n \n \n F<1y20-24\n \n \n \n \n \n \n F<1y25-34\n \n \n \n \n \n \n F<1y4-5\n \n \n \n \n \n \n F<1y6-9\n \n \n \n \n \n \n F<1y>=35\n \n \n \n \n \n \n M1-4y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4y10-13\n \n \n \n \n \n \n \n \n \n M1-4y14-19\n \n \n \n \n \n \n M1-4y20-24\n \n \n \n \n \n \n M1-4y25-34\n \n \n \n \n \n \n M1-4y4-5\n \n \n \n \n \n \n M1-4y6-9\n \n \n \n \n \n \n M1-4y>=35\n \n \n \n \n \n \n M10-14y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14y10-\n \n \n \n \n \n \n M10-14y14-\n \n \n \n \n \n \n M10-14y20-\n \n \n \n \n \n \n M10-14y25-\n \n \n \n \n \n \n M10-14y4-5\n \n \n \n \n \n \n M10-14y6-9\n \n \n \n \n \n \n M10-14y>=3\n \n \n \n \n \n \n M5-9y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9y10-13\n \n \n \n \n \n \n M5-9y14-19\n \n \n \n \n \n \n M5-9y20-24\n \n \n \n \n \n \n M5-9y25-34\n \n \n \n \n \n \n M5-9y4-5\n \n \n \n \n \n \n M5-9y6-9\n \n \n \n \n \n \n M5-9y>=35\n \n \n \n \n \n \n M<1y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1y10-13\n \n \n \n \n \n \n M<1y14-19\n \n \n \n \n \n \n M<1y20-24\n \n \n \n \n \n \n M<1y25-34\n \n \n \n \n \n \n \n \n \n M<1y4-5\n \n \n \n \n \n \n M<1y6-9\n \n \n \n \n \n \n M<1y>=35\n \n \n \n \n \n \n','2023-08-15 19:48:43',4,'2023-08-16 12:53:15',4,0,NULL,NULL,NULL,'1311fb91-2a90-44c5-876f-0bf0284580f4'),(2324,'Children ARV Regimen_3rdLine_6A','Children ARV Regimen_3rdLine_6A disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_6A\n Children ARV Regimen_3rdLine_6A disaggregated by weight, sex, age\n \n 2023-08-15 19:27:09 UTC\n \n 2023-08-15 19:27:54 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2324\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-15 21:27:09',4,'2023-08-15 21:27:54',4,0,NULL,NULL,NULL,'2478792b-752a-4b20-97f7-5033810e1ba8'),(2325,'Children ARV Regimen_3rdLine_6A Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_6A Data Set\n \n 2023-08-15 19:27:54 UTC\n \n 2023-08-15 21:23:05 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2325\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4yr0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4yr10-1\n \n \n \n \n \n \n \n \n \n F1-4yr14-1\n \n \n \n \n \n \n \n \n \n F1-4yr20-2\n \n \n \n \n \n \n \n \n \n F1-4yr25-3\n \n \n \n \n \n \n \n \n \n F1-4yr4-5\n \n \n \n \n \n \n \n \n \n F1-4yr6-9\n \n \n \n \n \n \n \n \n \n F1-4yr>=35\n \n \n \n \n \n \n \n \n \n F10-14yr0-\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14yr10\n \n \n \n \n \n \n F10-14yr14\n \n \n \n \n \n \n F10-14yr20\n \n \n \n \n \n \n F10-14yr25\n \n \n \n \n \n \n F10-14yr4-\n \n \n \n \n \n \n F10-14yr6\n \n \n \n \n \n \n F10-14yr>=\n \n \n \n \n \n \n F5-9yr0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9yr10-1\n \n \n \n \n \n \n F5-9yr14-1\n \n \n \n \n \n \n F5-9yr20-2\n \n \n \n \n \n \n F5-9yr25-3\n \n \n \n \n \n \n F5-9yr4-5\n \n \n \n \n \n \n F5-9yr6-9\n \n \n \n \n \n \n F5-9yr>=35\n \n \n \n \n \n \n F<1y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1yr10-13\n \n \n \n \n \n \n F<1yr14-19\n \n \n \n \n \n \n F<1yr20-24\n \n \n \n \n \n \n F<1yr25-34\n \n \n \n \n \n \n F<1yr4-5\n \n \n \n \n \n \n F<1yr6-9\n \n \n \n \n \n \n F<1yr>=35\n \n \n \n \n \n \n M1-4yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4yr10-1\n \n \n \n \n \n \n M1-4yr14-1\n \n \n \n \n \n \n M1-4yr20-2\n \n \n \n \n \n \n M1-4yr25-3\n \n \n \n \n \n \n M1-4yr4-5\n \n \n \n \n \n \n M1-4yr6-9\n \n \n \n \n \n \n M1-4yr>=35\n \n \n \n \n \n \n M10-14yr0-\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14yr10\n \n \n \n \n \n \n M10-14yr14\n \n \n \n \n \n \n M10-14yr20\n \n \n \n \n \n \n M10-14yr25\n \n \n \n \n \n \n M10-14yr4-\n \n \n \n \n \n \n M10-14yr6-\n \n \n \n \n \n \n M10-14yr>=\n \n \n \n \n \n \n M5-9yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9yr10-1\n \n \n \n \n \n \n M5-9yr14-1\n \n \n \n \n \n \n M5-9yr20-2\n \n \n \n \n \n \n M5-9yr25-3\n \n \n \n \n \n \n M5-9yr4-5\n \n \n \n \n \n \n M5-9yr6-9\n \n \n \n \n \n \n M5-9yr>=35\n \n \n \n \n \n \n M<1yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1yr10-13\n \n \n \n \n \n \n M<1yr14-19\n \n \n \n \n \n \n M<1yr20-24\n \n \n \n \n \n \n M<1yr25-34\n \n \n \n \n \n \n M<1yr4-5\n \n \n \n \n \n \n M<1yr6-9\n \n \n \n \n \n \n M<1yr>=35\n \n \n \n \n \n \n','2023-08-15 21:27:54',4,'2023-08-15 23:23:05',4,0,NULL,NULL,NULL,'0e0b0b1e-e085-4f4f-af07-c44587b0d8f2'),(2326,'Children ARV Regimen_2ndLine_5B','Children ARV Regimen_2ndLine_5B disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5B\n Children ARV Regimen_2ndLine_5B disaggregated by weight, sex, age\n \n 2023-08-15 19:42:04 UTC\n \n 2023-08-15 19:42:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2326\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-15 21:42:04',4,'2023-08-15 21:42:28',4,0,NULL,NULL,NULL,'85cddf9e-e519-40f9-9df5-e1d36c7c2b27'),(2327,'Children ARV Regimen_2ndLine_5B Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5B Data Set\n \n 2023-08-15 19:42:28 UTC\n \n 2023-08-16 10:02:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2327\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4y0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4y10-13\n \n \n \n \n \n \n \n \n \n F1-4y14-19\n \n \n \n \n \n \n \n \n \n F1-4y20-24\n \n \n \n \n \n \n \n \n \n F1-4y25-34\n \n \n \n \n \n \n \n \n \n F1-4y4-5\n \n \n \n \n \n \n \n \n \n F1-4y6-9\n \n \n \n \n \n \n \n \n \n F1-4y>=35\n \n \n \n \n \n \n \n \n \n F10-14y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14y10-\n \n \n \n \n \n \n \n \n \n F10-14y14-\n \n \n \n \n \n \n F10-14y20-\n \n \n \n \n \n \n F10-14y25-\n \n \n \n \n \n \n F10-14y4-5\n \n \n \n \n \n \n F10-14y6-9\n \n \n \n \n \n \n F10-14y>=3\n \n \n \n \n \n \n F5-9y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9y10-13\n \n \n \n \n \n \n F5-9y14-19\n \n \n \n \n \n \n F5-9y20-24\n \n \n \n \n \n \n F5-9y25-34\n \n \n \n \n \n \n F5-9y4-5\n \n \n \n \n \n \n F5-9y6-9\n \n \n \n \n \n \n F5-9y>=35\n \n \n \n \n \n \n F<1y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1y10-13\n \n \n \n \n \n \n F<1y14-19\n \n \n \n \n \n \n F<1y20-24\n \n \n \n \n \n \n F<1y25-34\n \n \n \n \n \n \n F<1y4-5\n \n \n \n \n \n \n F<1y6-9\n \n \n \n \n \n \n F<1y>=35\n \n \n \n \n \n \n M1-4y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4y10-14\n \n \n \n \n \n \n M1-4y14-19\n \n \n \n \n \n \n M1-4y20-24\n \n \n \n \n \n \n M1-4y25-34\n \n \n \n \n \n \n M1-4y4-5\n \n \n \n \n \n \n M1-4y6-9\n \n \n \n \n \n \n M1-4y>=35\n \n \n \n \n \n \n M10-14y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14y10-\n \n \n \n \n \n \n M10-14y14-\n \n \n \n \n \n \n M10-14y20-\n \n \n \n \n \n \n M10-14y25-\n \n \n \n \n \n \n M10-14y4-5\n \n \n \n \n \n \n M10-14y6-9\n \n \n \n \n \n \n M10-14y>=3\n \n \n \n \n \n \n M5-9y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9y10-13\n \n \n \n \n \n \n M5-9y14-19\n \n \n \n \n \n \n M5-9y20-24\n \n \n \n \n \n \n M5-9y25-34\n \n \n \n \n \n \n M5-9y4-5\n \n \n \n \n \n \n M5-9y6-9\n \n \n \n \n \n \n M5-9y>=35\n \n \n \n \n \n \n M<1y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1y10-13\n \n \n \n \n \n \n M<1y14-19\n \n \n \n \n \n \n M<1y20-24\n \n \n \n \n \n \n M<1y25-34\n \n \n \n \n \n \n M<1y4-5\n \n \n \n \n \n \n M<1y6-9\n \n \n \n \n \n \n M<1y>=35\n \n \n \n \n \n \n','2023-08-15 21:42:28',4,'2023-08-16 12:02:14',4,0,NULL,NULL,NULL,'b217699a-cf93-4478-8b85-8f59939d020a'),(2328,'Children ARV Regimen_3rdLine_6B ','Children ARV Regimen_3rdLine_6B disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_6B \n Children ARV Regimen_3rdLine_6B disaggregated by weight, sex, age\n \n 2023-08-16 08:51:49 UTC\n \n 2023-08-16 08:53:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2328\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-16 10:51:49',4,'2023-08-16 10:53:21',4,0,NULL,NULL,NULL,'1f0f9f2c-575a-462f-be70-5b8774c58cd6'),(2329,'Children ARV Regimen_3rdLine_6B Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_6B Data Set\n \n 2023-08-16 08:53:21 UTC\n \n 2023-08-16 11:15:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2329\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4yr0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4yr10-1\n \n \n \n \n \n \n \n \n \n F1-4yr14-1\n \n \n \n \n \n \n \n \n \n F1-4yr20-2\n \n \n \n \n \n \n \n \n \n F1-4yr25-3\n \n \n \n \n \n \n \n \n \n F1-4yr4-5\n \n \n \n \n \n \n \n \n \n F1-4yr6-9\n \n \n \n \n \n \n \n \n \n F1-4yr>=35\n \n \n \n \n \n \n \n \n \n F10-14yr0-\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14yr10\n \n \n \n \n \n \n F10-14yr14\n \n \n \n \n \n \n F10-14yr20\n \n \n \n \n \n \n F10-14yr25\n \n \n \n \n \n \n F10-14yr4-\n \n \n \n \n \n \n F10-14yr6-\n \n \n \n \n \n \n F10-14yr>=\n \n \n \n \n \n \n F5-9yr0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9yr10-1\n \n \n \n \n \n \n F5-9yr14-1\n \n \n \n \n \n \n F5-9yr20-2\n \n \n \n \n \n \n F5-9yr25-3\n \n \n \n \n \n \n F5-9yr4-5\n \n \n \n \n \n \n F5-9yr6-9\n \n \n \n \n \n \n F5-9yr>=35\n \n \n \n \n \n \n F<1yr0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1yr10-13\n \n \n \n \n \n \n F<1yr14-19\n \n \n \n \n \n \n F<1yr20-24\n \n \n \n \n \n \n F<1yr25-34\n \n \n \n \n \n \n F<1yr4-5\n \n \n \n \n \n \n F<1yr6-9\n \n \n \n \n \n \n F<1yr>=35\n \n \n \n \n \n \n M1-4yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4yr10-1\n \n \n \n \n \n \n M1-4yr14-1\n \n \n \n \n \n \n M1-4yr20-2\n \n \n \n \n \n \n M1-4yr25-3\n \n \n \n \n \n \n M1-4yr4-5\n \n \n \n \n \n \n M1-4yr6-9\n \n \n \n \n \n \n M1-4yr>=35\n \n \n \n \n \n \n M10-14yr0-\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14yr10\n \n \n \n \n \n \n M10-14yr14\n \n \n \n \n \n \n M10-14yr20\n \n \n \n \n \n \n M10-14yr25\n \n \n \n \n \n \n M10-14yr4-\n \n \n \n \n \n \n M10-14yr6-\n \n \n \n \n \n \n M10-14yr>=\n \n \n \n \n \n \n M5-9yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9yr10-1\n \n \n \n \n \n \n M5-9yr14-1\n \n \n \n \n \n \n M5-9yr20-2\n \n \n \n \n \n \n M5-9yr25-3\n \n \n \n \n \n \n M5-9yr4-5\n \n \n \n \n \n \n M5-9yr6-9\n \n \n \n \n \n \n M5-9yr>=35\n \n \n \n \n \n \n M<1yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1yr10-13\n \n \n \n \n \n \n M<1yr14-19\n \n \n \n \n \n \n M<1yr20-24\n \n \n \n \n \n \n M<1yr25-34\n \n \n \n \n \n \n M<1yr4-5\n \n \n \n \n \n \n M<1yr6-9\n \n \n \n \n \n \n M<1yr>=35\n \n \n \n \n \n \n','2023-08-16 10:53:21',4,'2023-08-16 13:15:59',4,0,NULL,NULL,NULL,'983588a7-5b66-41ef-ad94-a32596694717'),(2330,'HIV Lost To Follow Up','HIV patients who have not been seen for at least 18 months','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HIV Lost To Follow Up\n HIV patients who have not been seen for at least 18 months\n \n 2023-08-16 09:25:57 UTC\n \n \n lastExecutionTime\n \n java.util.Date\n true\n \n \n \n \n /* \n * Name:HIV Lost To Follow Up \n * Query Type: SQL Cohort Query \n * Description: HIV patients who have not been seen for at least 18 months \n * Assumption: Database has only HIV patients \n * HIV Case Reporting Module has already excluded patients previously added to the list. \n */ \n \n SELECT e2.patient_id \n FROM ( \n SELECT e1.patient_id, max(e1.encounter_datetime) as latest_encounter_date \n FROM encounter e1 \n WHERE not e1.voided \n GROUP BY e1.patient_id \n ) as e2 \n WHERE \n date(e2.latest_encounter_date) <= DATE_SUB(now(), INTERVAL 18 MONTH) \n AND \n date(e2.latest_encounter_date) > DATE_SUB(:lastExecutionTime, INTERVAL 18 MONTH); \n\n','2023-08-16 11:25:57',2,NULL,NULL,0,NULL,NULL,NULL,'8916dca2-85b6-4eea-b921-d5cffe1056d4'),(2331,'HIV Patient Died','HIV patients who have died','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n HIV Patient Died\n HIV patients who have died\n \n 2023-08-16 09:25:57 UTC\n \n \n lastExecutionTime\n \n java.util.Date\n true\n \n \n \n \n /* \n * Name:HIV Patient Died \n * Query Type: SQL Cohort Query \n * Description: HIV patients who have died \n * Assumption: Database has only HIV patients \n * HIV Case Reporting Module has already excluded patients previously added to the list. \n */ \n \n SELECT person_id \n FROM person \n WHERE dead = 1 \n AND( \n date_created >= date(:lastExecutionTime) \n OR date_changed >= date(:lastExecutionTime) \n ) \n AND not voided; \n\n','2023-08-16 11:25:57',2,NULL,NULL,0,NULL,NULL,NULL,'d8cb3c40-0d86-4448-8f1f-cf4cd91ece26'),(2333,'Children ARV Regimen_2ndLine_5C','Children ARV Regimen_2ndLine_5C disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5C\n Children ARV Regimen_2ndLine_5C disaggregated by weight, sex, age\n \n 2023-08-16 10:14:20 UTC\n \n 2023-08-16 10:14:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2333\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-16 12:14:20',4,'2023-08-16 12:14:36',4,0,NULL,NULL,NULL,'38a458f9-cb42-4eb7-9b3a-22be06efe0e5'),(2334,'Children ARV Regimen_2ndLine_5C Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5C Data Set\n \n 2023-08-16 10:14:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n \n \n','2023-08-16 12:14:27',4,NULL,NULL,0,NULL,NULL,NULL,'2d670708-bd88-4e83-b9fa-9a0b6d137ea1'),(2335,'Children ARV Regimen_2ndLine_5C Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5C Data Set\n \n 2023-08-16 10:14:36 UTC\n \n 2023-08-16 11:42:37 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2335\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4y0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4y10-13\n \n \n \n \n \n \n \n \n \n F1-4y14-19\n \n \n \n \n \n \n \n \n \n F1-4y20-24\n \n \n \n \n \n \n \n \n \n F1-4y25-34\n \n \n \n \n \n \n \n \n \n F1-4y4-5\n \n \n \n \n \n \n \n \n \n F1-4y6-9\n \n \n \n \n \n \n \n \n \n F1-4y>=35\n \n \n \n \n \n \n \n \n \n F10-14y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14y10-\n \n \n \n \n \n \n F10-14y14-\n \n \n \n \n \n \n F10-14y20-\n \n \n \n \n \n \n F10-14y25-\n \n \n \n \n \n \n F10-14y4-5\n \n \n \n \n \n \n F10-14y6-9\n \n \n \n \n \n \n \n \n \n F10-14y>=3\n \n \n \n \n \n \n F5-9y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9y10-13\n \n \n \n \n \n \n F5-9y14-19\n \n \n \n \n \n \n \n \n \n F5-9y20-24\n \n \n \n \n \n \n F5-9y25-34\n \n \n \n \n \n \n F5-9y4-5\n \n \n \n \n \n \n F5-9y6-9\n \n \n \n \n \n \n F5-9y>=35\n \n \n \n \n \n \n F<1y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1y10-13\n \n \n \n \n \n \n F<1y14-19\n \n \n \n \n \n \n F<1y20-24\n \n \n \n \n \n \n F<1y25-34\n \n \n \n \n \n \n F<1y4-9\n \n \n \n \n \n \n F<1y6-9\n \n \n \n \n \n \n F<1y>=35\n \n \n \n \n \n \n M1-4y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4y10-13\n \n \n \n \n \n \n M1-4y14-19\n \n \n \n \n \n \n M1-4y20-24\n \n \n \n \n \n \n \n \n \n M1-4y25-34\n \n \n \n \n \n \n M1-4y4-5\n \n \n \n \n \n \n M1-4y6-9\n \n \n \n \n \n \n M1-4y>=35\n \n \n \n \n \n \n M10-14y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14y10-\n \n \n \n \n \n \n M10-14y14-\n \n \n \n \n \n \n \n \n \n M10-14y20-\n \n \n \n \n \n \n M10-14y25-\n \n \n \n \n \n \n M10-14y4-5\n \n \n \n \n \n \n M10-14y6-9\n \n \n \n \n \n \n M10-14y>=3\n \n \n \n \n \n \n M5-9y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9y10-13\n \n \n \n \n \n \n M5-9y14-19\n \n \n \n \n \n \n M5-9y20-24\n \n \n \n \n \n \n M5-9y25-34\n \n \n \n \n \n \n M5-9y4-5\n \n \n \n \n \n \n M5-9y6-9\n \n \n \n \n \n \n M5-9y>=35\n \n \n \n \n \n \n M<1y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1y10-13\n \n \n \n \n \n \n M<1y14-19\n \n \n \n \n \n \n M<1y20-24\n \n \n \n \n \n \n M<1y24-34\n \n \n \n \n \n \n M<1y5-9\n \n \n \n \n \n \n M<1y6-9\n \n \n \n \n \n \n M<1y>=35\n \n \n \n \n \n \n','2023-08-16 12:14:36',4,'2023-08-16 13:42:37',4,0,NULL,NULL,NULL,'5add0ab6-3850-4623-ad50-8f5d30ba2df9'),(2336,'Children ARV Regimen_2ndLine_5D','Children ARV Regimen_2ndLine_5D disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5D\n Children ARV Regimen_2ndLine_5D disaggregated by weight, sex, age\n \n 2023-08-16 11:00:11 UTC\n \n 2023-08-16 11:00:49 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2336\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-16 13:00:11',4,'2023-08-16 13:00:49',4,0,NULL,NULL,NULL,'3a4943e7-3026-4e28-b345-26acb4012006'),(2337,'Children ARV Regimen_2ndLine_5D Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5D Data Set\n \n 2023-08-16 11:00:49 UTC\n \n 2023-08-16 14:46:17 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2337\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4y0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4y10-13\n \n \n \n \n \n \n \n \n \n F1-4y14-19\n \n \n \n \n \n \n \n \n \n F1-4y20-24\n \n \n \n \n \n \n \n \n \n F1-4y25-34\n \n \n \n \n \n \n \n \n \n F1-4y4-5\n \n \n \n \n \n \n \n \n \n F1-4y6-9\n \n \n \n \n \n \n \n \n \n F1-4y>=35\n \n \n \n \n \n \n \n \n \n F10-14y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14y10-\n \n \n \n \n \n \n F10-14y14-\n \n \n \n \n \n \n F10-14y20-\n \n \n \n \n \n \n F10-14y25-\n \n \n \n \n \n \n F10-14y4-5\n \n \n \n \n \n \n F10-14y6-9\n \n \n \n \n \n \n F10-14y>=3\n \n \n \n \n \n \n F5-9y0-3\n \n \n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9y10-13\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9y14-19\n \n \n \n \n \n \n F5-9y20-24\n \n \n \n \n \n \n F5-9y25-34\n \n \n \n \n \n \n F5-9y4-5\n \n \n \n \n \n \n F5-9y6-9\n \n \n \n \n \n \n F5-9y>=35\n \n \n \n \n \n \n F<1y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1y10-13\n \n \n \n \n \n \n F<1y14-19\n \n \n \n \n \n \n F<1y20-24\n \n \n \n \n \n \n F<1y25-34\n \n \n \n \n \n \n F<1y4-5\n \n \n \n \n \n \n F<1y6-9\n \n \n \n \n \n \n F<1y>=35\n \n \n \n \n \n \n M1-4y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4y10-13\n \n \n \n \n \n \n M1-4y14-19\n \n \n \n \n \n \n M1-4y20-24\n \n \n \n \n \n \n M1-4y25-34\n \n \n \n \n \n \n M1-4y4-5\n \n \n \n \n \n \n M1-4y6-9\n \n \n \n \n \n \n M1-4y>=35\n \n \n \n \n \n \n M10-14y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14y10-\n \n \n \n \n \n \n \n \n \n M10-14y14-\n \n \n \n \n \n \n \n \n \n M10-14y20-\n \n \n \n \n \n \n M10-14y25-\n \n \n \n \n \n \n M10-14y4-5\n \n \n \n \n \n \n M10-14y6-9\n \n \n \n \n \n \n M10-14y>=3\n \n \n \n \n \n \n M5-9y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9y10-13\n \n \n \n \n \n \n M5-9y14-19\n \n \n \n \n \n \n M5-9y20-24\n \n \n \n \n \n \n M5-9y25-34\n \n \n \n \n \n \n M5-9y4-5\n \n \n \n \n \n \n M5-9y6-9\n \n \n \n \n \n \n M5-9y>=35\n \n \n \n \n \n \n M<1y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1y10-13\n \n \n \n \n \n \n M<1y14-19\n \n \n \n \n \n \n M<1y20-24\n \n \n \n \n \n \n M<1y25-34\n \n \n \n \n \n \n M<1y4-5\n \n \n \n \n \n \n M<1y6-9\n \n \n \n \n \n \n M<1y>=35\n \n \n \n \n \n \n','2023-08-16 13:00:49',4,'2023-08-16 16:46:17',4,0,NULL,NULL,NULL,'51fbe59a-77f3-40b1-9d18-e90e9cd9cacc'),(2338,'Children ARV Regimen_3rdLine_6C','Children ARV Regimen_3rdLine_6C disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_6C\n Children ARV Regimen_3rdLine_6C disaggregated by weight, sex, age\n \n 2023-08-16 11:26:46 UTC\n \n 2023-08-16 11:27:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2338\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-16 13:26:46',4,'2023-08-16 13:27:31',4,0,NULL,NULL,NULL,'61228d0f-b944-4ccc-ba45-d47ecd58c914'),(2339,'Children ARV Regimen_3rdLine_6C Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_6C Data Set\n \n 2023-08-16 11:27:31 UTC\n \n 2023-08-16 12:37:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2339\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4yr0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4yr10-1\n \n \n \n \n \n \n \n \n \n F1-4yr14-1\n \n \n \n \n \n \n \n \n \n F1-4yr20-2\n \n \n \n \n \n \n \n \n \n F1-4yr25-3\n \n \n \n \n \n \n \n \n \n F1-4yr4-5\n \n \n \n \n \n \n \n \n \n F1-4yr6-9\n \n \n \n \n \n \n \n \n \n F1-4yr>=35\n \n \n \n \n \n \n \n \n \n F10-14yr0-\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14yr10\n \n \n \n \n \n \n F10-14yr14\n \n \n \n \n \n \n F10-14yr20\n \n \n \n \n \n \n \n \n \n F10-14yr25\n \n \n \n \n \n \n F10-14yr4-\n \n \n \n \n \n \n F10-14yr6-\n \n \n \n \n \n \n F10-14yr>=\n \n \n \n \n \n \n F5-9yr0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9yr10-1\n \n \n \n \n \n \n F5-9yr14-1\n \n \n \n \n \n \n F5-9yr20-2\n \n \n \n \n \n \n F5-9yr25-3\n \n \n \n \n \n \n F5-9yr4-5\n \n \n \n \n \n \n F5-9yr6-9\n \n \n \n \n \n \n F5-9yr>=35\n \n \n \n \n \n \n F<1yr0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1yr10-13\n \n \n \n \n \n \n F<1yr14-19\n \n \n \n \n \n \n F<1yr20-24\n \n \n \n \n \n \n F<1yr25-34\n \n \n \n \n \n \n F<1yr4-5\n \n \n \n \n \n \n F<1yr6-9\n \n \n \n \n \n \n F<1yr>=35\n \n \n \n \n \n \n M1-4yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4yr10-1\n \n \n \n \n \n \n M1-4yr14-1\n \n \n \n \n \n \n M1-4yr20-2\n \n \n \n \n \n \n M1-4yr25-3\n \n \n \n \n \n \n M1-4yr4-5\n \n \n \n \n \n \n M1-4yr6-9\n \n \n \n \n \n \n M1-4yr>=35\n \n \n \n \n \n \n M10-14yr0-\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14yr10\n \n \n \n \n \n \n M10-14yr14\n \n \n \n \n \n \n M10-14yr20\n \n \n \n \n \n \n M10-14yr25\n \n \n \n \n \n \n M10-14yr4-\n \n \n \n \n \n \n M10-14yr6-\n \n \n \n \n \n \n M10-14yr>=\n \n \n \n \n \n \n M5-9yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9yr10-1\n \n \n \n \n \n \n M5-9yr14-1\n \n \n \n \n \n \n M5-9yr20-2\n \n \n \n \n \n \n M5-9yr25-3\n \n \n \n \n \n \n M5-9yr4-5\n \n \n \n \n \n \n M5-9yr6-9\n \n \n \n \n \n \n M5-9yr>=35\n \n \n \n \n \n \n M<1yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1yr10-13\n \n \n \n \n \n \n M<1yr14-19\n \n \n \n \n \n \n M<1yr20-24\n \n \n \n \n \n \n M<1yr25-34\n \n \n \n \n \n \n M<1yr4-5\n \n \n \n \n \n \n M<1yr6-9\n \n \n \n \n \n \n M<1yr>=35\n \n \n \n \n \n \n','2023-08-16 13:27:31',4,'2023-08-16 14:37:59',4,0,NULL,NULL,NULL,'4a1d329b-6eeb-4ef7-a104-d1c6f9479abc'),(2342,'Children ARV Regimen_2ndLine_5E','Children ARV Regimen_2ndLine_5E disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5E\n Children ARV Regimen_2ndLine_5E disaggregated by weight, sex, age\n \n 2023-08-16 11:51:18 UTC\n \n 2023-08-16 11:52:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2342\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-16 13:51:18',4,'2023-08-16 13:52:18',4,0,NULL,NULL,NULL,'f710c498-9264-4d7e-bdb4-e846dec7972b'),(2343,'Children ARV Regimen_2ndLine_5E Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5E Data Set\n \n 2023-08-16 11:51:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n \n \n','2023-08-16 13:51:29',4,NULL,NULL,0,NULL,NULL,NULL,'8eaa5921-d13d-4bd9-912d-d9d09af7394f'),(2344,'Children ARV Regimen_2ndLine_5E Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5E Data Set\n \n 2023-08-16 11:52:09 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n \n \n','2023-08-16 13:52:09',4,NULL,NULL,0,NULL,NULL,NULL,'0105c46c-76ef-4088-b5b1-b89e42dc49d1'),(2345,'Children ARV Regimen_2ndLine_5E Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5E Data Set\n \n 2023-08-16 11:52:18 UTC\n \n 2023-08-16 15:02:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2345\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4y0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4y10-13\n \n \n \n \n \n \n \n \n \n F1-4y14-19\n \n \n \n \n \n \n \n \n \n F1-4y20-24\n \n \n \n \n \n \n \n \n \n F1-4y25-34\n \n \n \n \n \n \n \n \n \n F1-4y4-5\n \n \n \n \n \n \n \n \n \n F1-4y6-9\n \n \n \n \n \n \n \n \n \n F1-4y>=35\n \n \n \n \n \n \n \n \n \n F10-14y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14y10-\n \n \n \n \n \n \n F10-14y14-\n \n \n \n \n \n \n F10-14y20-\n \n \n \n \n \n \n F10-14y25-\n \n \n \n \n \n \n F10-14y4-5\n \n \n \n \n \n \n \n \n \n F10-14y6-9\n \n \n \n \n \n \n F10-14y>=3\n \n \n \n \n \n \n F5-9y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9y10-13\n \n \n \n \n \n \n F5-9y14-19\n \n \n \n \n \n \n F5-9y20-24\n \n \n \n \n \n \n F5-9y25-34\n \n \n \n \n \n \n F5-9y4-5\n \n \n \n \n \n \n F5-9y6-9\n \n \n \n \n \n \n F5-9y>=35\n \n \n \n \n \n \n F6-9y4-5\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1y0-3\n \n \n \n \n \n \n F<1y10-13\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Adults\n \n \n \n \n \n F<1y14-19\n \n \n \n \n \n \n F<1y20-24\n \n \n \n \n \n \n F<1y25-34\n \n \n \n \n \n \n F<1y4-5\n \n \n \n \n \n \n F<1y6-9\n \n \n \n \n \n \n F<1y>=35\n \n \n \n \n \n \n M1-4y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4y10-13\n \n \n \n \n \n \n M1-4y14-19\n \n \n \n \n \n \n M1-4y20-24\n \n \n \n \n \n \n \n \n \n M1-4y25-34\n \n \n \n \n \n \n M1-4y4-5\n \n \n \n \n \n \n M1-4y6-9\n \n \n \n \n \n \n M1-4y>=35\n \n \n \n \n \n \n M10-14y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14y10-\n \n \n \n \n \n \n M10-14y14-\n \n \n \n \n \n \n M10-14y20-\n \n \n \n \n \n \n M10-14y25-\n \n \n \n \n \n \n M10-14y4-5\n \n \n \n \n \n \n M10-14y6-9\n \n \n \n \n \n \n M10-14y>=3\n \n \n \n \n \n \n M5-9y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9y10-13\n \n \n \n \n \n \n M5-9y14-19\n \n \n \n \n \n \n M5-9y20-24\n \n \n \n \n \n \n M5-9y25-34\n \n \n \n \n \n \n M5-9y4-5\n \n \n \n \n \n \n M5-9y6-9\n \n \n \n \n \n \n M5-9y>=35\n \n \n \n \n \n \n M<1y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1y10-13\n \n \n \n \n \n \n M<1y14-19\n \n \n \n \n \n \n M<1y20-24\n \n \n \n \n \n \n M<1y25-34\n \n \n \n \n \n \n M<1y4-5\n \n \n \n \n \n \n M<1y6-9\n \n \n \n \n \n \n M<1y>=35\n \n \n \n \n \n \n','2023-08-16 13:52:18',4,'2023-08-16 17:02:44',4,0,NULL,NULL,NULL,'3b422368-2868-4d7f-a24f-936289c1b8a2'),(2346,'Children ARV Regimen_3rdLine_6D','Children ARV Regimen_3rdLine_6D disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_6D\n Children ARV Regimen_3rdLine_6D disaggregated by weight, sex, age\n \n 2023-08-16 14:30:52 UTC\n \n 2023-08-16 14:31:03 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2346\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-16 16:30:52',4,'2023-08-16 16:31:03',4,0,NULL,NULL,NULL,'7f66540d-c280-4dd8-a771-71057ff7ce42'),(2347,'Children ARV Regimen_3rdLine_6D Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_6D Data Set\n \n 2023-08-16 14:31:03 UTC\n \n 2023-08-16 15:52:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2347\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4yr0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4yr10-1\n \n \n \n \n \n \n \n \n \n F1-4yr14-1\n \n \n \n \n \n \n \n \n \n F1-4yr20-2\n \n \n \n \n \n \n \n \n \n F1-4yr25-3\n \n \n \n \n \n \n \n \n \n F1-4yr4-5\n \n \n \n \n \n \n \n \n \n F1-4yr6-9\n \n \n \n \n \n \n \n \n \n F1-4yr>=35\n \n \n \n \n \n \n \n \n \n F10-14yr0-\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14yr10\n \n \n \n \n \n \n F10-14yr14\n \n \n \n \n \n \n F10-14yr20\n \n \n \n \n \n \n \n \n \n F10-14yr25\n \n \n \n \n \n \n \n \n \n F10-14yr4-\n \n \n \n \n \n \n F10-14yr6-\n \n \n \n \n \n \n F10-14yr>=\n \n \n \n \n \n \n F5-9yr0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9yr10-1\n \n \n \n \n \n \n F5-9yr14-1\n \n \n \n \n \n \n F5-9yr20-2\n \n \n \n \n \n \n F5-9yr25-3\n \n \n \n \n \n \n F5-9yr4-5\n \n \n \n \n \n \n F5-9yr6-9\n \n \n \n \n \n \n F5-9yr>=35\n \n \n \n \n \n \n F<1yr0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1yr10-13\n \n \n \n \n \n \n \n \n \n F<1yr14-19\n \n \n \n \n \n \n F<1yr20-24\n \n \n \n \n \n \n F<1yr25-34\n \n \n \n \n \n \n F<1yr4-5\n \n \n \n \n \n \n F<1yr6-9\n \n \n \n \n \n \n F<1yr>=35\n \n \n \n \n \n \n M1-4yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4yr10-1\n \n \n \n \n \n \n M1-4yr14-1\n \n \n \n \n \n \n M1-4yr20-2\n \n \n \n \n \n \n M1-4yr25-3\n \n \n \n \n \n \n M1-4yr4-5\n \n \n \n \n \n \n M1-4yr6-9\n \n \n \n \n \n \n M1-4yr>=35\n \n \n \n \n \n \n M10-14yr0-\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14yr10\n \n \n \n \n \n \n M10-14yr14\n \n \n \n \n \n \n M10-14yr20\n \n \n \n \n \n \n M10-14yr25\n \n \n \n \n \n \n M10-14yr4-\n \n \n \n \n \n \n M10-14yr6-\n \n \n \n \n \n \n M10-14yr>=\n \n \n \n \n \n \n M5-9yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9yr10-1\n \n \n \n \n \n \n M5-9yr14-1\n \n \n \n \n \n \n M5-9yr20-2\n \n \n \n \n \n \n M5-9yr25-3\n \n \n \n \n \n \n M5-9yr4-5\n \n \n \n \n \n \n M5-9yr6-9\n \n \n \n \n \n \n M5-9yr>=35\n \n \n \n \n \n \n M<1yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1yr10-13\n \n \n \n \n \n \n M<1yr14-19\n \n \n \n \n \n \n M<1yr20-24\n \n \n \n \n \n \n M<1yr25-34\n \n \n \n \n \n \n M<1yr4-5\n \n \n \n \n \n \n M<1yr6-9\n \n \n \n \n \n \n M<1yr>=35\n \n \n \n \n \n \n','2023-08-16 16:31:03',4,'2023-08-16 17:52:50',4,0,NULL,NULL,NULL,'27ae096d-4997-4d00-a00a-390c70159a12'),(2348,'Children ARV Regimen_2ndLine_5F','Children ARV Regimen_2ndLine_5F disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5F\n Children ARV Regimen_2ndLine_5F disaggregated by weight, sex, age\n \n 2023-08-16 14:55:10 UTC\n \n 2023-08-16 14:55:33 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2348\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-16 16:55:10',4,'2023-08-16 16:55:33',4,0,NULL,NULL,NULL,'9d77bcc5-cf55-4f71-8e9b-77d19d82e10d'),(2349,'Children ARV Regimen_2ndLine_5F Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5F Data Set\n \n 2023-08-16 14:55:33 UTC\n \n 2023-08-16 15:48:02 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2349\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4y0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4y10-13\n \n \n \n \n \n \n \n \n \n F1-4y14-19\n \n \n \n \n \n \n \n \n \n F1-4y20-24\n \n \n \n \n \n \n \n \n \n F1-4y25-34\n \n \n \n \n \n \n \n \n \n F1-4y4-5\n \n \n \n \n \n \n \n \n \n F1-4y6-9\n \n \n \n \n \n \n \n \n \n F1-4y>=35\n \n \n \n \n \n \n \n \n \n F10-14y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14y10-\n \n \n \n \n \n \n \n \n \n F10-14y14-\n \n \n \n \n \n \n F10-14y20-\n \n \n \n \n \n \n F10-14y25-\n \n \n \n \n \n \n F10-14y4-5\n \n \n \n \n \n \n F10-14y6-9\n \n \n \n \n \n \n F10-14y>=3\n \n \n \n \n \n \n F5-9y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9y10-13\n \n \n \n \n \n \n F5-9y14-19\n \n \n \n \n \n \n F5-9y20-24\n \n \n \n \n \n \n F5-9y25-34\n \n \n \n \n \n \n F5-9y4-5\n \n \n \n \n \n \n F5-9y6-9\n \n \n \n \n \n \n F5-9y>=35\n \n \n \n \n \n \n F<1y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1y10-13\n \n \n \n \n \n \n F<1y14-19\n \n \n \n \n \n \n F<1y20-24\n \n \n \n \n \n \n F<1y25-34\n \n \n \n \n \n \n F<1y4-5\n \n \n \n \n \n \n F<1y6-9\n \n \n \n \n \n \n \n \n \n F<1y>=35\n \n \n \n \n \n \n M1-4y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4y10-13\n \n \n \n \n \n \n M1-4y14-19\n \n \n \n \n \n \n M1-4y20-24\n \n \n \n \n \n \n M1-4y25-34\n \n \n \n \n \n \n M1-4y4-5\n \n \n \n \n \n \n M1-4y6-9\n \n \n \n \n \n \n M1-4y>=35\n \n \n \n \n \n \n M10-14y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14y10-\n \n \n \n \n \n \n M10-14y14-\n \n \n \n \n \n \n M10-14y20-\n \n \n \n \n \n \n M10-14y25-\n \n \n \n \n \n \n M10-14y4-5\n \n \n \n \n \n \n M10-14y6-9\n \n \n \n \n \n \n M10-14y>=3\n \n \n \n \n \n \n M5-9y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9y10-13\n \n \n \n \n \n \n M5-9y14-19\n \n \n \n \n \n \n M5-9y20-24\n \n \n \n \n \n \n M5-9y25-34\n \n \n \n \n \n \n M5-9y4-5\n \n \n \n \n \n \n M5-9y6-9\n \n \n \n \n \n \n M5-9y>=35\n \n \n \n \n \n \n M<1y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1y10-13\n \n \n \n \n \n \n M<1y14-19\n \n \n \n \n \n \n M<1y20-24\n \n \n \n \n \n \n M<1y25-34\n \n \n \n \n \n \n M<1y4-5\n \n \n \n \n \n \n M<1y6-9\n \n \n \n \n \n \n M<1y>=35\n \n \n \n \n \n \n','2023-08-16 16:55:33',4,'2023-08-16 17:48:02',4,0,NULL,NULL,NULL,'dc690b7d-b448-4f9f-b159-00d2671710e6'),(2350,'Children ARV Regimen_2ndLine_5G','Children ARV Regimen_2ndLine_5G','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5G\n Children ARV Regimen_2ndLine_5G\n \n 2023-08-16 15:09:07 UTC\n \n 2023-08-16 15:10:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2350\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-16 17:09:07',4,'2023-08-16 17:10:08',4,0,NULL,NULL,NULL,'f2f7b2a9-f96e-4f72-8edf-5e0a4195ec85'),(2351,'Children ARV Regimen_2ndLine_5G Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5G Data Set\n \n 2023-08-16 15:10:08 UTC\n \n 2023-08-16 18:01:10 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2351\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4y0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4y10-13\n \n \n \n \n \n \n \n \n \n F1-4y14-19\n \n \n \n \n \n \n \n \n \n F1-4y20-24\n \n \n \n \n \n \n \n \n \n F1-4y25-34\n \n \n \n \n \n \n \n \n \n F1-4y4-5\n \n \n \n \n \n \n \n \n \n F1-4y6-9\n \n \n \n \n \n \n \n \n \n F1-4y>=35\n \n \n \n \n \n \n \n \n \n F10-14y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14y10-\n \n \n \n \n \n \n \n \n \n F10-14y14-\n \n \n \n \n \n \n \n \n \n F10-14y20-\n \n \n \n \n \n \n \n \n \n F10-14y25-\n \n \n \n \n \n \n F10-14y4-5\n \n \n \n \n \n \n \n \n \n F10-14y6-9\n \n \n \n \n \n \n \n \n \n F10-14y>=3\n \n \n \n \n \n \n F5-9y0-3\n \n \n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9y10-13\n \n \n \n \n \n \n F5-9y14-19\n \n \n \n \n \n \n F5-9y20-24\n \n \n \n \n \n \n F5-9y25-34\n \n \n \n \n \n \n F5-9y4-5\n \n \n \n \n \n \n F5-9y6-9\n \n \n \n \n \n \n F5-9y>=35\n \n \n \n \n \n \n F<1y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1y10-13\n \n \n \n \n \n \n F<1y14-19\n \n \n \n \n \n \n F<1y25-34\n \n \n \n \n \n \n F<1y4-5\n \n \n \n \n \n \n F<1y6-9\n \n \n \n \n \n \n F<1y>=35\n \n \n \n \n \n \n M1-4y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4y10-13\n \n \n \n \n \n \n M1-4y14-19\n \n \n \n \n \n \n M1-4y20-24\n \n \n \n \n \n \n \n \n \n M1-4y25-34\n \n \n \n \n \n \n M1-4y4-5\n \n \n \n \n \n \n M1-4y6-9\n \n \n \n \n \n \n M1-4y>=35\n \n \n \n \n \n \n \n \n \n M10-14>=35\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14y0-3\n \n \n \n \n \n \n M10-14y10-\n \n \n \n \n \n \n M10-14y14-\n \n \n \n \n \n \n M10-14y20-\n \n \n \n \n \n \n M10-14y25-\n \n \n \n \n \n \n M10-14y4-5\n \n \n \n \n \n \n M10-14y6-9\n \n \n \n \n \n \n M5-9y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9y10-13\n \n \n \n \n \n \n M5-9y14-19\n \n \n \n \n \n \n M5-9y20-24\n \n \n \n \n \n \n M5-9y25-34\n \n \n \n \n \n \n M5-9y4-5\n \n \n \n \n \n \n M5-9y6-9\n \n \n \n \n \n \n M5-9y>=35\n \n \n \n \n \n \n M<1y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1y10-13\n \n \n \n \n \n \n M<1y14-19\n \n \n \n \n \n \n M<1y20-24\n \n \n \n \n \n \n M<1y25-34\n \n \n \n \n \n \n M<1y4-5\n \n \n \n \n \n \n M<1y6-9\n \n \n \n \n \n \n M<1y>=35\n \n \n \n \n \n \n','2023-08-16 17:10:08',4,'2023-08-16 20:01:10',4,0,NULL,NULL,NULL,'1041fe73-c2e7-47db-8d84-eb79176e25fe'),(2352,'Children ARV Regimen_2ndLine_5H','Children ARV Regimen_2ndLine_5H disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5H\n Children ARV Regimen_2ndLine_5H disaggregated by weight, sex, age\n \n 2023-08-16 15:50:48 UTC\n \n 2023-08-16 15:50:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2352\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-16 17:50:48',4,'2023-08-16 17:50:59',4,0,NULL,NULL,NULL,'71b6899d-048d-4c2a-a10f-84422454ece6'),(2353,'Children ARV Regimen_2ndLine_5H Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_2ndLine_5H Data Set\n \n 2023-08-16 15:50:59 UTC\n \n 2023-08-16 17:19:35 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2353\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4y0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4y10-13\n \n \n \n \n \n \n \n \n \n F1-4y14-19\n \n \n \n \n \n \n \n \n \n F1-4y20-24\n \n \n \n \n \n \n \n \n \n F1-4y25-34\n \n \n \n \n \n \n \n \n \n F1-4y4-5\n \n \n \n \n \n \n \n \n \n F1-4y6-9\n \n \n \n \n \n \n \n \n \n F1-4y>=35\n \n \n \n \n \n \n \n \n \n F10-14y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14y10-\n \n \n \n \n \n \n F10-14y14-\n \n \n \n \n \n \n F10-14y20-\n \n \n \n \n \n \n F10-14y25-\n \n \n \n \n \n \n F10-14y4-5\n \n \n \n \n \n \n F10-14y6-9\n \n \n \n \n \n \n F10-14y>=3\n \n \n \n \n \n \n \n \n \n F5-9y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9y10-13\n \n \n \n \n \n \n F5-9y14-19\n \n \n \n \n \n \n F5-9y20-24\n \n \n \n \n \n \n F5-9y25-34\n \n \n \n \n \n \n F5-9y4-5\n \n \n \n \n \n \n F5-9y6-9\n \n \n \n \n \n \n F5-9y>=35\n \n \n \n \n \n \n F<1y0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1y10-13\n \n \n \n \n \n \n \n \n \n F<1y14-19\n \n \n \n \n \n \n F<1y20-24\n \n \n \n \n \n \n F<1y25-34\n \n \n \n \n \n \n F<1y4-5\n \n \n \n \n \n \n F<1y6-9\n \n \n \n \n \n \n F<1y>=35\n \n \n \n \n \n \n M1-4y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4y10-13\n \n \n \n \n \n \n M1-4y14-19\n \n \n \n \n \n \n M1-4y20-24\n \n \n \n \n \n \n M1-4y25-34\n \n \n \n \n \n \n M1-4y4-5\n \n \n \n \n \n \n M1-4y6-9\n \n \n \n \n \n \n M1-4y>=35\n \n \n \n \n \n \n M10-14y0-3\n \n \n \n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14y10-\n \n \n \n \n \n \n M10-14y14-\n \n \n \n \n \n \n \n \n \n M10-14y20-\n \n \n \n \n \n \n M10-14y25-\n \n \n \n \n \n \n M10-14y4-5\n \n \n \n \n \n \n M10-14y6-9\n \n \n \n \n \n \n M10-14y>=3\n \n \n \n \n \n \n M5-9y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9y10-13\n \n \n \n \n \n \n M5-9y14-19\n \n \n \n \n \n \n M5-9y20-24\n \n \n \n \n \n \n M5-9y25-34\n \n \n \n \n \n \n M5-9y4-5\n \n \n \n \n \n \n \n \n \n M5-9y6-9\n \n \n \n \n \n \n M5-9y>=35\n \n \n \n \n \n \n M<1y0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1y10-13\n \n \n \n \n \n \n M<1y14-19\n \n \n \n \n \n \n M<1y20-24\n \n \n \n \n \n \n M<1y25-34\n \n \n \n \n \n \n M<1y4-5\n \n \n \n \n \n \n M<1y6-9\n \n \n \n \n \n \n M<1y>=35\n \n \n \n \n \n \n','2023-08-16 17:50:59',4,'2023-08-16 19:19:35',4,0,NULL,NULL,NULL,'fa79bb1e-c2a3-435f-8074-de92d79ed741'),(2354,'Children ARV Regimen_3rdLine_6E','Children ARV Regimen_3rdLine_6E disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_6E\n Children ARV Regimen_3rdLine_6E disaggregated by weight, sex, age\n \n 2023-08-16 15:57:11 UTC\n \n 2023-08-16 15:58:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2354\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-16 17:57:11',4,'2023-08-16 17:58:30',4,0,NULL,NULL,NULL,'ace827f2-1783-4eac-819e-12793a2c4e9f'); INSERT INTO `serialized_object` VALUES (2355,'Children ARV Regimen_3rdLine_6E Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_6E Data Set\n \n 2023-08-16 15:58:30 UTC\n \n 2023-08-16 17:28:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2355\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4yr0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4yr10-1\n \n \n \n \n \n \n \n \n \n F1-4yr14-1\n \n \n \n \n \n \n \n \n \n F1-4yr20-2\n \n \n \n \n \n \n \n \n \n F1-4yr25-3\n \n \n \n \n \n \n \n \n \n F1-4yr4-5\n \n \n \n \n \n \n \n \n \n F1-4yr6-9\n \n \n \n \n \n \n \n \n \n F1-4yr>=35\n \n \n \n \n \n \n \n \n \n F10-14yr0-\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14yr10\n \n \n \n \n \n \n F10-14yr14\n \n \n \n \n \n \n F10-14yr20\n \n \n \n \n \n \n F10-14yr25\n \n \n \n \n \n \n F10-14yr4-\n \n \n \n \n \n \n F10-14yr6-\n \n \n \n \n \n \n F10-14yr>=\n \n \n \n \n \n \n F5-9yr0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9yr10-1\n \n \n \n \n \n \n F5-9yr14-1\n \n \n \n \n \n \n F5-9yr20-2\n \n \n \n \n \n \n F5-9yr25-3\n \n \n \n \n \n \n F5-9yr4-5\n \n \n \n \n \n \n F5-9yr6-9\n \n \n \n \n \n \n F5-9yr>=35\n \n \n \n \n \n \n F<1yr0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1yr10-13\n \n \n \n \n \n \n F<1yr14-19\n \n \n \n \n \n \n F<1yr20-24\n \n \n \n \n \n \n F<1yr25-34\n \n \n \n \n \n \n F<1yr4-5\n \n \n \n \n \n \n F<1yr6-9\n \n \n \n \n \n \n F<1yr>=35\n \n \n \n \n \n \n M1-4yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4yr10-1\n \n \n \n \n \n \n M1-4yr14-1\n \n \n \n \n \n \n M1-4yr20-2\n \n \n \n \n \n \n M1-4yr25-3\n \n \n \n \n \n \n M1-4yr4-5\n \n \n \n \n \n \n M1-4yr6-9\n \n \n \n \n \n \n M1-4yr>=35\n \n \n \n \n \n \n M10-14yr0-\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14yr10\n \n \n \n \n \n \n M10-14yr14\n \n \n \n \n \n \n M10-14yr20\n \n \n \n \n \n \n M10-14yr25\n \n \n \n \n \n \n M10-14yr4-\n \n \n \n \n \n \n M10-14yr6-\n \n \n \n \n \n \n M10-14yr>=\n \n \n \n \n \n \n M5-9yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9yr10-1\n \n \n \n \n \n \n M5-9yr14-1\n \n \n \n \n \n \n M5-9yr20-2\n \n \n \n \n \n \n M5-9yr25-3\n \n \n \n \n \n \n M5-9yr4-5\n \n \n \n \n \n \n M5-9yr6-9\n \n \n \n \n \n \n M5-9yr>=35\n \n \n \n \n \n \n M<1yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1yr10-13\n \n \n \n \n \n \n M<1yr14-19\n \n \n \n \n \n \n M<1yr20-24\n \n \n \n \n \n \n M<1yr25-34\n \n \n \n \n \n \n M<1yr4-5\n \n \n \n \n \n \n M<1yr6-9\n \n \n \n \n \n \n M<1yr>=35\n \n \n \n \n \n \n','2023-08-16 17:58:30',4,'2023-08-16 19:28:59',4,0,NULL,NULL,NULL,'91b72368-e321-4a7b-968d-1271493fa958'),(2356,'Children ARV Regimen_3rdLine_6F','Children ARV Regimen_3rdLine_6F disaggregated by weight, sex, age','org.openmrs.module.reporting.report.definition.ReportDefinition','org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_6F\n Children ARV Regimen_3rdLine_6F disaggregated by weight, sex, age\n \n 2023-08-16 17:30:28 UTC\n \n 2023-08-16 17:30:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2356\n \n \n defaultDataSet\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n','2023-08-16 19:30:28',4,'2023-08-16 19:30:40',4,0,NULL,NULL,NULL,'cba2a95d-5060-47fd-9401-a826e1c0858a'),(2357,'Children ARV Regimen_3rdLine_6F Data Set',NULL,'org.openmrs.module.reporting.dataset.definition.DataSetDefinition','org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Children ARV Regimen_3rdLine_6F Data Set\n \n 2023-08-16 17:30:39 UTC\n \n 2023-08-16 18:09:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2357\n \n \n DM_Sex\n \n \n \n \n \n \n DM_Age\n \n \n \n \n endDate\n ${endDate}\n \n \n \n \n \n \n \n F1-4yr0-3\n \n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n F1-4yr10-1\n \n \n \n \n \n \n \n \n \n F1-4yr14-1\n \n \n \n \n \n \n \n \n \n F1-4yr20-2\n \n \n \n \n \n \n \n \n \n F1-4yr25-3\n \n \n \n \n \n \n \n \n \n F1-4yr4-5\n \n \n \n \n \n \n \n \n \n F1-4yr6-9\n \n \n \n \n \n \n \n \n \n F1-4yr>=35\n \n \n \n \n \n \n \n \n \n F10-14yr0-\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n F10-14yr10\n \n \n \n \n \n \n F10-14yr14\n \n \n \n \n \n \n F10-14yr20\n \n \n \n \n \n \n F10-14yr25\n \n \n \n \n \n \n F10-14yr4-\n \n \n \n \n \n \n F10-14yr6-\n \n \n \n \n \n \n F10-14yr>=\n \n \n \n \n \n \n F5-9yr0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n F5-9yr10-1\n \n \n \n \n \n \n F5-9yr14-1\n \n \n \n \n \n \n F5-9yr20-2\n \n \n \n \n \n \n F5-9yr25-3\n \n \n \n \n \n \n F5-9yr4-5\n \n \n \n \n \n \n F5-9yr6-9\n \n \n \n \n \n \n F5-9yr>=35\n \n \n \n \n \n \n F<1yr0-3\n \n \n \n \n DM_Sex\n Females\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n F<1yr10-13\n \n \n \n \n \n \n F<1yr14-19\n \n \n \n \n \n \n F<1yr20-24\n \n \n \n \n \n \n F<1yr25-34\n \n \n \n \n \n \n F<1yr4-5\n \n \n \n \n \n \n F<1yr6-9\n \n \n \n \n \n \n F<1yr>=35\n \n \n \n \n \n \n M1-4yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 01to04yrs\n \n \n \n \n \n M1-4yr10-1\n \n \n \n \n \n \n M1-4yr14-1\n \n \n \n \n \n \n M1-4yr20-2\n \n \n \n \n \n \n M1-4yr25-3\n \n \n \n \n \n \n M1-4yr4-5\n \n \n \n \n \n \n M1-4yr6-9\n \n \n \n \n \n \n M1-4yr>=35\n \n \n \n \n \n \n M10-14yr0-\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 10to14yrs\n \n \n \n \n \n M10-14yr10\n \n \n \n \n \n \n M10-14yr14\n \n \n \n \n \n \n M10-14yr20\n \n \n \n \n \n \n M10-14yr25\n \n \n \n \n \n \n M10-14yr4-\n \n \n \n \n \n \n M10-14yr6-\n \n \n \n \n \n \n M10-14yr>=\n \n \n \n \n \n \n M5-9yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n 05to09yrs\n \n \n \n \n \n M5-9yr10-1\n \n \n \n \n \n \n M5-9yr14-1\n \n \n \n \n \n \n M5-9yr20-2\n \n \n \n \n \n \n M5-9yr25-3\n \n \n \n \n \n \n M5-9yr4-5\n \n \n \n \n \n \n M5-9yr6-9\n \n \n \n \n \n \n M5-9yr>=35\n \n \n \n \n \n \n M<1yr0-3\n \n \n \n \n DM_Sex\n Males\n \n \n DM_Age\n Under 1yr\n \n \n \n \n \n M<1yr10-13\n \n \n \n \n \n \n M<1yr14-19\n \n \n \n \n \n \n M<1yr20-24\n \n \n \n \n \n \n M<1yr25-34\n \n \n \n \n \n \n M<1yr4-5\n \n \n \n \n \n \n M<1yr6-9\n \n \n \n \n \n \n M<1yr>=35\n \n \n \n \n \n \n','2023-08-16 19:30:39',4,'2023-08-16 20:09:14',4,0,NULL,NULL,NULL,'739d18c0-8b69-47f2-b49c-f203e776d528'),(2358,'Clients given 5A with >=20Copies_Viral_Load','Clients given 5A with >=20Copies_Viral_Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5A with >=20Copies_Viral_Load\n Clients given 5A with >=20Copies_Viral_Load\n \n 2023-08-17 08:33:38 UTC\n \n 2023-08-17 08:34:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2358\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5A \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND MONTH(os.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3681)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and oss.obs_datetime <= cast('2023-06-30'as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \n \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-17 10:33:38',4,'2023-08-17 10:34:00',4,0,NULL,NULL,NULL,'f9c21dfa-e2bc-4174-858c-5290ee412c83'),(2359,'Clients given 5A with <20Copies_Viral_Load','Clients given 5A with <20Copies_Viral_Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5A with <20Copies_Viral_Load\n Clients given 5A with <20Copies_Viral_Load\n \n 2023-08-17 08:35:33 UTC\n \n 2023-08-17 08:36:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2359\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5A \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND MONTH(os.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3681)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-17 10:35:33',4,'2023-08-17 10:36:23',4,0,NULL,NULL,NULL,'f803bb84-0a18-4319-91e7-4ea289d8a295'),(2360,'Clients given 5A with Undetectable_Viral_Load','Clients given 5A with Undetectable_Viral_Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5A with Undetectable_Viral_Load\n Clients given 5A with Undetectable_Viral_Load\n \n 2023-08-17 08:37:56 UTC\n \n 2023-08-17 08:39:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2360\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5A \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND MONTH(os.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3681)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- undetectable, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-17 10:37:56',4,'2023-08-17 10:39:04',4,0,NULL,NULL,NULL,'2386a884-ae79-46a7-8adf-d5044b06e9c4'),(2361,'Clients given 5B with >=20Copies_Viral_Load','Clients given 5B with >=20Copies_Viral_Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5B with >=20Copies_Viral_Load\n Clients given 5B with >=20Copies_Viral_Load\n \n 2023-08-17 08:44:15 UTC\n \n 2023-08-17 09:02:37 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2361\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5B \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3682)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and oss.obs_datetime <= cast('2023-06-30'as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \n \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-17 10:44:15',4,'2023-08-17 11:02:37',4,0,NULL,NULL,NULL,'5939e332-e3fc-4a42-a736-b647f31a87a3'),(2362,'Clients given 5B with <20Copies_Viral_Load','Clients given 5B with <20Copies_Viral_Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5B with <20Copies_Viral_Load\n Clients given 5B with <20Copies_Viral_Load\n \n 2023-08-17 08:59:37 UTC\n \n 2023-08-17 09:05:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2362\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5B \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3682)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-17 10:59:37',4,'2023-08-17 11:05:50',4,0,NULL,NULL,NULL,'8b4f6f3d-4444-4429-ac84-94ecc1e14ba2'),(2363,'Clients given 5B with Undetectable_Viral_Load','Clients given 5B with Undetectable_Viral_Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5B with Undetectable_Viral_Load\n Clients given 5B with Undetectable_Viral_Load\n \n 2023-08-17 09:06:53 UTC\n \n 2023-08-17 09:07:37 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2363\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5B \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3682)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- undetectable, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n)) \n \n\n','2023-08-17 11:06:53',4,'2023-08-17 11:07:37',4,0,NULL,NULL,NULL,'d7418afd-aca2-46e9-9c72-e920d447db27'),(2364,'Clients given 5C with >=20Copies_Viral_Load','Clients given 5C with >=20Copies_Viral_Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5C with >=20Copies_Viral_Load\n Clients given 5C with >=20Copies_Viral_Load\n \n 2023-08-17 09:13:04 UTC\n \n 2023-08-17 09:15:46 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2364\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4696)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and oss.obs_datetime <= cast('2023-06-30'as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-17 11:13:04',4,'2023-08-17 11:15:46',4,0,NULL,NULL,NULL,'ee32f98e-445e-4a15-8a1e-c594ad7729b3'),(2365,'Clients given 5C with <20Copies_Viral_Load','Clients given 5C with <20Copies_Viral_Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5C with <20Copies_Viral_Load\n Clients given 5C with <20Copies_Viral_Load\n \n 2023-08-17 09:18:17 UTC\n \n 2023-08-17 09:19:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2365\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4696)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-17 11:18:17',4,'2023-08-17 11:19:06',4,0,NULL,NULL,NULL,'5fc6059b-5dca-4e92-abe4-e44c4e5f9f09'),(2366,'Clients given 5C with Undetectable Viral Load','Clients given 5C with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5C with Undetectable Viral Load\n Clients given 5C with Undetectable Viral Load\n \n 2023-08-17 09:20:42 UTC\n \n 2023-08-17 09:21:13 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2366\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4696)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- undetectable, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-17 11:20:42',4,'2023-08-17 11:21:13',4,0,NULL,NULL,NULL,'f3e6450c-1bda-42b4-87d3-352e65c53612'),(2367,'Clients given 5D with >=20Copies_Viral_Load','Clients given 5D with >=20Copies_Viral_Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5D with >=20Copies_Viral_Load\n Clients given 5D with >=20Copies_Viral_Load\n \n 2023-08-17 09:31:21 UTC\n \n 2023-08-17 09:32:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2367\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5D \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4697)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and oss.obs_datetime <= cast('2023-06-30'as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-17 11:31:21',4,'2023-08-17 11:32:04',4,0,NULL,NULL,NULL,'25589972-ceb9-4c56-bb7c-2911f712e272'),(2368,'Clients given 5D with <20Copies_Viral_Load','Clients given 5D with <20Copies_Viral_Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5D with <20Copies_Viral_Load\n Clients given 5D with <20Copies_Viral_Load\n \n 2023-08-17 09:34:28 UTC\n \n 2023-08-17 09:36:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2368\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5D \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4697)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-17 11:34:28',4,'2023-08-17 11:36:20',4,0,NULL,NULL,NULL,'a9a60d85-6eba-4872-9b0c-02c941d7ff94'),(2369,'Clients given 4D with poor adherence','Clients given 4D with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 4D with poor adherence\n Clients given 4D with poor adherence\n \n 2023-08-17 09:51:32 UTC\n \n','2023-08-17 11:51:32',4,NULL,NULL,0,NULL,NULL,NULL,'76e21882-219e-4852-aca2-a0d774c1c79b'),(2370,'Clients given 5a with poor adherence','Clients given 5a with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5a with poor adherence\n Clients given 5a with poor adherence\n \n 2023-08-17 09:51:59 UTC\n \n 2023-08-17 09:53:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2370\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5a \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3681)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-17 11:51:59',4,'2023-08-17 11:53:44',4,0,NULL,NULL,NULL,'67dd544b-2e27-408f-824b-0312d06e9785'),(2371,'Clients given 5a with fair adherence','Clients given 5a with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5a with fair adherence\n Clients given 5a with fair adherence\n \n 2023-08-17 09:56:02 UTC\n \n 2023-08-17 09:56:33 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2371\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5a \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3681)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-17 11:56:02',4,'2023-08-17 11:56:33',4,0,NULL,NULL,NULL,'93e07039-5627-49fd-9fb4-9f3cf8ddaafd'),(2372,'Clients given 5a with good adherence','Clients given 5a with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5a with good adherence\n Clients given 5a with good adherence\n \n 2023-08-17 09:57:50 UTC\n \n 2023-08-17 09:58:24 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2372\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5a \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3681)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-17 11:57:50',4,'2023-08-17 11:58:24',4,0,NULL,NULL,NULL,'94df16c2-5336-419b-be14-fe6c390dc41b'),(2373,'Clients given 5D with Undetectable Viral Load','Clients given 5D with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5D with Undetectable Viral Load\n Clients given 5D with Undetectable Viral Load\n \n 2023-08-17 09:58:03 UTC\n \n 2023-08-17 09:58:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2373\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5D \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4697)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- undetectable, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-17 11:58:03',4,'2023-08-17 11:58:42',4,0,NULL,NULL,NULL,'95abcfbb-daac-4a02-a38c-455f5f0aca2d'),(2374,'Clients given 5E with >=20Copies_Viral_Load','Clients given 5E with >=20Copies_Viral_Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5E with >=20Copies_Viral_Load\n Clients given 5E with >=20Copies_Viral_Load\n \n 2023-08-17 10:05:15 UTC\n \n 2023-08-17 10:05:33 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2374\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4698)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and oss.obs_datetime <= cast('2023-06-30'as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-17 12:05:15',4,'2023-08-17 12:05:33',4,0,NULL,NULL,NULL,'7ec09187-6a9d-403e-97c3-f7d85f2a16a2'),(2375,'Clients given 5E with <20 Copies Viral Load','Clients given 5E with <20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5E with <20 Copies Viral Load\n Clients given 5E with <20 Copies Viral Load\n \n 2023-08-17 10:06:47 UTC\n \n 2023-08-17 10:09:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2375\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4698)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-17 12:06:47',4,'2023-08-17 12:09:36',4,0,NULL,NULL,NULL,'fc0384af-2aba-4967-94cf-351c49ff4c06'),(2376,'Clients given 5b with fair adherence','Clients given 5b with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5b with fair adherence\n Clients given 5b with fair adherence\n \n 2023-08-17 10:10:23 UTC\n \n 2023-08-17 10:12:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2376\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5b \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3682)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-17 12:10:23',4,'2023-08-17 12:12:23',4,0,NULL,NULL,NULL,'efbcc56c-18cd-4533-980c-6d8cf1c02e23'),(2377,'Clients given 5E with Undetectable Viral Load','Clients given 5E with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5E with Undetectable Viral Load\n Clients given 5E with Undetectable Viral Load\n \n 2023-08-17 10:10:47 UTC\n \n 2023-08-17 10:11:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2377\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4698)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- undetectable, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-17 12:10:47',4,'2023-08-17 12:11:44',4,0,NULL,NULL,NULL,'c1b14868-35fc-4ced-b9d6-d7434dbe4b96'),(2378,'Clients given 5b with good adherence','Clients given 5b with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5b with good adherence\n Clients given 5b with good adherence\n \n 2023-08-17 10:14:15 UTC\n \n 2023-08-17 10:15:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2378\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5b \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3682)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-17 12:14:15',4,'2023-08-17 12:15:01',4,0,NULL,NULL,NULL,'602e0915-bb58-4b03-a63e-ed3a6f83cc33'),(2379,'Clients given 5b with poor adherence','Clients given 5b with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5b with poor adherence\n Clients given 5b with poor adherence\n \n 2023-08-17 10:20:28 UTC\n \n 2023-08-17 10:24:24 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2379\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5b \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3682)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-17 12:20:28',4,'2023-08-17 12:24:24',4,0,NULL,NULL,NULL,'02a6a90c-a410-4c5e-a32f-a56f6dad4a49'),(2380,'Clients given 5F with >=20Copies Viral Load','Clients given 5F with >=20Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5F with >=20Copies Viral Load\n Clients given 5F with >=20Copies Viral Load\n \n 2023-08-17 10:20:38 UTC\n \n 2023-08-17 10:22:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2380\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4699)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n (SELECT weight_.Id, _weight \n from \n (select oss.person_id as Id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_numeric)), 20) as _weight \n from obs oss \n where oss.concept_id = 119 and oss.voided=0 \n and oss.obs_datetime <= cast(:endDate as date) \n group by oss.person_id)AS weight_ \n where _weight >= 20 and _weight <= 24.9)peads_weight \n ON Active_Patients.Id = peads_weight.Id \n \n)) \n \n\n','2023-08-17 12:20:38',4,'2023-08-17 12:22:29',4,0,NULL,NULL,NULL,'ed92d4db-077e-4eae-9c2c-963d455b9df3'),(2381,'Clients given 5F with <20 Copies Viral Load','Clients given 5F with <20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5F with <20 Copies Viral Load\n Clients given 5F with <20 Copies Viral Load\n \n 2023-08-17 10:27:57 UTC\n \n 2023-08-17 10:34:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2381\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4699)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-17 12:27:57',4,'2023-08-17 12:34:06',4,0,NULL,NULL,NULL,'9ca8ee52-584e-4164-85a0-73c3afffa236'),(2382,'Clients given 5F with Undetectable Viral Load','Clients given 5F with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5F with Undetectable Viral Load\n Clients given 5F with Undetectable Viral Load\n \n 2023-08-17 10:36:35 UTC\n \n 2023-08-17 10:37:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2382\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4699)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- undetectable, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-17 12:36:35',4,'2023-08-17 12:37:44',4,0,NULL,NULL,NULL,'fddbb793-03b3-432b-aa85-1afddec431d9'),(2383,'Clients given 5c with poor adherence','Clients given 5c with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5c with poor adherence\n Clients given 5c with poor adherence\n \n 2023-08-17 10:39:09 UTC\n \n 2023-08-17 10:40:19 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2383\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5c \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4696)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-17 12:39:09',4,'2023-08-17 12:40:19',4,0,NULL,NULL,NULL,'15d7e4f8-1626-4a98-ae7d-494e2cb6f49b'),(2384,'Clients given 5G with >=20Copies Viral Load','Clients given 5G with >=20Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G with >=20Copies Viral Load\n Clients given 5G with >=20Copies Viral Load\n \n 2023-08-17 10:42:06 UTC\n \n 2023-08-17 10:42:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2384\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4700)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and oss.obs_datetime <= cast('2023-06-30'as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-17 12:42:06',4,'2023-08-17 12:42:29',4,0,NULL,NULL,NULL,'2a249734-89d9-4f4c-bcab-dff2815d3b58'),(2385,'Clients given 5c with fair adherence','Clients given 5c with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5c with fair adherence\n Clients given 5c with fair adherence\n \n 2023-08-17 10:42:21 UTC\n \n 2023-08-17 10:43:23 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2385\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5c \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4696)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-17 12:42:21',4,'2023-08-17 12:43:23',4,0,NULL,NULL,NULL,'4d26e5f3-76e3-49fc-8a3c-f5de81a7724d'),(2386,'Clients given 5G with <20 Copies Viral Load','Clients given 5G with <20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G with <20 Copies Viral Load\n Clients given 5G with <20 Copies Viral Load\n \n 2023-08-17 10:45:37 UTC\n \n 2023-08-17 10:48:38 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2386\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4700)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-17 12:45:37',4,'2023-08-17 12:48:38',4,0,NULL,NULL,NULL,'353bb356-a392-4c21-8641-40fd092426ce'),(2387,'Clients given 5c with good adherence','Clients given 5c with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5c with good adherence\n Clients given 5c with good adherence\n \n 2023-08-17 10:56:34 UTC\n \n 2023-08-17 10:57:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2387\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5c \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4696)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-17 12:56:34',4,'2023-08-17 12:57:29',4,0,NULL,NULL,NULL,'3f30f547-9fa6-4336-b034-e79a64906b6c'),(2388,'Clients given 5G with Undetectable Viral Load','Clients given 5G with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G with Undetectable Viral Load\n Clients given 5G with Undetectable Viral Load\n \n 2023-08-17 10:58:06 UTC\n \n 2023-08-17 10:58:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2388\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5G \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4700)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- undetectable, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-17 12:58:06',4,'2023-08-17 12:58:41',4,0,NULL,NULL,NULL,'7cb7f18e-986e-4854-be48-ca51e1d753dc'),(2389,'Clients given 5d with poor adherence','Clients given 5d with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5d with poor adherence\n Clients given 5d with poor adherence\n \n 2023-08-17 11:03:17 UTC\n \n 2023-08-17 11:03:56 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2389\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5d \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4697)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-17 13:03:17',4,'2023-08-17 13:03:56',4,0,NULL,NULL,NULL,'77c59203-be56-4041-abaf-eb409f199aab'),(2390,'Clients given 5d with fair adherence','Clients given 5d with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5d with fair adherence\n Clients given 5d with fair adherence\n \n 2023-08-17 11:06:27 UTC\n \n 2023-08-17 11:07:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2390\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5d \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4697)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-17 13:06:27',4,'2023-08-17 13:07:15',4,0,NULL,NULL,NULL,'33ef5391-29b2-426b-bb43-75f88df81f18'),(2391,'Clients given 5H with >=20Copies Viral Load','Clients given 5H with >=20Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5H with >=20Copies Viral Load\n Clients given 5H with >=20Copies Viral Load\n \n 2023-08-17 11:06:39 UTC\n \n 2023-08-17 11:07:19 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2391\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND MONTH(os.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4701)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and oss.obs_datetime <= cast('2023-06-30'as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-17 13:06:39',4,'2023-08-17 13:07:19',4,0,NULL,NULL,NULL,'a6c02fb1-c931-4405-9dcd-1fa775e9d262'),(2392,':Clients given 5d with good adherence',':Clients given 5d with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n :Clients given 5d with good adherence\n :Clients given 5d with good adherence\n \n 2023-08-17 11:08:05 UTC\n \n 2023-08-17 11:08:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2392\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5d \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4697)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-17 13:08:05',4,'2023-08-17 13:08:51',4,0,NULL,NULL,NULL,'478a65e7-cbfc-4d04-bcbf-e97ad2119117'),(2393,'Clients given 5H with <20 Copies Viral Load','Clients given 5H with <20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5H with <20 Copies Viral Load\n Clients given 5H with <20 Copies Viral Load\n \n 2023-08-17 11:08:35 UTC\n \n 2023-08-17 11:09:13 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2393\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND MONTH(os.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4701)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-17 13:08:35',4,'2023-08-17 13:09:13',4,0,NULL,NULL,NULL,'92d662a9-7c9c-4d7f-8105-7892cc50f8df'),(2394,'Clients given 5H with Undetectable Viral Load','Clients given 5H with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5H with Undetectable Viral Load\n Clients given 5H with Undetectable Viral Load\n \n 2023-08-17 11:10:21 UTC\n \n 2023-08-17 11:12:04 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2394\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5H \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and obs_datetime <= cast(:endDate as date) \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND MONTH(os.value_datetime) = MONTH(CAST(:endDate AS DATE)) \n AND YEAR(os.value_datetime) = YEAR(CAST(:endDate AS DATE)) \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where death_date <= cast(:endDate as date) \n and dead = 1 \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4701)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- undetectable, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-17 13:10:21',4,'2023-08-17 13:12:04',4,0,NULL,NULL,NULL,'67ad52ec-1ca8-4bd4-977e-cb0930173888'),(2395,'Clients given 5e with poor adherence','Clients given 5e with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5e with poor adherence\n Clients given 5e with poor adherence\n \n 2023-08-17 11:11:53 UTC\n \n 2023-08-17 11:12:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2395\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5e \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4698)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-17 13:11:53',4,'2023-08-17 13:12:26',4,0,NULL,NULL,NULL,'13802910-1107-47fe-82b8-60340f77abef'),(2396,'Clients given 5e with fair adherence','Clients given 5e with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5e with fair adherence\n Clients given 5e with fair adherence\n \n 2023-08-17 11:13:19 UTC\n \n 2023-08-17 11:13:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2396\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5e \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4698)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-17 13:13:19',4,'2023-08-17 13:13:43',4,0,NULL,NULL,NULL,'6585614b-c405-4fe5-bcb0-8edae5825b41'),(2397,'Clients given 5e with good adherence','Clients given 5e with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5e with good adherence\n Clients given 5e with good adherence\n \n 2023-08-17 11:17:29 UTC\n \n 2023-08-17 11:18:09 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2397\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5e \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4698)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-17 13:17:29',4,'2023-08-17 13:18:09',4,0,NULL,NULL,NULL,'dc9c0189-b91f-4b80-a484-67e2f5b4005c'),(2398,'Clients given 6A with >=20Copies Viral Load','Clients given 6A with >=20Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6A with >=20Copies Viral Load\n Clients given 6A with >=20Copies Viral Load\n \n 2023-08-17 11:19:05 UTC\n \n 2023-08-17 11:19:35 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2398\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6A \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and oss.obs_datetime <= cast('2023-06-30'as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-17 13:19:05',4,'2023-08-17 13:19:35',4,0,NULL,NULL,NULL,'b0f47001-fdc3-4ea5-be0c-00112fab3bc8'),(2399,'Clients given 6A with <20 Copies Viral Load','Clients given 6A with <20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6A with <20 Copies Viral Load\n Clients given 6A with <20 Copies Viral Load\n \n 2023-08-17 11:21:31 UTC\n \n 2023-08-17 11:22:34 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2399\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6A \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n \n)) \n \n\n','2023-08-17 13:21:31',4,'2023-08-17 13:22:34',4,0,NULL,NULL,NULL,'b912ab78-0fb9-4639-a1f4-56f1e6b2e44e'),(2400,'Clients given 6A with Undetectable Viral Load','Clients given 6A with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6A with Undetectable Viral Load\n Clients given 6A with Undetectable Viral Load\n \n 2023-08-17 11:23:42 UTC\n \n 2023-08-17 11:24:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2400\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6A \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- undetectable, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n \n)) \n \n\n','2023-08-17 13:23:42',4,'2023-08-17 13:24:21',4,0,NULL,NULL,NULL,'2801df34-8bcf-4a7b-bc89-1210ad3d727d'),(2401,'Clients given 5f with poor adherence','Clients given 5f with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5f with poor adherence\n Clients given 5f with poor adherence\n \n 2023-08-17 11:26:41 UTC\n \n 2023-08-17 11:27:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2401\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5f \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4699)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-17 13:26:41',4,'2023-08-17 13:27:36',4,0,NULL,NULL,NULL,'c0c6a92f-87ed-4149-85af-4ed2e31328ac'),(2402,'Clients given 6B with >=20Copies Viral Load','Clients given 6B with >=20Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6B with >=20Copies Viral Load\n Clients given 6B with >=20Copies Viral Load\n \n 2023-08-17 11:27:26 UTC\n \n 2023-08-17 11:31:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2402\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6B \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and oss.obs_datetime <= cast('2023-06-30'as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-17 13:27:26',4,'2023-08-17 13:31:50',4,0,NULL,NULL,NULL,'c01f687e-baef-4589-b4fd-63abfc132991'),(2403,'Clients given 6B with <20 Copies Viral Load','Clients given 6B with <20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6B with <20 Copies Viral Load\n Clients given 6B with <20 Copies Viral Load\n \n 2023-08-17 11:29:39 UTC\n \n 2023-08-17 11:30:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2403\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6B \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-17 13:29:39',4,'2023-08-17 13:30:18',4,0,NULL,NULL,NULL,'f6a13155-22a3-4ecc-80bf-dfef935ebf86'),(2404,'Clients given 5f with fair adherence','Clients given 5f with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5f with fair adherence\n Clients given 5f with fair adherence\n \n 2023-08-17 11:31:51 UTC\n \n 2023-08-17 11:32:47 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2404\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5f \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4699)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-17 13:31:51',4,'2023-08-17 13:32:47',4,0,NULL,NULL,NULL,'250972a3-6fab-4d66-a028-7c43751cf95d'),(2405,'Clients given 6B with Undetectable Viral Load','Clients given 6B with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6B with Undetectable Viral Load\n Clients given 6B with Undetectable Viral Load\n \n 2023-08-17 11:32:32 UTC\n \n 2023-08-17 11:33:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2405\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6B \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- undetectable, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-17 13:32:32',4,'2023-08-17 13:33:32',4,0,NULL,NULL,NULL,'8a1f9b0e-f55d-40ed-b59f-92971f598921'),(2406,'Clients given 5f with good adherence','Clients given 5f with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5f with good adherence\n Clients given 5f with good adherence\n \n 2023-08-17 11:36:40 UTC\n \n 2023-08-17 11:37:11 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2406\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5f \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4699)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-17 13:36:40',4,'2023-08-17 13:37:11',4,0,NULL,NULL,NULL,'8839041b-b3d1-48b1-a0b2-bc09f91cad73'),(2407,'Clients given 6C with >=20 Copies Viral Load','Clients given 6C with >=20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C with >=20 Copies Viral Load\n Clients given 6C with >=20 Copies Viral Load\n \n 2023-08-17 11:39:53 UTC\n \n 2023-08-17 11:40:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2407\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4702)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and oss.obs_datetime <= cast('2023-06-30'as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-17 13:39:53',4,'2023-08-17 13:40:55',4,0,NULL,NULL,NULL,'c44258e3-391b-4e79-87f6-c647692cb3a1'),(2408,'Clients given 5g with poor adherence','Clients given 5g with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5g with poor adherence\n Clients given 5g with poor adherence\n \n 2023-08-17 11:41:26 UTC\n \n 2023-08-17 11:41:56 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2408\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5g \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4700)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-17 13:41:26',4,'2023-08-17 13:41:56',4,0,NULL,NULL,NULL,'a21e3c23-e513-4a3f-b229-b0baad328af6'),(2409,'Clients given 6C with <20 Copies Viral Load','Clients given 6C with <20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C with <20 Copies Viral Load\n Clients given 6C with <20 Copies Viral Load\n \n 2023-08-17 11:42:38 UTC\n \n 2023-08-17 11:43:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2409\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4702)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-17 13:42:38',4,'2023-08-17 13:43:20',4,0,NULL,NULL,NULL,'307392db-30aa-4e4c-a692-ab8350cb3f42'),(2410,'Clients given 5g with fair adherence','Clients given 5g with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5g with fair adherence\n Clients given 5g with fair adherence\n \n 2023-08-17 11:43:06 UTC\n \n 2023-08-17 11:43:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2410\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5g \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4700)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-17 13:43:06',4,'2023-08-17 13:43:28',4,0,NULL,NULL,NULL,'0875bc5c-9df9-43d6-8e7a-5363f19adc4f'),(2411,'Clients given 6C with Undetectable Viral Load','Clients given 6C with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6C with Undetectable Viral Load\n Clients given 6C with Undetectable Viral Load\n \n 2023-08-17 11:45:31 UTC\n \n 2023-08-17 11:46:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2411\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6C \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4702)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- undetectable, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-17 13:45:31',4,'2023-08-17 13:46:32',4,0,NULL,NULL,NULL,'eb4392cf-c7f5-43c2-8f45-b56f46771ea3'),(2412,'Clients given 5g with good adherence','Clients given 5g with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5g with good adherence\n Clients given 5g with good adherence\n \n 2023-08-17 11:46:09 UTC\n \n 2023-08-17 11:46:30 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2412\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5g \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4700)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-17 13:46:09',4,'2023-08-17 13:46:30',4,0,NULL,NULL,NULL,'9878645d-2648-4c62-8679-1449355eaf0a'),(2413,'Clients given 5h with poor adherence','Clients given 5h with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5h with poor adherence\n Clients given 5h with poor adherence\n \n 2023-08-17 11:49:55 UTC\n \n 2023-08-17 11:51:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2413\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5h \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4701)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-17 13:49:55',4,'2023-08-17 13:51:43',4,0,NULL,NULL,NULL,'ad1e42cb-ff60-47fd-b8b1-0649da1899a1'),(2414,'Clients given 6D with >=20Copies Viral Load','Clients given 6D with >=20Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D with >=20Copies Viral Load\n Clients given 6D with >=20Copies Viral Load\n \n 2023-08-17 11:50:35 UTC\n \n 2023-08-17 11:51:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2414\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6D \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4703)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and oss.obs_datetime <= cast('2023-06-30'as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-17 13:50:35',4,'2023-08-17 13:51:45',4,0,NULL,NULL,NULL,'dbcd7d71-ba25-4619-8d23-dd2592aaf59a'),(2415,'Clients given 6D with <20 Copies Viral Load','Clients given 6D with <20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D with <20 Copies Viral Load\n Clients given 6D with <20 Copies Viral Load\n \n 2023-08-17 11:53:15 UTC\n \n 2023-08-17 11:54:09 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2415\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6D \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4703)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-17 13:53:15',4,'2023-08-17 13:54:09',4,0,NULL,NULL,NULL,'0199fd5f-2426-4c4e-b266-818a815ba80a'),(2416,'Clients given 5h with fair adherence','Clients given 5h with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5h with fair adherence\n Clients given 5h with fair adherence\n \n 2023-08-17 11:54:17 UTC\n \n 2023-08-17 11:54:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2416\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5h \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4701)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-17 13:54:17',4,'2023-08-17 13:54:39',4,0,NULL,NULL,NULL,'5478dbb5-4f3d-4a39-b263-625158d98129'),(2417,'Clients given 6D with Undetectable Viral Load','Clients given 6D with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6D with Undetectable Viral Load\n Clients given 6D with Undetectable Viral Load\n \n 2023-08-17 11:55:34 UTC\n \n 2023-08-17 11:56:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2417\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6D \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4703)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- undetectable, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-17 13:55:34',4,'2023-08-17 13:56:31',4,0,NULL,NULL,NULL,'10a317c1-829c-4739-b7c0-f0b4ba18a69f'),(2418,'Clients given 5h with good adherence','Clients given 5h with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5h with good adherence\n Clients given 5h with good adherence\n \n 2023-08-17 11:57:56 UTC\n \n 2023-08-17 11:58:25 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2418\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5h \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4701)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-17 13:57:56',4,'2023-08-17 13:58:25',4,0,NULL,NULL,NULL,'00df085c-fd67-466a-94fa-2807a5cce6f7'),(2419,'Clients given 6E with >=20Copies Viral Load','Clients given 6E with >=20Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E with >=20Copies Viral Load\n Clients given 6E with >=20Copies Viral Load\n \n 2023-08-17 12:02:11 UTC\n \n 2023-08-17 12:04:41 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2419\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4704)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and oss.obs_datetime <= cast('2023-06-30'as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-17 14:02:11',4,'2023-08-17 14:04:41',4,0,NULL,NULL,NULL,'7c9d1608-dd16-4a6f-a811-aa9c285da131'),(2420,'Clients given 6a with poor adherence','Clients given 6a with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6a with poor adherence\n Clients given 6a with poor adherence\n \n 2023-08-17 12:07:35 UTC\n \n 2023-08-17 12:07:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2420\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6a \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-17 14:07:35',4,'2023-08-17 14:07:53',4,0,NULL,NULL,NULL,'b1f7d697-7125-4ad4-b73d-8538c0d0bf37'),(2421,'Clients given 6E with <20 Copies Viral Load','Clients given 6E with <20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E with <20 Copies Viral Load\n Clients given 6E with <20 Copies Viral Load\n \n 2023-08-17 12:07:43 UTC\n \n 2023-08-17 12:08:22 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2421\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4704)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-17 14:07:43',4,'2023-08-17 14:08:22',4,0,NULL,NULL,NULL,'76cdd1d3-9bb0-462b-a63d-5babfae535ae'),(2422,'Clients given 6a with fair adherence','Clients given 6a with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6a with fair adherence\n Clients given 6a with fair adherence\n \n 2023-08-17 12:09:05 UTC\n \n 2023-08-17 12:09:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2422\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6a \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-17 14:09:05',4,'2023-08-17 14:09:40',4,0,NULL,NULL,NULL,'7caf8270-2015-4b33-9cc4-2d23dcbbdd40'),(2423,'Clients given 6E with Undetectable Viral Load','Clients given 6E with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6E with Undetectable Viral Load\n Clients given 6E with Undetectable Viral Load\n \n 2023-08-17 12:09:16 UTC\n \n 2023-08-17 12:10:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2423\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6E \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4704)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- undetectable, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-17 14:09:16',4,'2023-08-17 14:10:12',4,0,NULL,NULL,NULL,'42483bdd-5217-4e57-acfb-9dd6c405fc4e'),(2424,'Clients given 6a with good adherence','Clients given 6a with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6a with good adherence\n Clients given 6a with good adherence\n \n 2023-08-17 12:11:25 UTC\n \n 2023-08-17 12:11:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2424\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6a \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3686)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-17 14:11:25',4,'2023-08-17 14:11:53',4,0,NULL,NULL,NULL,'495d25ab-dea0-49b3-89de-2f64548597eb'),(2425,'Clients given 6F with >=20Copies Viral Load','Clients given 6F with >=20Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F with >=20Copies Viral Load\n Clients given 6F with >=20Copies Viral Load\n \n 2023-08-17 12:12:26 UTC\n \n 2023-08-17 12:13:56 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2425\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4705)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- >=20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and oss.obs_datetime <= cast('2023-06-30'as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- >=20 Copies \n where o.concept_id = 4266 and o.value_coded = 4265 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) greaterThan20 \non Active_Patients.Id = greaterThan20.Id \n \n)) \n \n\n','2023-08-17 14:12:26',4,'2023-08-17 14:13:56',4,0,NULL,NULL,NULL,'72be7653-8e41-42f4-9a8d-caa979c15ef6'),(2426,'Clients given 6F with <20 Copies Viral Load','Clients given 6F with <20 Copies Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F with <20 Copies Viral Load\n Clients given 6F with <20 Copies Viral Load\n \n 2023-08-17 12:14:54 UTC\n \n 2023-08-17 12:15:37 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2426\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4705)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- <20 Copies, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- <20 Copies \n where o.concept_id = 4266 and o.value_coded = 4264 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) lessThan20 \non Active_Patients.Id = lessThan20.Id \n \n)) \n \n\n','2023-08-17 14:14:54',4,'2023-08-17 14:15:37',4,0,NULL,NULL,NULL,'d11f84f3-e524-4688-9ad5-450362112a3d'),(2427,'Clients given 6b with poor adherence','Clients given 6b with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6b with poor adherence\n Clients given 6b with poor adherence\n \n 2023-08-17 12:15:12 UTC\n \n 2023-08-17 12:16:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2427\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6b \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-17 14:15:12',4,'2023-08-17 14:16:00',4,0,NULL,NULL,NULL,'c16525a3-70e2-41e5-948b-171525dbc0aa'),(2428,'Clients given 6F with Undetectable Viral Load','Clients given 6F with Undetectable Viral Load','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6F with Undetectable Viral Load\n Clients given 6F with Undetectable Viral Load\n \n 2023-08-17 12:16:55 UTC\n \n 2023-08-17 12:17:37 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2428\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6F \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4705)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n-- undetectable, Vira load results \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as observation_id \n from obs oss \n -- Viral load form \n where oss.concept_id = 4273 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n -- Undetectable \n where o.concept_id = 4266 and o.value_coded = 4263 \n and o.obs_datetime = max_observation \n group by o.person_id \n ) Undetectable \non Active_Patients.Id = Undetectable.Id \n \n)) \n \n\n','2023-08-17 14:16:55',4,'2023-08-17 14:17:37',4,0,NULL,NULL,NULL,'e278c929-0e08-4577-92f9-e1a972fcf688'),(2429,'Clients given 5a with >=20Copies Viral Load','Clients given 5a with >=20Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5a with >=20Copies Viral Load\n Clients given 5a with >=20Copies Viral Load\n \n 2023-08-17 12:19:02 UTC\n \n 2023-08-17 12:21:57 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2429\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 14:19:02',4,'2023-08-17 14:21:57',4,0,NULL,NULL,NULL,'ac679df3-e5a4-4548-ba63-4fd778196ea4'),(2430,'Clients given 6b with fair adherence','Clients given 6b with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6b with fair adherence\n Clients given 6b with fair adherence\n \n 2023-08-17 12:19:38 UTC\n \n 2023-08-17 12:19:59 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2430\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6b \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-17 14:19:38',4,'2023-08-17 14:19:59',4,0,NULL,NULL,NULL,'c4aaf23a-6f87-424e-b8d6-b1519273b376'),(2431,'Clients given 6b with good adherence','Clients given 6b with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6b with good adherence\n Clients given 6b with good adherence\n \n 2023-08-17 12:21:00 UTC\n \n 2023-08-17 12:21:45 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2431\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6b \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 3687)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-17 14:21:00',4,'2023-08-17 14:21:45',4,0,NULL,NULL,NULL,'96917926-b178-4bf4-8113-7300329ee951'),(2432,'Clients given 5A with <20Copies Viral Load','Clients given 5A with <20Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5A with <20Copies Viral Load\n Clients given 5A with <20Copies Viral Load\n \n 2023-08-17 12:23:16 UTC\n \n 2023-08-17 12:25:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2432\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 14:23:16',4,'2023-08-17 14:25:32',4,0,NULL,NULL,NULL,'9a1038ff-dcfd-4b2c-93a9-d7c68030d1ef'),(2433,'Clients given 5A with Undetectable Viral Load','Clients given 5A with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5A with Undetectable Viral Load\n Clients given 5A with Undetectable Viral Load\n \n 2023-08-17 12:27:23 UTC\n \n 2023-08-17 12:28:22 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2433\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 14:27:23',4,'2023-08-17 14:28:22',4,0,NULL,NULL,NULL,'f401ae7b-f27f-4b25-926f-65e3b8c81863'),(2434,'Clients given 5B with >=20Copies Viral Load','Clients given 5B with >=20Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5B with >=20Copies Viral Load\n Clients given 5B with >=20Copies Viral Load\n \n 2023-08-17 12:29:26 UTC\n \n 2023-08-17 12:33:25 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2434\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 14:29:26',4,'2023-08-17 14:33:25',4,0,NULL,NULL,NULL,'938a8cf8-cfb9-422e-be17-3a1e59e3c135'),(2435,'Clients given 6c with poor adherence','Clients given 6c with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6c with poor adherence\n Clients given 6c with poor adherence\n \n 2023-08-17 12:34:23 UTC\n \n 2023-08-17 12:35:25 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2435\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6c \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4702)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-17 14:34:23',4,'2023-08-17 14:35:25',4,0,NULL,NULL,NULL,'a854add1-66a5-4624-94b8-ee9cc9f6b618'),(2436,'Clients given 5B with <20 Copies Viral Load','','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5B with <20 Copies Viral Load\n \n \n 2023-08-17 12:34:37 UTC\n \n 2023-08-17 12:35:36 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2436\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 14:34:37',4,'2023-08-17 14:35:36',4,0,NULL,NULL,NULL,'160dcddc-c186-4d31-a0c8-47edca4fc581'),(2437,'Clients given 5B with Undetectable Viral Load','Clients given 5B with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5B with Undetectable Viral Load\n Clients given 5B with Undetectable Viral Load\n \n 2023-08-17 12:36:46 UTC\n \n 2023-08-17 12:38:09 UTC\n \n \n endDate\n \n java.util.Date\n true\n \n \n startDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2437\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 14:36:46',4,'2023-08-17 14:38:09',4,0,NULL,NULL,NULL,'5f976c00-44ef-4b36-bed0-b976bb7f2b55'),(2438,'Clients given 6c with fair adherence','Clients given 6c with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6c with fair adherence\n Clients given 6c with fair adherence\n \n 2023-08-17 12:36:48 UTC\n \n 2023-08-17 12:37:12 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2438\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6c \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4702)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-17 14:36:48',4,'2023-08-17 14:37:12',4,0,NULL,NULL,NULL,'65b4eb44-cc9f-494e-b621-ee1bdedbc549'),(2439,'Clients given 6c with good adherence','Clients given 6c with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6c with good adherence\n Clients given 6c with good adherence\n \n 2023-08-17 12:38:40 UTC\n \n 2023-08-17 12:38:57 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2439\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6c \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4702)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-17 14:38:40',4,'2023-08-17 14:38:57',4,0,NULL,NULL,NULL,'17b46231-8af2-49d6-ab43-17a6d13d30d4'),(2440,'Clients given 5C with >=20 Copies Viral Load','Clients given 5C with >=20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5C with >=20 Copies Viral Load\n Clients given 5C with >=20 Copies Viral Load\n \n 2023-08-17 12:38:53 UTC\n \n 2023-08-17 12:39:46 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2440\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 14:38:53',4,'2023-08-17 14:39:46',4,0,NULL,NULL,NULL,'ddd536bc-c879-4847-9c50-cc79a002813e'),(2441,'Clients given 6d with poor adherence','Clients given 6d with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6d with poor adherence\n Clients given 6d with poor adherence\n \n 2023-08-17 12:40:45 UTC\n \n 2023-08-17 12:41:01 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2441\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6d \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4703)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-17 14:40:45',4,'2023-08-17 14:41:01',4,0,NULL,NULL,NULL,'fa914aa2-ce96-4063-a749-7718cf76a361'),(2442,'Clients given 5C with <20 Copies Viral Load','Clients given 5C with <20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5C with <20 Copies Viral Load\n Clients given 5C with <20 Copies Viral Load\n \n 2023-08-17 12:41:03 UTC\n \n 2023-08-17 12:43:01 UTC\n \n \n endDate\n \n java.util.Date\n true\n \n \n startDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2442\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 14:41:03',4,'2023-08-17 14:43:01',4,0,NULL,NULL,NULL,'394324e6-b5b5-406f-9fb0-83194dc1b533'),(2443,'Clients given 6d with fair adherence','Clients given 6d with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6d with fair adherence\n Clients given 6d with fair adherence\n \n 2023-08-17 12:41:48 UTC\n \n 2023-08-17 12:42:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2443\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6d \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4703)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-17 14:41:48',4,'2023-08-17 14:42:15',4,0,NULL,NULL,NULL,'6a150299-a792-4070-953d-c475224522f9'),(2444,' Clients given 6d with good adherence',' Clients given 6d with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6d with good adherence\n Clients given 6d with good adherence\n \n 2023-08-17 12:43:47 UTC\n \n 2023-08-17 12:44:08 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2444\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6d \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4703)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-17 14:43:47',4,'2023-08-17 14:44:08',4,0,NULL,NULL,NULL,'66ddc4ec-de69-43a5-8cda-3e7f9f8d28af'),(2445,'Clients given 5C with Undetectable Viral Load','Clients given 5C with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5C with Undetectable Viral Load\n Clients given 5C with Undetectable Viral Load\n \n 2023-08-17 12:44:54 UTC\n \n 2023-08-17 12:50:20 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2445\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 14:44:54',4,'2023-08-17 14:50:20',4,0,NULL,NULL,NULL,'c75e1385-b87e-49d1-a8ba-418f96c68379'),(2446,'Clients given 6e with poor adherence','Clients given 6e with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6e with poor adherence\n Clients given 6e with poor adherence\n \n 2023-08-17 12:49:27 UTC\n \n 2023-08-17 12:49:43 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2446\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6e \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4704)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-17 14:49:27',4,'2023-08-17 14:49:43',4,0,NULL,NULL,NULL,'0a65b09f-f0a6-45a6-a240-46f0a48dda2a'),(2447,'Clients given 6e with fair adherence','Clients given 6e with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6e with fair adherence\n Clients given 6e with fair adherence\n \n 2023-08-17 12:50:30 UTC\n \n 2023-08-17 12:50:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2447\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6e \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4704)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-17 14:50:30',4,'2023-08-17 14:50:58',4,0,NULL,NULL,NULL,'3e2fec32-323e-453b-b4e1-23e746f37f1a'),(2448,'Clients given 6e with good adherence','Clients given 6e with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6e with good adherence\n Clients given 6e with good adherence\n \n 2023-08-17 12:52:12 UTC\n \n 2023-08-17 12:53:46 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2448\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6e \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4704)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-17 14:52:12',4,'2023-08-17 14:53:46',4,0,NULL,NULL,NULL,'ca2d72c9-cfb8-44bd-8859-2813817d6a80'),(2449,'Clients given 6f with poor adherence','Clients given 6f with poor adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6f with poor adherence\n Clients given 6f with poor adherence\n \n 2023-08-17 12:55:45 UTC\n \n 2023-08-17 12:56:07 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2449\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6f \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4705)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 3702 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 3702 \n and o.obs_datetime = max_observation \n ) poor_adherence \non Active_Patients.Id = poor_adherence.Id \n)) \n \n\n','2023-08-17 14:55:45',4,'2023-08-17 14:56:07',4,0,NULL,NULL,NULL,'68e19030-f17c-4489-8e26-e854ac11fcde'),(2450,'Clients given 6f with fair adherence','Clients given 6f with fair adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6f with fair adherence\n Clients given 6f with fair adherence\n \n 2023-08-17 12:56:59 UTC\n \n 2023-08-17 12:57:27 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2450\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6f \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4705)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2306 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2306 \n and o.obs_datetime = max_observation \n ) fair_adherence \non Active_Patients.Id = fair_adherence.Id \n)) \n \n\n','2023-08-17 14:56:59',4,'2023-08-17 14:57:27',4,0,NULL,NULL,NULL,'9680051f-31ff-417c-9560-8bfce8b63699'),(2451,'Clients given 6f with good adherence','Clients given 6f with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 6f with good adherence\n Clients given 6f with good adherence\n \n 2023-08-17 12:57:57 UTC\n \n 2023-08-17 12:58:15 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2451\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 6f \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4705)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-17 14:57:57',4,'2023-08-17 14:58:15',4,0,NULL,NULL,NULL,'44fef653-ab93-4af5-a5b4-84c2dc981aee'),(2452,'Clients given 5D with >=20Copies_Viral_Load','Clients given 5D with >=20Copies_Viral_Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5D with >=20Copies_Viral_Load\n Clients given 5D with >=20Copies_Viral_Load\n \n 2023-08-17 13:57:36 UTC\n \n 2023-08-17 14:00:01 UTC\n \n \n endDate\n \n java.util.Date\n true\n \n \n startDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2452\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 15:57:36',4,'2023-08-17 16:00:01',4,0,NULL,NULL,NULL,'bcaf7abb-e0b1-4b0d-8bce-72a0bcd6aa19'),(2453,'Clients given 5a with poor adherence','Clients given 5a with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5a with poor adherence\n Clients given 5a with poor adherence\n \n 2023-08-17 13:57:52 UTC\n \n 2023-08-17 13:59:50 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2453\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 15:57:52',4,'2023-08-17 15:59:50',4,0,NULL,NULL,NULL,'a744dde1-e30e-4a5c-877e-a5ad781ff393'),(2454,'Clients given 5a with fair adherence','Clients given 5a with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5a with fair adherence\n Clients given 5a with fair adherence\n \n 2023-08-17 14:01:28 UTC\n \n 2023-08-17 14:02:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2454\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:01:28',4,'2023-08-17 16:02:53',4,0,NULL,NULL,NULL,'63a61c4d-d9b0-4d4b-91a9-9aeba57141aa'),(2455,'Clients given 5D with <20Copies_Viral_Load','Clients given 5D with <20Copies_Viral_Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5D with <20Copies_Viral_Load\n Clients given 5D with <20Copies_Viral_Load\n \n 2023-08-17 14:01:35 UTC\n \n 2023-08-17 14:02:39 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2455\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:01:35',4,'2023-08-17 16:02:39',4,0,NULL,NULL,NULL,'ec730cde-9848-44d6-93c0-081b9faf2710'),(2456,'Clients given 5D with Undetectable Viral Load','Clients given 5D with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5D with Undetectable Viral Load\n Clients given 5D with Undetectable Viral Load\n \n 2023-08-17 14:03:49 UTC\n \n 2023-08-17 14:05:14 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2456\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:03:49',4,'2023-08-17 16:05:14',4,0,NULL,NULL,NULL,'f254459b-e8e8-4930-837c-a1c156604ebf'),(2457,'Clients given 5E with >=20Copies_Viral_Load','Clients given 5E with >=20Copies_Viral_Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5E with >=20Copies_Viral_Load\n Clients given 5E with >=20Copies_Viral_Load\n \n 2023-08-17 14:05:53 UTC\n \n 2023-08-17 14:06:48 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2457\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:05:53',4,'2023-08-17 16:06:48',4,0,NULL,NULL,NULL,'4bea5c18-e6c1-4c17-b1d2-df2a72d826b4'),(2458,'Clients given 5a with good adherence','Clients given 5a with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5a with good adherence\n Clients given 5a with good adherence\n \n 2023-08-17 14:06:18 UTC\n \n 2023-08-17 14:07:21 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2458\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:06:18',4,'2023-08-17 16:07:21',4,0,NULL,NULL,NULL,'6b4360ec-6413-487c-b5ce-6306a93d594d'),(2459,'Clients given 5E with <20 Copies Viral Load','Clients given 5E with <20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5E with <20 Copies Viral Load\n Clients given 5E with <20 Copies Viral Load\n \n 2023-08-17 14:07:29 UTC\n \n 2023-08-17 14:08:34 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2459\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:07:29',4,'2023-08-17 16:08:34',4,0,NULL,NULL,NULL,'2941db2b-ab51-4716-85b7-d433faab7089'),(2460,'Clients given 5b with poor adherence','Clients given 5b with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5b with poor adherence\n Clients given 5b with poor adherence\n \n 2023-08-17 14:08:02 UTC\n \n 2023-08-17 14:08:58 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2460\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:08:02',4,'2023-08-17 16:08:58',4,0,NULL,NULL,NULL,'40f47ac2-87c8-4b1c-a673-ce43a9e640ae'),(2461,'Clients given 5E with Undetectable Viral Load','Clients given 5E with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5E with Undetectable Viral Load\n Clients given 5E with Undetectable Viral Load\n \n 2023-08-17 14:09:17 UTC\n \n 2023-08-17 14:10:49 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2461\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:09:17',4,'2023-08-17 16:10:49',4,0,NULL,NULL,NULL,'4bff5bff-95d4-4b93-b4e0-bb6a0c0e70b9'),(2462,'Clients given 5b with fair adherence','Clients given 5b with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5b with fair adherence\n Clients given 5b with fair adherence\n \n 2023-08-17 14:09:25 UTC\n \n 2023-08-17 14:10:18 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2462\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:09:25',4,'2023-08-17 16:10:18',4,0,NULL,NULL,NULL,'6fc3a2a5-a532-4394-8c1f-a824d12535b1'),(2463,'Clients given 5b with good adherence','Clients given 5b with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5b with good adherence\n Clients given 5b with good adherence\n \n 2023-08-17 14:11:16 UTC\n \n 2023-08-17 14:15:00 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2463\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:11:16',4,'2023-08-17 16:15:00',4,0,NULL,NULL,NULL,'0370fb97-e838-423b-a27f-84b8bfccbdf7'),(2464,'Clients given 5F with >=20Copies Viral Load','Clients given 5F with >=20Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5F with >=20Copies Viral Load\n Clients given 5F with >=20Copies Viral Load\n \n 2023-08-17 14:11:27 UTC\n \n 2023-08-17 14:12:29 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2464\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:11:27',4,'2023-08-17 16:12:29',4,0,NULL,NULL,NULL,'57bdd154-b1fd-445e-9c4f-4c86d9574dca'),(2465,'Clients given 5c with poor adherence','Clients given 5c with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5c with poor adherence\n Clients given 5c with poor adherence\n \n 2023-08-17 14:11:45 UTC\n \n 2023-08-17 14:15:44 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2465\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:11:45',4,'2023-08-17 16:15:44',4,0,NULL,NULL,NULL,'55fe3a12-7f92-4c13-a9e4-130999a508ab'),(2466,'Clients given 5F with <20 Copies Viral Load','Clients given 5F with <20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5F with <20 Copies Viral Load\n Clients given 5F with <20 Copies Viral Load\n \n 2023-08-17 14:13:17 UTC\n \n 2023-08-17 14:14:26 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2466\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:13:17',4,'2023-08-17 16:14:26',4,0,NULL,NULL,NULL,'99587c4e-7a32-4f0a-8875-db1f5ded867f'),(2467,'Clients given 5F with Undetectable Viral Load','Clients given 5F with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5F with Undetectable Viral Load\n Clients given 5F with Undetectable Viral Load\n \n 2023-08-17 14:15:33 UTC\n \n 2023-08-17 14:16:40 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2467\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:15:33',4,'2023-08-17 16:16:40',4,0,NULL,NULL,NULL,'ab5801be-bc9d-4d49-b637-c40c1442e859'),(2468,'Clients given 5c with fair adherence','Clients given 5c with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5c with fair adherence\n Clients given 5c with fair adherence\n \n 2023-08-17 14:16:13 UTC\n \n 2023-08-17 14:17:42 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2468\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:16:13',4,'2023-08-17 16:17:42',4,0,NULL,NULL,NULL,'c3f8c51c-b012-4725-93b5-3806093e90a2'),(2469,'Clients given 5G with >=20Copies Viral Load','Clients given 5G with >=20Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G with >=20Copies Viral Load\n Clients given 5G with >=20Copies Viral Load\n \n 2023-08-17 14:17:34 UTC\n \n 2023-08-17 14:19:13 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2469\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:17:34',4,'2023-08-17 16:19:13',4,0,NULL,NULL,NULL,'ac5ef4a7-17ea-4550-bd66-73b5d95c9c04'),(2470,'Clients given 5c with good adherence','Clients given 5c with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5c with good adherence\n Clients given 5c with good adherence\n \n 2023-08-17 14:18:32 UTC\n \n 2023-08-17 14:22:06 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2470\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:18:32',4,'2023-08-17 16:22:06',4,0,NULL,NULL,NULL,'c667f290-2936-42fb-859e-4d8978b03814'),(2471,'Clients given 5d with poor adherence','Clients given 5d with poor adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5d with poor adherence\n Clients given 5d with poor adherence\n \n 2023-08-17 14:19:32 UTC\n \n 2023-08-17 14:24:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2471\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:19:32',4,'2023-08-17 16:24:53',4,0,NULL,NULL,NULL,'4f154124-3ed5-4605-afb8-ab6d47c97cfa'),(2472,'Clients given 5G with <20 Copies Viral Load','Clients given 5G with <20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G with <20 Copies Viral Load\n Clients given 5G with <20 Copies Viral Load\n \n 2023-08-17 14:20:08 UTC\n \n 2023-08-17 14:23:09 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2472\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:20:08',4,'2023-08-17 16:23:09',4,0,NULL,NULL,NULL,'1b6b36fd-ab78-457d-9af4-ecd3ec235533'),(2473,'Clients given 5G with Undetectable Viral Load','Clients given 5G with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5G with Undetectable Viral Load\n Clients given 5G with Undetectable Viral Load\n \n 2023-08-17 14:24:11 UTC\n \n 2023-08-17 14:25:46 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2473\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:24:11',4,'2023-08-17 16:25:46',4,0,NULL,NULL,NULL,'8e1a22eb-ac03-450c-9550-43957fc8e8af'),(2474,'Clients given 5d with fair adherence','Clients given 5d with fair adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5d with fair adherence\n Clients given 5d with fair adherence\n \n 2023-08-17 14:26:28 UTC\n \n 2023-08-17 14:27:32 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2474\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:26:28',4,'2023-08-17 16:27:32',4,0,NULL,NULL,NULL,'64f11aa4-8642-4293-8a6d-ed4436c8b783'),(2475,'Clients given 5H with >=20Copies Viral Load','Clients given 5H with >=20Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5H with >=20Copies Viral Load\n Clients given 5H with >=20Copies Viral Load\n \n 2023-08-17 14:26:40 UTC\n \n 2023-08-17 14:27:31 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2475\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:26:40',4,'2023-08-17 16:27:31',4,0,NULL,NULL,NULL,'3184b05c-dbf5-4c1a-abed-d310e409fb09'),(2476,'Clients given 5d with good adherence','Clients given 5d with good adherence','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5d with good adherence\n Clients given 5d with good adherence\n \n 2023-08-17 14:27:55 UTC\n \n 2023-08-17 14:35:53 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2476\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:27:55',4,'2023-08-17 16:35:53',4,0,NULL,NULL,NULL,'d60ecbe6-5a56-449d-814e-d669d864ed86'),(2477,'Clients given 5H with <20 Copies Viral Load','Clients given 5H with <20 Copies Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5H with <20 Copies Viral Load\n Clients given 5H with <20 Copies Viral Load\n \n 2023-08-17 14:28:41 UTC\n \n 2023-08-17 14:30:28 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2477\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:28:41',4,'2023-08-17 16:30:28',4,0,NULL,NULL,NULL,'54488b0e-09b6-4801-8d42-510fefdfa04c'),(2478,'Clients given 5H with Undetectable Viral Load','Clients given 5H with Undetectable Viral Load','org.openmrs.module.reporting.indicator.Indicator','org.openmrs.module.reporting.indicator.CohortIndicator','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5H with Undetectable Viral Load\n Clients given 5H with Undetectable Viral Load\n \n 2023-08-17 14:31:09 UTC\n \n 2023-08-17 14:34:51 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2478\n COUNT\n \n \n \n \n endDate\n ${endDate}\n \n \n location\n ${location}\n \n \n startDate\n ${startDate}\n \n \n \n','2023-08-17 16:31:09',4,'2023-08-17 16:34:51',4,0,NULL,NULL,NULL,'7a4e4111-651c-407d-b445-041fd397599c'),(2479,'Clients given 5d with good adherence','Clients given 5d with good adherence','org.openmrs.module.reporting.cohort.definition.CohortDefinition','org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition','org.openmrs.module.reporting.serializer.ReportingSerializer','\n Clients given 5d with good adherence\n Clients given 5d with good adherence\n \n 2023-08-17 14:33:34 UTC\n \n 2023-08-17 14:33:55 UTC\n \n \n startDate\n \n java.util.Date\n true\n \n \n endDate\n \n java.util.Date\n true\n \n \n location\n \n org.openmrs.Location\n true\n \n \n 2479\n \nselect distinct o.person_id \nfrom obs o inner join location l on o.location_id = l.location_id \nwhere (o.location_id = :location or parent_location = :location) \nand o.person_id in \n(SELECT distinct Active_Patients.Id \nFROM \n(( \n -- 5d \n(SELECT Id \n FROM \n (select distinct patient.patient_id AS Id, \n floor(datediff(CAST(:endDate AS DATE), person.birthdate)/365) AS Age \n \n from obs o \n -- Picking Followup Date from Latest Followup Form \n INNER JOIN patient ON o.person_id = patient.patient_id \n INNER JOIN person ON person.person_id = patient.patient_id AND person.voided = 0 \n AND o.person_id in ( \n \n select active_clients.person_id \n from \n (select B.person_id, B.obs_group_id, B.value_datetime AS latest_follow_up \n from obs B \n inner join \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 3753 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id) as A \n on A.observation_id = B.obs_group_id \n where concept_id = 3752 \n and A.observation_id = B.obs_group_id \n and voided = 0 \n group by B.person_id \n ) as active_clients \n where active_clients.latest_follow_up >= cast(:endDate as date) \n \n and active_clients.person_id not in ( \n select distinct os.person_id \n from obs os \n where concept_id = 2249 \n AND CAST(os.value_datetime AS DATE) >= CAST(:startDate AS DATE) \n AND CAST(os.value_datetime AS DATE) <= CAST(:endDate AS DATE) \n AND os.voided = 0 \n ) \n \n and active_clients.person_id not in ( \n select distinct(o.person_id) \n from obs o \n where o.person_id in ( \n -- FOLLOW UPS \n select firstquery.person_id \n from \n ( \n select oss.person_id, SUBSTRING(MAX(CONCAT(oss.value_datetime, oss.obs_id)), 20) AS observation_id, CAST(max(oss.value_datetime) AS DATE) as latest_followup_obs \n from obs oss \n where oss.voided=0 \n and oss.concept_id=3752 \n and CAST(oss.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n and CAST(oss.obs_datetime AS DATE) >= DATE_ADD(CAST(:endDate AS DATE), INTERVAL -13 MONTH) \n group by oss.person_id) firstquery \n inner join ( \n select os.person_id,datediff(CAST(max(os.value_datetime) AS DATE), CAST(:endDate AS DATE)) as last_ap \n from obs os \n where concept_id = 3752 \n and CAST(os.obs_datetime AS DATE) <= CAST(:endDate AS DATE) \n group by os.person_id \n having last_ap < 0 \n ) secondquery \n on firstquery.person_id = secondquery.person_id \n ) and o.person_id in ( \n -- TOUTS \n select distinct(person_id) \n from \n ( \n select os.person_id, CAST(max(os.value_datetime) AS DATE) as latest_transferout \n from obs os \n where os.concept_id=2266 \n group by os.person_id \n having latest_transferout <= CAST(:endDate AS DATE) \n ) as TOUTS \n ) \n ) \n \n \n and active_clients.person_id not in ( \n select person_id \n from person \n where CAST(death_date AS DATE) <= cast(:endDate as date) \n and dead = 1 and voided = 0 \n ) \n and active_clients.person_id not in ( \n -- Visitors \n select person_id \n FROM \n (select person_id, max(obs_datetime), SUBSTRING(MAX(CONCAT(obs_datetime, obs_id)), 20) AS observation_id \n from obs where concept_id = 5416 \n and value_coded = 1 and voided = 0 \n and cast(obs_datetime as date) <= cast(:endDate as date) \n and voided = 0 \n group by person_id)visitor \n \n ) \n ) \n \n INNER JOIN patient_identifier ON patient_identifier.patient_id = person.person_id AND patient_identifier.identifier_type = 3 AND patient_identifier.preferred=1 \n INNER JOIN reporting_age_group AS observed_age_group ON \n CAST(:endDate AS DATE) BETWEEN (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.min_years YEAR), INTERVAL observed_age_group.min_days DAY)) \n AND (DATE_ADD(DATE_ADD(person.birthdate, INTERVAL observed_age_group.max_years YEAR), INTERVAL observed_age_group.max_days DAY)) \n WHERE observed_age_group.report_group_name = 'Modified_Ages' \n having Age < 15 \n ) AS Seen_Previous_ART_Clients \n) \n \n)Active_Patients \n \nINNER JOIN \n \n(SELECT regimen.Id as Id \nFROM \n( SELECT currentreg.person_id as Id,COALESCE(switch_regimen,substitute_regimen,current_regimen) ARV_regimen \n FROM( \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS current_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2250 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as currentreg \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS substitute_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 4284 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as substitutereg \n ON substitutereg.person_id = currentreg.person_id \n \n LEFT OUTER JOIN \n \n \n (select distinct o.person_id, max(o.obs_datetime) as maxdate, SUBSTRING(MAX(CONCAT(o.obs_datetime, o.value_coded)), 20) AS switch_regimen \n from obs o \n INNER JOIN patient_identifier ON patient_identifier.patient_id = o.person_id AND patient_identifier.preferred=1 \n where o.concept_id = 2268 \n AND o.voided = 0 \n and o.obs_datetime <= cast(:endDate as date) \n group by person_id) as switchreg \n ON switchreg.person_id = currentreg.person_id \n ) \n \n )as regimen \n where regimen.ARV_regimen = 4697)Current_Reg \nON Active_Patients.Id = Current_Reg.Id \n \nINNER JOIN \n \n-- Adherence \n ( \n select o.person_id as Id, o.value_coded \n from obs o \n inner join \n ( \n select oss.person_id, MAX(oss.obs_datetime) as max_observation, \n SUBSTRING(MAX(CONCAT(oss.obs_datetime, oss.value_coded)), 20) as adherence_hiv \n from obs oss \n where oss.concept_id = 2308 and oss.value_coded = 2305 \n and oss.voided=0 \n and cast(oss.obs_datetime as date) <= cast(:endDate as date) \n group by oss.person_id \n )latest \n on latest.person_id = o.person_id \n where o.concept_id = 2308 and o.value_coded = 2305 \n and o.obs_datetime = max_observation \n ) good_adherence \non Active_Patients.Id = good_adherence.Id \n)) \n \n\n','2023-08-17 16:33:34',4,'2023-08-17 16:33:55',4,0,NULL,NULL,NULL,'3300f25b-40f1-4c24-8223-41cfada5c62a'); @@ -84,4 +84,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2024-02-29 20:43:32 +-- Dump completed on 2024-03-01 14:05:06